fpspreadsheet: Fix issue 0025133 "Cannot read xls file apparently BIFF5". Fix error message when writing a too-long cell text to BIFF5.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3653 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2014-10-14 08:29:28 +00:00
parent 05b3519063
commit 75fea05685
3 changed files with 29 additions and 16 deletions

View File

@ -109,6 +109,7 @@
<Unit15>
<Filename Value="errortests.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="errortests"/>
</Unit15>
<Unit16>
<Filename Value="virtualmodetests.pas"/>

View File

@ -228,21 +228,28 @@ var
Splitted: TStringList;
j: integer;
SIDChild: SID;
function FindSiblingWithName(const AName: WideString; const AStartSibling: integer): SID;
var
n, ab: WideString;
begin
if (FDirectory[AStartSibling]._ab=AName) and (FDirectory[AStartSibling]._mse<>BYTE(STGTY_INVALID)) then begin
n := UpperCase(AName);
ab := UpperCase(FDirectory[AStartSibling]._ab);
if (n = ab) and (FDirectory[AStartSibling]._mse <> BYTE(STGTY_INVALID)) then
begin
Result:=FDirectory[AStartSibling]._sidChild;
end else begin
end else
begin
Result:=WINCOMPOUND_NOSID;
if FDirectory[AStartSibling]._sidLeftSib<>WINCOMPOUND_NOSID then begin
if FDirectory[AStartSibling]._sidLeftSib<>WINCOMPOUND_NOSID then
Result:=FindSiblingWithName(AName,FDirectory[AStartSibling]._sidLeftSib);
end;
if Result<>WINCOMPOUND_NOSID then exit;
if FDirectory[AStartSibling]._sidRightSib<>WINCOMPOUND_NOSID then begin
if Result<>WINCOMPOUND_NOSID then
exit;
if FDirectory[AStartSibling]._sidRightSib<>WINCOMPOUND_NOSID then
Result:=FindSiblingWithName(AName,FDirectory[AStartSibling]._sidRightSib);
end;
end;
end;
begin
Splitted:=TStringList.Create;
SplitPath(APath,Splitted);
@ -265,21 +272,26 @@ var
Splitted: TStringList;
j: integer;
SIDChild: SID;
function FindSiblingWithName(const AName: WideString; const AStartSibling: integer): SID;
var
n, ab: WideString;
begin
if (FDirectory[AStartSibling]._ab=AName) and (FDirectory[AStartSibling]._mse<>BYTE(STGTY_INVALID)) then begin
Result:=AStartSibling;
end else begin
n := UpperCase(AName);
ab := UpperCase(FDirectory[AStartSibling]._ab);
if (n = ab) and (FDirectory[AStartSibling]._mse <> BYTE(STGTY_INVALID)) then
Result := AStartSibling
else begin
Result:=WINCOMPOUND_NOSID;
if FDirectory[AStartSibling]._sidLeftSib<>WINCOMPOUND_NOSID then begin
if FDirectory[AStartSibling]._sidLeftSib<>WINCOMPOUND_NOSID then
Result:=FindSiblingWithName(AName,FDirectory[AStartSibling]._sidLeftSib);
end;
if Result<>WINCOMPOUND_NOSID then exit;
if FDirectory[AStartSibling]._sidRightSib<>WINCOMPOUND_NOSID then begin
if Result<>WINCOMPOUND_NOSID then
exit;
if FDirectory[AStartSibling]._sidRightSib<>WINCOMPOUND_NOSID then
Result:=FindSiblingWithName(AName,FDirectory[AStartSibling]._sidRightSib);
end;
end;
end;
begin
Splitted:=TStringList.Create;
SplitPath(APath,Splitted);

View File

@ -785,7 +785,7 @@ begin
// Rather than lose data when reading it, let the application programmer deal
// with the problem or purposefully ignore it.
AnsiValue := Copy(AnsiValue, 1, MAXBYTES);
Workbook.AddErrorMsg(rsInvalidCharacterInCell, [
Workbook.AddErrorMsg(rsTruncateTooLongCellText, [
MAXBYTES, GetCellString(ARow, ACol)
]);
end;