Page 1 of 1

XlsReadwriteii5 migration from 4

Posted: Sun Feb 03, 2013 9:08 pm
by rjvanvliet
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

Re: XlsReadwriteii5 migration from 4

Posted: Mon Mar 04, 2013 7:25 am
by rjvanvliet
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.