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 ReadWorksheet(AStream: TStream); override;
|
||||||
procedure ReadXF(const AStream: TStream);
|
procedure ReadXF(const AStream: TStream);
|
||||||
public
|
public
|
||||||
|
constructor Create(AWorkbook: TsWorkbook); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure ReadFromStream(AStream: TStream;
|
procedure ReadFromStream(AStream: TStream;
|
||||||
APassword: String = ''; AParams: TsStreamParams = []); override;
|
APassword: String = ''; AParams: TsStreamParams = []); override;
|
||||||
@@ -294,6 +295,8 @@ var
|
|||||||
|
|
||||||
sfidExcel8: TsSpreadFormatID;
|
sfidExcel8: TsSpreadFormatID;
|
||||||
|
|
||||||
|
procedure InitBIFF8Limitations(out ALimitations: TsSpreadsheetFormatLimitations);
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@@ -478,8 +481,20 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure InitBIFF8Limitations(out ALimitations: TsSpreadsheetFormatLimitations);
|
||||||
|
begin
|
||||||
|
InitBiffLimitations(ALimitations);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TsSpreadBIFF8Reader }
|
{ TsSpreadBIFF8Reader }
|
||||||
|
|
||||||
|
constructor TsSpreadBIFF8Reader.Create(AWorkbook: TsWorkbook);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
InitBIFF8Limitations(FLimitations);
|
||||||
|
end;
|
||||||
|
|
||||||
destructor TsSpreadBIFF8Reader.Destroy;
|
destructor TsSpreadBIFF8Reader.Destroy;
|
||||||
var
|
var
|
||||||
j: Integer;
|
j: Integer;
|
||||||
@@ -2129,6 +2144,7 @@ end;
|
|||||||
constructor TsSpreadBIFF8Writer.Create(AWorkbook: TsWorkbook);
|
constructor TsSpreadBIFF8Writer.Create(AWorkbook: TsWorkbook);
|
||||||
begin
|
begin
|
||||||
inherited Create(AWorkbook);
|
inherited Create(AWorkbook);
|
||||||
|
InitBiff8Limitations(FLimitations);
|
||||||
FDateMode := Excel8Settings.DateMode;
|
FDateMode := Excel8Settings.DateMode;
|
||||||
PopulateSharedStringTable(AWorkbook);
|
PopulateSharedStringTable(AWorkbook);
|
||||||
end;
|
end;
|
||||||
|
@@ -892,7 +892,7 @@ begin
|
|||||||
ALimitations.MaxRowCount := 65536;
|
ALimitations.MaxRowCount := 65536;
|
||||||
ALimitations.MaxPaletteSize := 64;
|
ALimitations.MaxPaletteSize := 64;
|
||||||
ALimitations.MaxSheetNameLength := 31;
|
ALimitations.MaxSheetNameLength := 31;
|
||||||
ALimitations.MaxCharsInTextCell := 320000; // 32767 in Excel 2003
|
ALimitations.MaxCharsInTextCell := 32000; // 32767 in Excel 2003
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -208,8 +208,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadStringTests.TestWriteReadStringsLimits;
|
procedure TSpreadWriteReadStringTests.TestWriteReadStringsLimits;
|
||||||
const
|
|
||||||
MaxBytesBIFF8=32758; //limit for strings in this file format
|
|
||||||
var
|
var
|
||||||
MyWorksheet: TsWorksheet;
|
MyWorksheet: TsWorksheet;
|
||||||
MyWorkbook: TsWorkbook;
|
MyWorkbook: TsWorkbook;
|
||||||
@@ -219,11 +217,16 @@ var
|
|||||||
Row: Cardinal;
|
Row: Cardinal;
|
||||||
TempFile: string; //write xls/xml to this file and read back from it
|
TempFile: string; //write xls/xml to this file and read back from it
|
||||||
TestResult: boolean;
|
TestResult: boolean;
|
||||||
|
MaxBytesBIFF8: Integer;
|
||||||
|
limitations: TsSpreadsheetFormatLimitations;
|
||||||
begin
|
begin
|
||||||
|
InitBIFF8Limitations(limitations);
|
||||||
|
MaxBytesBIFF8 := limitations.MaxCharsInTextCell;
|
||||||
|
|
||||||
LocalNormStrings[0]:=StringOfChar('a',MaxBytesBIFF8-1);
|
LocalNormStrings[0]:=StringOfChar('a',MaxBytesBIFF8-1);
|
||||||
LocalNormStrings[1]:=StringOfChar('b',MaxBytesBIFF8);
|
LocalNormStrings[1]:=StringOfChar('b',MaxBytesBIFF8);
|
||||||
LocalNormStrings[2]:=StringOfChar('z',MaxBytesBiff8+1); //problems should occur here
|
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
|
{// Not needed: use workbook.writetofile with overwrite=true
|
||||||
if fileexists(TempFile) then
|
if fileexists(TempFile) then
|
||||||
|
Reference in New Issue
Block a user