fpspreadsheet: Fix time interval format with custom format string not being written correctly to biff.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3193 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2014-06-18 08:39:54 +00:00
parent 5bc0898317
commit d99cddeb90
2 changed files with 6 additions and 4 deletions

View File

@ -314,14 +314,14 @@ begin
MyWorksheet.WriteNumberFormat(r, 1, nfCustom, UTF8ToAnsi(fmt));
MyWorksheet.WriteNumber(r, 2, -number);
MyWorksheet.WriteNumberFormat(r, 2, nfCustom, UTF8ToAnsi(fmt));
inc(r);
inc(r); { --- not working correctly: Except reports an error
fmt := '[Green]"¥"#,##0.0_);[Red]-"¥"#,##0.0';
MyWorksheet.WriteUTF8Text(r, 0, 'nfCustom, '+fmt);
MyWorksheet.WriteNumber(r, 1, number);
MyWorksheet.WriteNumberFormat(r, 1, nfCustom, UTF8ToAnsi(fmt));
MyWorksheet.WriteNumber(r, 2, -number);
MyWorksheet.WriteNumberFormat(r, 2, nfCustom, UTF8ToAnsi(fmt));
inc(r);
inc(r); }
MyWorksheet.WriteUTF8Text(r, 0, 'nfCustom, _("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)');
MyWorksheet.WriteNumber(r, 1, number);
MyWorksheet.WriteNumberFormat(r, 1, nfCustom, '_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)');
@ -356,7 +356,6 @@ begin
MyWorksheet.WriteUTF8Text(r, 0, 'nfTimeInterval, h');
MyWorksheet.WriteDateTime(r, 1, number, nfTimeInterval, 'h');
//MyFormula.FormulaStr := '';
// Creates a new worksheet

View File

@ -2129,7 +2129,10 @@ begin
// The user can choose another date format if he wants to
if AFormatStr = '' then
AFormatStr := BuildDateTimeFormatString(AFormat, Workbook.FormatSettings, AFormatStr);
AFormatStr := BuildDateTimeFormatString(AFormat, Workbook.FormatSettings, AFormatStr)
else
if AFormat = nfTimeInterval then
AFormatStr := AddIntervalBrackets(AFormatStr);
// Check whether the formatstring is for date/times.
if AFormatStr <> '' then begin