Page 1 of 1

Line Breaks in cells

Posted: Sun Jul 19, 2020 12:11 pm
by Schmulm
Hi,
How can I insert a line break in a cell in a way that it is displayed correctly?
I tried: AsString[0,0] := 'line1' + sLinebreak + 'line2';
When I open the excel file, the content of the first cell is "line1line2".
But when I simply click into the cell and press F2 and Enter, then the text is displayed correctly with the line break.
So, it somehow works to a certain extent.
I want Excel to show the line break right after opening the file without any unnecessary clicking.
How can this be done?

Thanks
Schmulm

Re: Line Breaks in cells

Posted: Sun Jul 19, 2020 7:18 pm
by larsa
Hello

You must set WrapText := True

Example:

Code: Select all

XLS[0].AsString[1,1] := 'One' + #10 + 'Two';
XLS[0].Cell[1,1].WrapText := True;

Re: Line Breaks in cells

Posted: Fri Jul 31, 2020 6:09 pm
by Schmulm
Thanks