I am trying to implement version 5 and having a little problem in finding a solution for the following line that works in version 4:
XLS2[0].ApplyFormat.Format(...)
Do I have to use copycells or is there a better method?
Regards,
Robert Jan
XlsReadwriteii5 migration from 4
-
- Posts: 17
- Joined: Fri Feb 01, 2013 8:24 pm
Re: XlsReadwriteii5 migration from 4
For anyone who has the same problem. I found the solution in de defaultformat. Very simple and fast!! You only have to change the defaultformat before writing the cells. Just an example how simple it is:
// Create format F2
XLS.CmdFormat.BeginEdit(Nil);
XLS.CmdFormat.Fill.BackgroundColor.RGB := $FF1010;
XLS.CmdFormat.Font.Name := 'Ariel Black';
XLS.CmdFormat.AddAsDefault('F2');
// Assign format by name.
XLS.DefaultFormat := XLS.CmdFormat.Defaults.Find('F2')
// Write cells
XLS[0].AsFloat[2,10] := 525;
// Reset the default format.
XLS.DefaultFormat := Nil;
Goodluck.
// Create format F2
XLS.CmdFormat.BeginEdit(Nil);
XLS.CmdFormat.Fill.BackgroundColor.RGB := $FF1010;
XLS.CmdFormat.Font.Name := 'Ariel Black';
XLS.CmdFormat.AddAsDefault('F2');
// Assign format by name.
XLS.DefaultFormat := XLS.CmdFormat.Defaults.Find('F2')
// Write cells
XLS[0].AsFloat[2,10] := 525;
// Reset the default format.
XLS.DefaultFormat := Nil;
Goodluck.