We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Empty space in newline not displayed in sheetrenderer


We have a cell that has a newline and some empty spaces after that.
The empty spaces are not rendered.

Below is the sample code, please notice the difference when we add the “1”.

var tempWorkbook = new Workbook(FileFormatType.Xlsx);

var ws = tempWorkbook.Worksheets[0];
var cell = ws.Cells;
var sb = new StringBuilder();

sb.Append(“test”).Append(Environment.NewLine).Append(" a");
tempWorkbook.Worksheets[0].Cells[1, 1].Value = sb.ToString();

sb.Append(“test”).Append(Environment.NewLine).Append(“1 a”);
tempWorkbook.Worksheets[0].Cells[2, 2].Value = sb.ToString();

Aspose.Cells.Style oStyle = cell[1, 1].GetStyle();
oStyle.IsTextWrapped = true;
ws.Cells[1, 1].SetStyle(oStyle);
ws.Cells[2, 2].SetStyle(oStyle);

var sheetRender = new SheetRender(tempWorkbook.Worksheets[0], new ImageOrPrintOptions());

Best regards,
Stefan Botan ,
IBM Romania

Hi Stephan,

Thank you for contacting Aspose support.

We have evaluated your presented scenario while using the latest version of Aspose.Cells for .NET 8.2.2, and we believe the results are correct. The newline is shown correctly in the image as well as resultant spreadsheet file. Please check the attached files for your reference, and feel free to write back in case you have any concerns.