EPPlus
EPPlus copied to clipboard
Row of Cell with TextWrap Auto Sizes in Excel but not in LibreOffice Calc
I can make a simple XLSX file using EPPlus 6 using the following lines of code:
worksheet.Column(2).Style.WrapText = true;
worksheet.Cells[2, 2].Value = "A line of text that should wrap";
The file made with the code as above opens well in Excel such that the row of cell with text wrapping auto sizes to a larger height to fit the text. However, LibreOffice Calc does not auto sizes the row of cell with text wrapping.
After opening the file in Excel, if I save it from excel then the file opens in LibreOffice Calc as expected (row height increased to fit the wrapped text).
From the above observation, it seems that it is possible to format an XLSX file which opens correctly in LibreOffice Calc for text wrapping. EPPlus, however, is not able to produce such a file.
Please let me know if there is something I can do to make things work for LibreOffice Calc. Otherwise this can be an issue that needs to be resolved in EPPlus.
Thanks for reporting, we will have a look at this.
EPPlus currently doesn't autofit row heights. You can however set the row heights manually if autofit is not supported by the program you are opening the file in. We will likely add support for auto-fitting row heights in the future.
Hi @JanKallman, we are currently experiencing issues in our Excels since this feature is not available at the moment. I was just wondering if there is any chance that this feature with autofitting row heights might come in a release soon?
@YanerTavuz If you set Style.WrapText = true on your columns/rows/ranges (see above) Excel should adjust the row height when the workbook is opened.
It will be very difficult to implement something in EPPlus that will work for all spreadsheet programs and environments as EPPlus very often runs on a server and not on the computer where the spreadsheet program executes. The results of these measurements are dependent on what spreadsheet software you use and graphic settings on the client computer. So we will probably not try to do this.
@swmal I have set the Worksheet.Cells.Style.Wraptext = true. But there is still some cases where the cells "crops" the containing text.
As we cannot do this accurately, we will not implement this feature. I suggest you request Libre Office to support auto fit rows on load.