fpspreadsheet: Add format string to number format error messages.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7036 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-07-14 21:14:14 +00:00
parent a601573459
commit 8ff3813be2
3 changed files with 14 additions and 4 deletions

View File

@ -36,6 +36,8 @@ var
s: String; s: String;
begin begin
WriteLn('Creating a demo file in Excel2003/XML format...');
MyDir := ExtractFilePath(ParamStr(0)); MyDir := ExtractFilePath(ParamStr(0));
// Create the spreadsheet // Create the spreadsheet
@ -394,5 +396,13 @@ begin
// Save the spreadsheet to a file // Save the spreadsheet to a file
MyWorkbook.WriteToFile(MyDir + 'test.xml', sfExcelXML, true); MyWorkbook.WriteToFile(MyDir + 'test.xml', sfExcelXML, true);
MyWorkbook.Free; MyWorkbook.Free;
WriteLn('Done.');
WriteLn('File saved as "' + MyDir + 'text.xml"');
{$IFDEF WINDOWS}
WriteLn;
WriteLn('Press ENTER to quit.');
ReadLn;
{$ENDIF}
end. end.

View File

@ -5595,10 +5595,10 @@ begin
try try
// Format string ok? // Format string ok?
if parser.Status <> psOK then if parser.Status <> psOK then
raise EFPSpreadsheet.Create(rsNoValidNumberFormatString); raise EFPSpreadsheet.CreateFmt(rsNoValidNumberFormatString, [ANumFormatStr]);
// Make sure that we do not use a number format for date/times values. // Make sure that we do not use a number format for date/times values.
if not parser.IsDateTimeFormat then if not parser.IsDateTimeFormat then
raise EFPSpreadsheet.Create(rsInvalidDateTimeFormat); raise EFPSpreadsheet.CreateFmt(rsInvalidDateTimeFormat, [ANumFormatStr]);
// Avoid possible duplication of standard formats // Avoid possible duplication of standard formats
if ANumFormat = nfCustom then if ANumFormat = nfCustom then
ANumFormat := parser.NumFormat; ANumFormat := parser.NumFormat;

View File

@ -128,10 +128,10 @@ resourcestring
// Format // Format
rsAmbiguousDecThouSeparator = 'Assuming usage of decimal separator in "%s".'; rsAmbiguousDecThouSeparator = 'Assuming usage of decimal separator in "%s".';
rsInvalidDateTimeFormat = 'Trying to use an incompatible date/time format.'; rsInvalidDateTimeFormat = 'Trying to use an incompatible date/time format (%s).';
rsInvalidFontIndex = 'Invalid font index'; rsInvalidFontIndex = 'Invalid font index';
rsInvalidNumberFormat = 'Trying to use an incompatible number format.'; rsInvalidNumberFormat = 'Trying to use an incompatible number format.';
rsNoValidNumberFormatString = 'No valid number format string.'; rsNoValidNumberFormatString = 'No valid number format string (%s).';
// Formulas // Formulas
rsFormulaNotSupported = 'The formula in cell %s is not supported by this file format: %s'; rsFormulaNotSupported = 'The formula in cell %s is not supported by this file format: %s';