Currency format
Posted: Wed Oct 12, 2011 7:06 am
Hi,
I'm testing XLSReadWriteII4 trial version. (First time to use any XLSReadWrite version.)
While this software may be intuitive and obvious to many, it's not to me!
After searching through the help file and this bulletin board, I can't find any information about formatting a cell to 'currency'.
I'm using Delphi 2010 to build a spreadsheet.
Most of this program works, but I can't figure out how to format a particular cell as "currency" (with it's associated parameters).
Here's a brief sample of what I'm doing:
with XLRW.Sheet[0] do
begin
Range.ItemsRef['A2:J6'].FontStyle := [xfsBold];
Columns.AddIfNone(8,1); //Column 'I'
Columns[8].PixelWidth := 96;
Range.ItemsRef['A2:J6].VertAlignment := cvaCenter;
Range.ItemsRef['C5:I6].HorizAlignment := chaCenter;
AsFormula[8,5] := 'SUM(H6:H7)';
//
// This is where I would like to format Cell[8,5] as currency with 2 decimal places and a symbol, e.g. $87.23
end;
If it is possible to do this, could someone provide a line of sample code to point me in the right direction? (And what, if anything, I need to include in the 'uses' clause.)
Many thanks in advance.
(PS - If there are easier ways to write the code above, any helpful pointers would be greatly appreciated!)
I'm testing XLSReadWriteII4 trial version. (First time to use any XLSReadWrite version.)
While this software may be intuitive and obvious to many, it's not to me!
After searching through the help file and this bulletin board, I can't find any information about formatting a cell to 'currency'.
I'm using Delphi 2010 to build a spreadsheet.
Most of this program works, but I can't figure out how to format a particular cell as "currency" (with it's associated parameters).
Here's a brief sample of what I'm doing:
with XLRW.Sheet[0] do
begin
Range.ItemsRef['A2:J6'].FontStyle := [xfsBold];
Columns.AddIfNone(8,1); //Column 'I'
Columns[8].PixelWidth := 96;
Range.ItemsRef['A2:J6].VertAlignment := cvaCenter;
Range.ItemsRef['C5:I6].HorizAlignment := chaCenter;
AsFormula[8,5] := 'SUM(H6:H7)';
//
// This is where I would like to format Cell[8,5] as currency with 2 decimal places and a symbol, e.g. $87.23
end;
If it is possible to do this, could someone provide a line of sample code to point me in the right direction? (And what, if anything, I need to include in the 'uses' clause.)
Many thanks in advance.
(PS - If there are easier ways to write the code above, any helpful pointers would be greatly appreciated!)