You've already forked lazarus-ccr
fpspreadsheet: Writing of date/time values to xlsx files. Date/time formats working.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3322 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -87,7 +87,9 @@ begin
|
|||||||
MyWorksheet.WriteUTF8Text(0, 3, 'Fourth');
|
MyWorksheet.WriteUTF8Text(0, 3, 'Fourth');
|
||||||
|
|
||||||
// Write current date/time
|
// Write current date/time
|
||||||
MyWorksheet.WriteDateTime(0, 5, now);
|
MyWorksheet.WriteDateTime(0, 5, now, nfShortDate);
|
||||||
|
MyWorksheet.WriteDateTime(1, 5, now, nfShortTime);
|
||||||
|
MyWorksheet.WriteDateTime(2, 5, now, 'nn:ss.zzz');
|
||||||
|
|
||||||
// Save the spreadsheet to a file
|
// Save the spreadsheet to a file
|
||||||
MyWorkbook.WriteToFile(MyDir + 'test.xlsx', sfOOXML);
|
MyWorkbook.WriteToFile(MyDir + 'test.xlsx', sfOOXML);
|
||||||
|
@@ -115,7 +115,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
variants, fpsNumFormatParser;
|
variants, fpsNumFormatParser, xlscommon;
|
||||||
|
|
||||||
const
|
const
|
||||||
{ OOXML general XML constants }
|
{ OOXML general XML constants }
|
||||||
@@ -1261,8 +1261,12 @@ end;
|
|||||||
*******************************************************************}
|
*******************************************************************}
|
||||||
procedure TsSpreadOOXMLWriter.WriteDateTime(AStream: TStream;
|
procedure TsSpreadOOXMLWriter.WriteDateTime(AStream: TStream;
|
||||||
const ARow, ACol: Cardinal; const AValue: TDateTime; ACell: PCell);
|
const ARow, ACol: Cardinal; const AValue: TDateTime; ACell: PCell);
|
||||||
|
var
|
||||||
|
ExcelDateSerial: double;
|
||||||
begin
|
begin
|
||||||
WriteLabel(AStream, ARow, ACol, FormatDateTime(ISO8601Format, AValue), ACell);
|
ExcelDateSerial := ConvertDateTimeToExcelDateTime(AValue, dm1900); //FDateMode);
|
||||||
|
WriteNumber(AStream, ARow, ACol, ExcelDateSerial, ACell);
|
||||||
|
// WriteLabel(AStream, ARow, ACol, FormatDateTime(ISO8601Format, AValue), ACell);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user