You've already forked lazarus-ccr
Handle ID_CONTINUE inside some tags.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2757 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -1385,6 +1385,9 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
j: SizeUInt;
|
j: SizeUInt;
|
||||||
lLen: SizeInt;
|
lLen: SizeInt;
|
||||||
|
RecordType: WORD;
|
||||||
|
RecordSize: WORD;
|
||||||
|
C: char;
|
||||||
begin
|
begin
|
||||||
StringFlags:=AStream.ReadByte;
|
StringFlags:=AStream.ReadByte;
|
||||||
Dec(PendingRecordSize);
|
Dec(PendingRecordSize);
|
||||||
@@ -1413,21 +1416,42 @@ begin
|
|||||||
end else begin
|
end else begin
|
||||||
//String is 1 byte per char, this is UTF-16 with the high byte ommited because it is zero
|
//String is 1 byte per char, this is UTF-16 with the high byte ommited because it is zero
|
||||||
//so decompress and then convert
|
//so decompress and then convert
|
||||||
if ALength > PendingRecordSize then lLen := PendingRecordSize
|
lLen:=ALength;
|
||||||
else lLen := ALength;
|
|
||||||
|
|
||||||
SetLength(DecomprStrValue, lLen);
|
SetLength(DecomprStrValue, lLen);
|
||||||
for i := 1 to lLen do
|
for i := 1 to lLen do
|
||||||
begin
|
begin
|
||||||
DecomprStrValue[i] := WideChar(AStream.ReadByte());
|
C:=WideChar(AStream.ReadByte());
|
||||||
|
DecomprStrValue[i] := C;
|
||||||
|
Dec(PendingRecordSize);
|
||||||
|
if (PendingRecordSize<=0) and (i<lLen) then begin
|
||||||
|
//A CONTINUE may happend here
|
||||||
|
RecordType := WordLEToN(AStream.ReadWord);
|
||||||
|
RecordSize := WordLEToN(AStream.ReadWord);
|
||||||
|
if RecordType<>INT_EXCEL_ID_CONTINUE then begin
|
||||||
|
Raise Exception.Create('[TsSpreadBIFF8Reader.ReadWideString] Expected CONTINUE record not found.');
|
||||||
|
end else begin
|
||||||
|
PendingRecordSize:=RecordSize;
|
||||||
|
DecomprStrValue:=copy(DecomprStrValue,1,i)+ReadWideString(AStream,ALength-i);
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
Dec(PendingRecordSize, lLen);
|
|
||||||
|
|
||||||
Result := DecomprStrValue;
|
Result := DecomprStrValue;
|
||||||
end;
|
end;
|
||||||
if StringFlags and 8 = 8 then begin
|
if StringFlags and 8 = 8 then begin
|
||||||
//Rich string (This only happend in BIFF8)
|
//Rich string (This only happend in BIFF8)
|
||||||
for j := 1 to RunsCounter do begin
|
for j := 1 to RunsCounter do begin
|
||||||
|
if (PendingRecordSize<=0) then begin
|
||||||
|
//A CONTINUE may happend here
|
||||||
|
RecordType := WordLEToN(AStream.ReadWord);
|
||||||
|
RecordSize := WordLEToN(AStream.ReadWord);
|
||||||
|
if RecordType<>INT_EXCEL_ID_CONTINUE then begin
|
||||||
|
Raise Exception.Create('[TsSpreadBIFF8Reader.ReadWideString] Expected CONTINUE record not found.');
|
||||||
|
end else begin
|
||||||
|
PendingRecordSize:=RecordSize;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
AStream.ReadWord;
|
AStream.ReadWord;
|
||||||
AStream.ReadWord;
|
AStream.ReadWord;
|
||||||
dec(PendingRecordSize,2*2);
|
dec(PendingRecordSize,2*2);
|
||||||
|
Reference in New Issue
Block a user