AsVariant returns 1 if cell is clear
Posted: Fri Oct 24, 2014 12:52 pm
Hello,
I have problem with AsVariant. If cell is clear, funtion returns value "1". I think the problem is in GetAsVariant:
function TXLSWorksheet.GetAsVariant(ACol, ARow: integer): Variant;
var
Cell: TXLSCellItem;
begin
if FCells.FindCell(ACol,ARow,Cell) then begin
case FCells.CellType(@Cell) of
xctNone,
xctBlank: Result := 0;
// xctCurrency,
xctFloat: Result := FCells.GetFloat(@Cell);
xctString: Result := FCells.GetString(@Cell);
xctBoolean: Result := FCells.GetBoolean(@Cell);
xctError: Result := Xc12CellErrorNames[FCells.GetError(@Cell)];
xctFloatFormula: Result := FCells.GetFormulaValFloat(@Cell);
xctStringFormula: Result := FCells.GetFormulaValString(@Cell);
xctBooleanFormula: Result := FCells.GetFormulaValBoolean(@Cell);
xctErrorFormula: Result := Xc12CellErrorNames[FCells.GetFormulaValError(@Cell)];
end;
end
else
Result := varNull; <------------------------------- Here must be Null, not varNull which is varType and integer consts
end;
Thanks
Zdenek
I have problem with AsVariant. If cell is clear, funtion returns value "1". I think the problem is in GetAsVariant:
function TXLSWorksheet.GetAsVariant(ACol, ARow: integer): Variant;
var
Cell: TXLSCellItem;
begin
if FCells.FindCell(ACol,ARow,Cell) then begin
case FCells.CellType(@Cell) of
xctNone,
xctBlank: Result := 0;
// xctCurrency,
xctFloat: Result := FCells.GetFloat(@Cell);
xctString: Result := FCells.GetString(@Cell);
xctBoolean: Result := FCells.GetBoolean(@Cell);
xctError: Result := Xc12CellErrorNames[FCells.GetError(@Cell)];
xctFloatFormula: Result := FCells.GetFormulaValFloat(@Cell);
xctStringFormula: Result := FCells.GetFormulaValString(@Cell);
xctBooleanFormula: Result := FCells.GetFormulaValBoolean(@Cell);
xctErrorFormula: Result := Xc12CellErrorNames[FCells.GetFormulaValError(@Cell)];
end;
end
else
Result := varNull; <------------------------------- Here must be Null, not varNull which is varType and integer consts
end;
Thanks
Zdenek