Copy cell-format-settings to a new cell
Posted: Mon Jan 14, 2008 10:04 am
Hi everyone,
I want to use a "normal" (with Excel created) file as a template. So my customers can create their own designs for output.
My program uses two XLSReadWriteII components. One to read the template file and one to create the new output-file.
In the template file, each cell is already formated (currency, float, date, font color, border ect.).
It should work like this (I know this aren't the correct commands, but they show what I want to do):
The cell A1 is a currency-cell. So the final result in cell A1 in XLSOutput should be 24,00 €.
It would be fine, if fontstyle, font color ect. will be copied, too.
Has anyone an idea how this can be done ??
Regards,
Rainer
I want to use a "normal" (with Excel created) file as a template. So my customers can create their own designs for output.
My program uses two XLSReadWriteII components. One to read the template file and one to create the new output-file.
In the template file, each cell is already formated (currency, float, date, font color, border ect.).
It should work like this (I know this aren't the correct commands, but they show what I want to do):
Code: Select all
XLSTemplate.FileName:='c:\template.xls';
XLSTemplate.Read;
myFormat := XLSTemplate.Sheet[0].GetFormat['A1'];
XLSOutPut.Sheet[0].AsString['A1'] := '24';
XLSOutPut.Sheet[0].SetFormat['A1'] := myFormat;
XLSOutPut.FileName :='myoutput.xls';
XlsOutPut.Write;
It would be fine, if fontstyle, font color ect. will be copied, too.
Has anyone an idea how this can be done ??
Regards,
Rainer