You've already forked lazarus-ccr
fpspreadsheet: Fix max string length test.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6056 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -125,6 +125,7 @@ type
|
||||
procedure ReadWorksheet(AStream: TStream); override;
|
||||
procedure ReadXF(const AStream: TStream);
|
||||
public
|
||||
constructor Create(AWorkbook: TsWorkbook); override;
|
||||
destructor Destroy; override;
|
||||
procedure ReadFromStream(AStream: TStream;
|
||||
APassword: String = ''; AParams: TsStreamParams = []); override;
|
||||
@ -294,6 +295,8 @@ var
|
||||
|
||||
sfidExcel8: TsSpreadFormatID;
|
||||
|
||||
procedure InitBIFF8Limitations(out ALimitations: TsSpreadsheetFormatLimitations);
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
@ -478,8 +481,20 @@ type
|
||||
end;
|
||||
|
||||
|
||||
procedure InitBIFF8Limitations(out ALimitations: TsSpreadsheetFormatLimitations);
|
||||
begin
|
||||
InitBiffLimitations(ALimitations);
|
||||
end;
|
||||
|
||||
|
||||
{ TsSpreadBIFF8Reader }
|
||||
|
||||
constructor TsSpreadBIFF8Reader.Create(AWorkbook: TsWorkbook);
|
||||
begin
|
||||
inherited;
|
||||
InitBIFF8Limitations(FLimitations);
|
||||
end;
|
||||
|
||||
destructor TsSpreadBIFF8Reader.Destroy;
|
||||
var
|
||||
j: Integer;
|
||||
@ -2129,6 +2144,7 @@ end;
|
||||
constructor TsSpreadBIFF8Writer.Create(AWorkbook: TsWorkbook);
|
||||
begin
|
||||
inherited Create(AWorkbook);
|
||||
InitBiff8Limitations(FLimitations);
|
||||
FDateMode := Excel8Settings.DateMode;
|
||||
PopulateSharedStringTable(AWorkbook);
|
||||
end;
|
||||
|
@ -892,7 +892,7 @@ begin
|
||||
ALimitations.MaxRowCount := 65536;
|
||||
ALimitations.MaxPaletteSize := 64;
|
||||
ALimitations.MaxSheetNameLength := 31;
|
||||
ALimitations.MaxCharsInTextCell := 320000; // 32767 in Excel 2003
|
||||
ALimitations.MaxCharsInTextCell := 32000; // 32767 in Excel 2003
|
||||
end;
|
||||
|
||||
|
||||
|
@ -208,8 +208,6 @@ begin
|
||||
end;
|
||||
|
||||
procedure TSpreadWriteReadStringTests.TestWriteReadStringsLimits;
|
||||
const
|
||||
MaxBytesBIFF8=32758; //limit for strings in this file format
|
||||
var
|
||||
MyWorksheet: TsWorksheet;
|
||||
MyWorkbook: TsWorkbook;
|
||||
@ -219,11 +217,16 @@ var
|
||||
Row: Cardinal;
|
||||
TempFile: string; //write xls/xml to this file and read back from it
|
||||
TestResult: boolean;
|
||||
MaxBytesBIFF8: Integer;
|
||||
limitations: TsSpreadsheetFormatLimitations;
|
||||
begin
|
||||
InitBIFF8Limitations(limitations);
|
||||
MaxBytesBIFF8 := limitations.MaxCharsInTextCell;
|
||||
|
||||
LocalNormStrings[0]:=StringOfChar('a',MaxBytesBIFF8-1);
|
||||
LocalNormStrings[1]:=StringOfChar('b',MaxBytesBIFF8);
|
||||
LocalNormStrings[2]:=StringOfChar('z',MaxBytesBiff8+1); //problems should occur here
|
||||
LocalNormStrings[3]:='this text should be readable'; //whatever happens, this text should be ok
|
||||
LocalNormStrings[3]:='this text should be readable'; //whatever happens, this text should be ok
|
||||
|
||||
{// Not needed: use workbook.writetofile with overwrite=true
|
||||
if fileexists(TempFile) then
|
||||
|
Reference in New Issue
Block a user