Based on the simple example of your documentation I tried to create a file, put a text with a newline in a cell and save it.
When opening that file with Excel (both Excel2010 and Excel2019) there is a strange behaviour.
That cell displays the text without newline in the cell itself and as two lines in the editfield.
When I click in the editfield once the text in the cell changes to a two line display too, as it is intended.
Do you have an idea how to display a two line cell immediately after opeing ?
Here is the sourcecode
procedure TExcelData.CreateExcelFile;
var
h, w: integer;
xls: TXlsFile;
begin
// Create a new empty Excel file, with default formatting as if it was created by Excel 2019.
xls := TXlsFile.Create(1, TExcelFileFormat.v2019, true);
try
// Caution, #10#13 writes double CRLF, use #13#10
h := xls.GetRowHeight(3);
w := xls.GetColWidth(1);
xls.SetRowHeight(3, h * 3);
xls.SetColWidth(1, w * 3);
xls.SetCellValue(3, 1, 'Company Name : '+ #13#10 + 'Cranelock');
xls.Save(TPath.Combine(QsStatPath, 'test.xlsx'));
finally
xls.Free;
end;
end;