Font change clears alignment
Posted: Mon Aug 01, 2016 8:18 pm
Lars,
It seems in the new XLSReadWrite 5 that if I assign a Font to a cell, then I lose any alignment that I have already set. It even prevents alignment after changing the font.
Example:
XLS.Sheets[0].AsString[1,2]:='Center'; // Text is put in cell
XLS.Sheets[0].Cell[1,2].HorizAlignment:=chaCenter; // Text is properly centered
XLS.Sheets[0].Cell[1,2].FontName:='Tahoma'; // Font name is changed AND THE HORIZALIGNMENT is cleared
XLS.Sheets[0].Cell[1,2].HorizAlignment:=chaCenter; // This doesn't correct the HorizAlignment
I have also tested with the CmdFormat methods and I get the same results.
So it appears that changing the Font will prevent any alignment, even if you try to change the alignment after changing the font. I've only tested the Horiz Alignment.
Am I doing something wrong here?
Thanks
It seems in the new XLSReadWrite 5 that if I assign a Font to a cell, then I lose any alignment that I have already set. It even prevents alignment after changing the font.
Example:
XLS.Sheets[0].AsString[1,2]:='Center'; // Text is put in cell
XLS.Sheets[0].Cell[1,2].HorizAlignment:=chaCenter; // Text is properly centered
XLS.Sheets[0].Cell[1,2].FontName:='Tahoma'; // Font name is changed AND THE HORIZALIGNMENT is cleared
XLS.Sheets[0].Cell[1,2].HorizAlignment:=chaCenter; // This doesn't correct the HorizAlignment
I have also tested with the CmdFormat methods and I get the same results.
So it appears that changing the Font will prevent any alignment, even if you try to change the alignment after changing the font. I've only tested the Horiz Alignment.
Am I doing something wrong here?
Thanks