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:
parent
be3e5d16ac
commit
6d4175c72a
@ -87,7 +87,9 @@ begin
|
||||
MyWorksheet.WriteUTF8Text(0, 3, 'Fourth');
|
||||
|
||||
// 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
|
||||
MyWorkbook.WriteToFile(MyDir + 'test.xlsx', sfOOXML);
|
||||
|
@ -115,7 +115,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
variants, fpsNumFormatParser;
|
||||
variants, fpsNumFormatParser, xlscommon;
|
||||
|
||||
const
|
||||
{ OOXML general XML constants }
|
||||
@ -1261,8 +1261,12 @@ end;
|
||||
*******************************************************************}
|
||||
procedure TsSpreadOOXMLWriter.WriteDateTime(AStream: TStream;
|
||||
const ARow, ACol: Cardinal; const AValue: TDateTime; ACell: PCell);
|
||||
var
|
||||
ExcelDateSerial: double;
|
||||
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;
|
||||
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user