You've already forked lazarus-ccr
fpspreadsheet: Cells for which the OnWriteCellData event handler returns null are skipped in virtual mode if they don't carry a format.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3603 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -44,6 +44,9 @@ var
|
||||
// formatting of all virtual cells in row 0.
|
||||
// Important: The template cell must be an existing cell in the worksheet.
|
||||
end else
|
||||
if (ACol = 0) then
|
||||
AData := NULL // Let's skip the column #0
|
||||
else
|
||||
if odd(random(10)) then begin
|
||||
AData := Format('R=%d-C=%d', [ARow, ACol]);
|
||||
end else
|
||||
|
@ -2869,10 +2869,10 @@ var
|
||||
lCell: TCell;
|
||||
value: variant;
|
||||
styleCell: PCell;
|
||||
|
||||
begin
|
||||
for r := 0 to Workbook.VirtualRowCount-1 do begin
|
||||
for c := 0 to Workbook.VirtualColCount-1 do begin
|
||||
for r := 0 to Workbook.VirtualRowCount-1 do
|
||||
for c := 0 to Workbook.VirtualColCount-1 do
|
||||
begin
|
||||
InitCell(lCell);
|
||||
value := varNull;
|
||||
styleCell := nil;
|
||||
@ -2881,21 +2881,29 @@ begin
|
||||
lCell.Row := r;
|
||||
lCell.Col := c;
|
||||
if VarIsNull(value) then
|
||||
begin // ignore empty cells that don't have a format
|
||||
if styleCell <> nil then
|
||||
lCell.ContentType := cctEmpty
|
||||
else
|
||||
if VarIsNumeric(value) then begin
|
||||
Continue;
|
||||
end else
|
||||
if VarIsNumeric(value) then
|
||||
begin
|
||||
lCell.ContentType := cctNumber;
|
||||
lCell.NumberValue := value;
|
||||
end else
|
||||
if VarType(value) = varDate then begin
|
||||
if VarType(value) = varDate then
|
||||
begin
|
||||
lCell.ContentType := cctDateTime;
|
||||
lCell.DateTimeValue := StrToDateTime(VarToStr(value), Workbook.FormatSettings);
|
||||
end else
|
||||
if VarIsStr(value) then begin
|
||||
if VarIsStr(value) then
|
||||
begin
|
||||
lCell.ContentType := cctUTF8String;
|
||||
lCell.UTF8StringValue := VarToStrDef(value, '');
|
||||
end else
|
||||
if VarIsBool(value) then begin
|
||||
if VarIsBool(value) then
|
||||
begin
|
||||
lCell.ContentType := cctBool;
|
||||
lCell.BoolValue := value <> 0;
|
||||
end else
|
||||
@ -2904,7 +2912,6 @@ begin
|
||||
value := varNULL;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ Writes an Excel 5/8 WINDOW1 record
|
||||
This record contains general settings for the document window and
|
||||
|
@ -2010,21 +2010,29 @@ begin
|
||||
lCell.Row := r;
|
||||
lCell.Col := c;
|
||||
if VarIsNull(value) then
|
||||
begin
|
||||
if styleCell <> nil then
|
||||
lCell.ContentType := cctEmpty
|
||||
else
|
||||
if VarIsNumeric(value) then begin
|
||||
Continue;
|
||||
end else
|
||||
if VarIsNumeric(value) then
|
||||
begin
|
||||
lCell.ContentType := cctNumber;
|
||||
lCell.NumberValue := value;
|
||||
end else
|
||||
if VarType(value) = varDate then begin
|
||||
if VarType(value) = varDate then
|
||||
begin
|
||||
lCell.ContentType := cctDateTime;
|
||||
lCell.DateTimeValue := StrToDate(VarToStr(value), Workbook.FormatSettings);
|
||||
end else
|
||||
if VarIsStr(value) then begin
|
||||
if VarIsStr(value) then
|
||||
begin
|
||||
lCell.ContentType := cctUTF8String;
|
||||
lCell.UTF8StringValue := VarToStrDef(value, '');
|
||||
end else
|
||||
if VarIsBool(value) then begin
|
||||
if VarIsBool(value) then
|
||||
begin
|
||||
lCell.ContentType := cctBool;
|
||||
lCell.BoolValue := value <> 0;
|
||||
end;
|
||||
|
Reference in New Issue
Block a user