Page 1 of 1

AsFormula =#N/A error

Posted: Wed Oct 12, 2011 6:46 pm
by ASD
Hello!
I try trial version of XLSReadWriteII 4.00.55a in Delphi XE2

Situation :

xls.sheets[0].AsFormula[1,1]:='A1+B1';

Result in excel = =#N/A

thx,
ASD

Re: AsFormula =#N/A error

Posted: Fri Oct 14, 2011 12:31 am
by a_bloke
I have the same problem with the same trial version using D_2010 when trying:

xls.sheets[0].AsFormulaRef['H7'] := 'C7*D7';

Excel version 14.0.4734.1000 (32-bit)

....and still can't find a solution to the previous post about how to set currency formatting:

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;

Re: AsFormula =#N/A error

Posted: Tue Oct 18, 2011 1:41 am
by a_bloke
The only way I have found around the problem is the following....

xls.sheets[0].AsFormula[1,1]:='SUM(A1,B1)'; which could also be written as xls.sheets[0].AsFormula[1,1]:='SUM(A1:B1)'; in this case.

or in my case

xls.sheets[0].AsFormulaRef['H7'] := 'PRODUCT(C7:D7)';

But still haven't found a way to format cells as currency.

Re: AsFormula =#N/A error

Posted: Wed Oct 19, 2011 10:01 am
by larsa
Hello

The N/A error is fixed in the latest update.

When formatting numeric values, use the NumberFormat property. Example: XLS.Sheets[0].Cell[0,0].NumberFormat := '# ##0.000';
The format string is the same as in excel.

Re: AsFormula =#N/A error

Posted: Sat Oct 22, 2011 12:01 pm
by ASD
[quote="larsa"]Hello

The N/A error is fixed in the latest update.

When formatting numeric values, use the NumberFormat property. Example: XLS.Sheets[0].Cell[0,0].NumberFormat := '# ##0.000';
The format string is the same as in excel.[/quote]

thanx, good job