Create line breaks for HTML-based documents HTML on Mac OS X

I successfully create Excel documents using the HTML method, simply by creating an HTML table, setting mimetype for the / msexcel application, and ensuring that the generated file name has a .xls extension. This method works great for both Windows and Mac versions of Excel.

However, I have a requirement to generate line breaks inside the cell.

If I use <br/> inside <td> , then Excel actually splits the contents into a new cell for each line break. It’s easy to work for this problem by inserting the style into the br tag, as shown below: <br style="mso-data-placement:same-cell;"> , which tells Excel to continue breaking the line inside the cell or to define the style br { mso-data-placement:same-cell; } br { mso-data-placement:same-cell; } in the header of the HTML document.

The problem is that this style does not work correctly for Mac OS X Excel. When Excel sees the mso data placement style, it correctly stores the contents inside the same cell, however it ignores the br command incorrectly, so all line breaks are ignored.

Does anyone know how to create a line break inside a cell in an Excel HTML file for Mac OS X?

Thanks Matt

+4
source share

Source: https://habr.com/ru/post/1388332/


All Articles