git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5243 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2016-10-05 22:02:41 +00:00
parent 85187e4927
commit 4df9e5dc9b
4 changed files with 24 additions and 0 deletions

View File

@ -827,6 +827,15 @@ begin
el := 0;
while (el < numEl) do begin
{
if section.Elements[el].Token = nftTextFormat then
begin
s := FloatToStrF(AValue, ffGeneral, 20, 20, fs);
if (sidx=0) and isNeg then s := '-' + s;
Result := Result + s;
end
else
}
if section.Elements[el].Token = nftGeneral then
begin
s := FloatToStrF(AValue, ffGeneral, 20, 20, fs);

View File

@ -2598,6 +2598,7 @@ var
cell: PCell;
fmt: PsCellFormat;
numFmt: TsNumFormatParams;
txtNode: TDOMNode;
begin
if FIsVirtualMode then
begin
@ -2637,6 +2638,12 @@ begin
dmODS1900: cell^.DateTimeValue := cell^.NumberValue + DATEMODE_1900_BASE;
dmODS1904: cell^.DateTimeValue := cell^.NumberValue + DATEMODE_1904_BASE;
end;
end else
if IsTextFormat(numFmt) then begin
// Cell has TEXT format @ --> store number as text
txtNode := ACellNode.FirstChild;
if txtNode.NodeName = 'text:p' then
FWorksheet.WriteText(cell, GetNodeValue(txtNode));
end;
if FIsVirtualMode then

View File

@ -1791,6 +1791,8 @@ begin
ExtractNumberFormat(XF, nf, nfs);
if IsDateTime(lNumber, nf, nfs, lDateTime) then
FWorksheet.WriteDateTime(cell, lDateTime, nf, nfs)
else if nf=nfText then
FWorksheet.WriteText(cell, FloatToStrF(lNumber, ffGeneral, 20,20, FWorkbook.FormatSettings))
else
FWorksheet.WriteNumber(cell, lNumber, nf, nfs);
ApplyCellFormatting(cell, XF);
@ -1843,6 +1845,8 @@ begin
if IsDateTime(value, nf, nfs, dt) then
FWorksheet.WriteDateTime(cell, dt, nf, nfs)
else if nf = nfText then
FWorksheet.WriteText(cell, FloatToStrF(value, ffGeneral, 20, 20, FWorkbook.FormatSettings))
else
FWorksheet.WriteNumber(cell, value, nf, nfs);
@ -2054,6 +2058,8 @@ begin
ExtractNumberFormat(XF, nf, nfs);
if IsDateTime(Number, nf, nfs, lDateTime) then
FWorksheet.WriteDateTime(cell, lDateTime, nf, nfs)
else if nf=nfText then
FWorksheet.WriteText(cell, FloatToStrF(Number, ffGeneral, 20,20, FWorkbook.FormatSettings))
else
FWorksheet.WriteNumber(cell, Number, nf, nfs);

View File

@ -691,6 +691,8 @@ begin
number := ConvertExcelDateTimeToDateTime(number, FDateMode);
AWorksheet.WriteDateTime(cell, number);
end
else if IsTextFormat(numFmt) then
AWorksheet.WriteText(cell, dataStr)
else
AWorksheet.WriteNumber(cell, number);
end