You've already forked lazarus-ccr
fpspreadsheet: Add reading support for MULBLANK records (BIFF5 and BIFF8)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3034 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -76,6 +76,11 @@ begin
|
|||||||
MyWorksheet.WriteBorderStyle(5, 5, cbSouth, lsDotted, scRed);
|
MyWorksheet.WriteBorderStyle(5, 5, cbSouth, lsDotted, scRed);
|
||||||
MyWorksheet.WriteBorderLineStyle(5, 5, cbNorth, lsThick);
|
MyWorksheet.WriteBorderLineStyle(5, 5, cbNorth, lsThick);
|
||||||
|
|
||||||
|
// F7, top border only, but different color
|
||||||
|
MyWorksheet.WriteBorderColor(6, 5, cbNorth, scGreen);
|
||||||
|
MyWorksheet.WriteUTF8Text(6, 5, 'top border green or red?');
|
||||||
|
// Excel shows it to be red --> the upper border wins
|
||||||
|
|
||||||
// H6 empty cell, all medium borders
|
// H6 empty cell, all medium borders
|
||||||
MyWorksheet.WriteBorders(5, 7, [cbNorth, cbEast, cbSouth, cbWest]);
|
MyWorksheet.WriteBorders(5, 7, [cbNorth, cbEast, cbSouth, cbWest]);
|
||||||
MyWorksheet.WriteBorderColor(5, 7, cbSouth, scBlack);
|
MyWorksheet.WriteBorderColor(5, 7, cbSouth, scBlack);
|
||||||
|
@ -97,7 +97,6 @@
|
|||||||
<RunParams>
|
<RunParams>
|
||||||
<local>
|
<local>
|
||||||
<FormatVersion Value="1"/>
|
<FormatVersion Value="1"/>
|
||||||
<CommandLineParams Value=""D:\Prog_Lazarus\BIFF Explorer\sample data\Kommentar-ColWidth.xls""/>
|
|
||||||
</local>
|
</local>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages Count="2">
|
<RequiredPackages Count="2">
|
||||||
@ -148,7 +147,6 @@
|
|||||||
<Unit3>
|
<Unit3>
|
||||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||||
<UnitName Value="fpspreadsheetgrid"/>
|
<UnitName Value="fpspreadsheetgrid"/>
|
||||||
<IsVisibleTab Value="True"/>
|
|
||||||
<EditorIndex Value="2"/>
|
<EditorIndex Value="2"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1007"/>
|
<TopLine Value="1007"/>
|
||||||
@ -267,8 +265,8 @@
|
|||||||
<UnitName Value="xlsbiff8"/>
|
<UnitName Value="xlsbiff8"/>
|
||||||
<EditorIndex Value="6"/>
|
<EditorIndex Value="6"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1658"/>
|
<TopLine Value="1493"/>
|
||||||
<CursorPos X="1" Y="1677"/>
|
<CursorPos X="1" Y="1514"/>
|
||||||
<UsageCount Value="60"/>
|
<UsageCount Value="60"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit17>
|
</Unit17>
|
||||||
@ -292,18 +290,19 @@
|
|||||||
<UnitName Value="xlscommon"/>
|
<UnitName Value="xlscommon"/>
|
||||||
<EditorIndex Value="5"/>
|
<EditorIndex Value="5"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1269"/>
|
<TopLine Value="20"/>
|
||||||
<CursorPos X="1" Y="1286"/>
|
<CursorPos X="3" Y="51"/>
|
||||||
<UsageCount Value="56"/>
|
<UsageCount Value="56"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit20>
|
</Unit20>
|
||||||
<Unit21>
|
<Unit21>
|
||||||
<Filename Value="..\..\xlsbiff5.pas"/>
|
<Filename Value="..\..\xlsbiff5.pas"/>
|
||||||
<UnitName Value="xlsbiff5"/>
|
<UnitName Value="xlsbiff5"/>
|
||||||
|
<IsVisibleTab Value="True"/>
|
||||||
<EditorIndex Value="7"/>
|
<EditorIndex Value="7"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="1319"/>
|
<TopLine Value="1250"/>
|
||||||
<CursorPos X="3" Y="1325"/>
|
<CursorPos X="60" Y="1273"/>
|
||||||
<UsageCount Value="43"/>
|
<UsageCount Value="43"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit21>
|
</Unit21>
|
||||||
@ -547,123 +546,127 @@
|
|||||||
<UsageCount Value="11"/>
|
<UsageCount Value="11"/>
|
||||||
</Unit52>
|
</Unit52>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="29" HistoryIndex="28">
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||||
<Caret Line="1885" Column="1" TopLine="1865"/>
|
<Caret Line="1653" Column="1" TopLine="1629"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||||
<Caret Line="1886" Column="1" TopLine="1865"/>
|
<Caret Line="1654" Column="1" TopLine="1629"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||||
<Caret Line="1887" Column="1" TopLine="1865"/>
|
<Caret Line="1666" Column="1" TopLine="1634"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||||
<Caret Line="1648" Column="1" TopLine="1629"/>
|
<Caret Line="1905" Column="1" TopLine="1886"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||||
<Caret Line="1649" Column="1" TopLine="1629"/>
|
<Caret Line="1677" Column="1" TopLine="1658"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||||
<Caret Line="1650" Column="1" TopLine="1629"/>
|
<Caret Line="1905" Column="1" TopLine="1886"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||||
<Caret Line="1651" Column="1" TopLine="1629"/>
|
<Caret Line="1906" Column="1" TopLine="1886"/>
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||||
<Caret Line="1653" Column="1" TopLine="1629"/>
|
<Caret Line="1908" Column="1" TopLine="1886"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||||
<Caret Line="1654" Column="1" TopLine="1629"/>
|
<Caret Line="1912" Column="1" TopLine="1886"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||||
<Caret Line="1666" Column="1" TopLine="1634"/>
|
<Caret Line="1913" Column="1" TopLine="1886"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
<Filename Value="mainform.pas"/>
|
||||||
<Caret Line="1905" Column="1" TopLine="1886"/>
|
<Caret Line="404" Column="25" TopLine="404"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
<Filename Value="mainform.pas"/>
|
||||||
<Caret Line="1677" Column="1" TopLine="1658"/>
|
<Caret Line="286" Column="3" TopLine="282"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
<Filename Value="mainform.pas"/>
|
||||||
<Caret Line="1905" Column="1" TopLine="1886"/>
|
<Caret Line="364" Column="64" TopLine="356"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||||
<Caret Line="1906" Column="1" TopLine="1886"/>
|
<Caret Line="1913" Column="1" TopLine="1886"/>
|
||||||
</Position14>
|
</Position14>
|
||||||
<Position15>
|
<Position15>
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||||
<Caret Line="1908" Column="1" TopLine="1886"/>
|
<Caret Line="1677" Column="1" TopLine="1658"/>
|
||||||
</Position15>
|
</Position15>
|
||||||
<Position16>
|
<Position16>
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||||
<Caret Line="1912" Column="1" TopLine="1886"/>
|
<Caret Line="1913" Column="1" TopLine="1886"/>
|
||||||
</Position16>
|
</Position16>
|
||||||
<Position17>
|
<Position17>
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
|
||||||
<Caret Line="1913" Column="1" TopLine="1886"/>
|
|
||||||
</Position17>
|
|
||||||
<Position18>
|
|
||||||
<Filename Value="mainform.pas"/>
|
|
||||||
<Caret Line="404" Column="25" TopLine="404"/>
|
|
||||||
</Position18>
|
|
||||||
<Position19>
|
|
||||||
<Filename Value="mainform.pas"/>
|
|
||||||
<Caret Line="286" Column="3" TopLine="282"/>
|
|
||||||
</Position19>
|
|
||||||
<Position20>
|
|
||||||
<Filename Value="mainform.pas"/>
|
|
||||||
<Caret Line="364" Column="64" TopLine="356"/>
|
|
||||||
</Position20>
|
|
||||||
<Position21>
|
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
|
||||||
<Caret Line="1913" Column="1" TopLine="1886"/>
|
|
||||||
</Position21>
|
|
||||||
<Position22>
|
|
||||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
|
||||||
<Caret Line="1677" Column="1" TopLine="1658"/>
|
|
||||||
</Position22>
|
|
||||||
<Position23>
|
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
|
||||||
<Caret Line="1913" Column="1" TopLine="1886"/>
|
|
||||||
</Position23>
|
|
||||||
<Position24>
|
|
||||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||||
<Caret Line="382" Column="62" TopLine="362"/>
|
<Caret Line="382" Column="62" TopLine="362"/>
|
||||||
</Position24>
|
</Position17>
|
||||||
<Position25>
|
<Position18>
|
||||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||||
<Caret Line="1104" Column="52" TopLine="1073"/>
|
<Caret Line="1104" Column="52" TopLine="1073"/>
|
||||||
</Position25>
|
</Position18>
|
||||||
<Position26>
|
<Position19>
|
||||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||||
<Caret Line="1379" Column="58" TopLine="1347"/>
|
<Caret Line="1379" Column="58" TopLine="1347"/>
|
||||||
</Position26>
|
</Position19>
|
||||||
<Position27>
|
<Position20>
|
||||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||||
<Caret Line="1384" Column="56" TopLine="1353"/>
|
<Caret Line="1384" Column="56" TopLine="1353"/>
|
||||||
</Position27>
|
</Position20>
|
||||||
<Position28>
|
<Position21>
|
||||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||||
<Caret Line="1395" Column="54" TopLine="1364"/>
|
<Caret Line="1395" Column="54" TopLine="1364"/>
|
||||||
</Position28>
|
</Position21>
|
||||||
<Position29>
|
<Position22>
|
||||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||||
<Caret Line="1401" Column="53" TopLine="1370"/>
|
<Caret Line="1401" Column="53" TopLine="1370"/>
|
||||||
|
</Position22>
|
||||||
|
<Position23>
|
||||||
|
<Filename Value="..\..\xlscommon.pas"/>
|
||||||
|
<Caret Line="1269" Column="46" TopLine="1269"/>
|
||||||
|
</Position23>
|
||||||
|
<Position24>
|
||||||
|
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||||
|
<Caret Line="1659" Column="53" TopLine="1659"/>
|
||||||
|
</Position24>
|
||||||
|
<Position25>
|
||||||
|
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||||
|
<Caret Line="1" Column="1" TopLine="1"/>
|
||||||
|
</Position25>
|
||||||
|
<Position26>
|
||||||
|
<Filename Value="..\..\xlsbiff5.pas"/>
|
||||||
|
<Caret Line="1319" Column="3" TopLine="1319"/>
|
||||||
|
</Position26>
|
||||||
|
<Position27>
|
||||||
|
<Filename Value="..\..\xlsbiff5.pas"/>
|
||||||
|
<Caret Line="1" Column="1" TopLine="1"/>
|
||||||
|
</Position27>
|
||||||
|
<Position28>
|
||||||
|
<Filename Value="..\..\xlscommon.pas"/>
|
||||||
|
<Caret Line="852" Column="22" TopLine="852"/>
|
||||||
|
</Position28>
|
||||||
|
<Position29>
|
||||||
|
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||||
|
<Caret Line="1694" Column="3" TopLine="1690"/>
|
||||||
</Position29>
|
</Position29>
|
||||||
|
<Position30>
|
||||||
|
<Filename Value="..\..\xlsbiff5.pas"/>
|
||||||
|
<Caret Line="1610" Column="3" TopLine="1606"/>
|
||||||
|
</Position30>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -1266,6 +1266,7 @@ begin
|
|||||||
case RecordType of
|
case RecordType of
|
||||||
|
|
||||||
INT_EXCEL_ID_BLANK : ReadBlank(AStream);
|
INT_EXCEL_ID_BLANK : ReadBlank(AStream);
|
||||||
|
INT_EXCEL_ID_MULBLANK: ReadMulBlank(AStream);
|
||||||
INT_EXCEL_ID_NUMBER : ReadNumber(AStream);
|
INT_EXCEL_ID_NUMBER : ReadNumber(AStream);
|
||||||
INT_EXCEL_ID_LABEL : ReadLabel(AStream);
|
INT_EXCEL_ID_LABEL : ReadLabel(AStream);
|
||||||
INT_EXCEL_ID_RSTRING : ReadRichString(AStream); //(RSTRING) This record stores a formatted text cell (Rich-Text). In BIFF8 it is usually replaced by the LABELSST record. Excel still uses this record, if it copies formatted text cells to the clipboard.
|
INT_EXCEL_ID_RSTRING : ReadRichString(AStream); //(RSTRING) This record stores a formatted text cell (Rich-Text). In BIFF8 it is usually replaced by the LABELSST record. Excel still uses this record, if it copies formatted text cells to the clipboard.
|
||||||
|
@ -1510,6 +1510,7 @@ begin
|
|||||||
case RecordType of
|
case RecordType of
|
||||||
|
|
||||||
INT_EXCEL_ID_BLANK : ReadBlank(AStream);
|
INT_EXCEL_ID_BLANK : ReadBlank(AStream);
|
||||||
|
INT_EXCEL_ID_MULBLANK: ReadMulBlank(AStream);
|
||||||
INT_EXCEL_ID_NUMBER : ReadNumber(AStream);
|
INT_EXCEL_ID_NUMBER : ReadNumber(AStream);
|
||||||
INT_EXCEL_ID_LABEL : ReadLabel(AStream);
|
INT_EXCEL_ID_LABEL : ReadLabel(AStream);
|
||||||
INT_EXCEL_ID_FORMULA : ReadFormula(AStream);
|
INT_EXCEL_ID_FORMULA : ReadFormula(AStream);
|
||||||
|
@ -48,6 +48,7 @@ const
|
|||||||
{ RECORD IDs which did not change across versions 5-8 }
|
{ RECORD IDs which did not change across versions 5-8 }
|
||||||
INT_EXCEL_ID_BOUNDSHEET = $0085; // Renamed to SHEET in the latest OpenOffice docs, does not exist before 5
|
INT_EXCEL_ID_BOUNDSHEET = $0085; // Renamed to SHEET in the latest OpenOffice docs, does not exist before 5
|
||||||
INT_EXCEL_ID_MULRK = $00BD; // does not exist before BIFF5
|
INT_EXCEL_ID_MULRK = $00BD; // does not exist before BIFF5
|
||||||
|
INT_EXCEL_ID_MULBLANK = $00BE; // does not exist before BIFF5
|
||||||
INT_EXCEL_ID_XF = $00E0; // BIFF2:$0043, BIFF3:$0243, BIFF4:$0443
|
INT_EXCEL_ID_XF = $00E0; // BIFF2:$0043, BIFF3:$0243, BIFF4:$0443
|
||||||
INT_EXCEL_ID_RSTRING = $00D6; // does not exist before BIFF5
|
INT_EXCEL_ID_RSTRING = $00D6; // does not exist before BIFF5
|
||||||
INT_EXCEL_ID_BOF = $0809; // BIFF2:$0009, BIFF3:$0209; BIFF4:$0409
|
INT_EXCEL_ID_BOF = $0809; // BIFF2:$0009, BIFF3:$0209; BIFF4:$0409
|
||||||
@ -394,6 +395,8 @@ type
|
|||||||
procedure ReadDateMode(AStream: TStream);
|
procedure ReadDateMode(AStream: TStream);
|
||||||
// Read FORMAT record (cell formatting)
|
// Read FORMAT record (cell formatting)
|
||||||
procedure ReadFormat(AStream: TStream); virtual;
|
procedure ReadFormat(AStream: TStream); virtual;
|
||||||
|
// Read multiple blank cells
|
||||||
|
procedure ReadMulBlank(AStream: TStream);
|
||||||
// Read floating point number
|
// Read floating point number
|
||||||
procedure ReadNumber(AStream: TStream); override;
|
procedure ReadNumber(AStream: TStream); override;
|
||||||
// Read palette
|
// Read palette
|
||||||
@ -851,6 +854,31 @@ begin
|
|||||||
// to be overridden
|
// to be overridden
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Reads multiple blank cell records
|
||||||
|
procedure TsSpreadBIFFReader.ReadMulBlank(AStream: TStream);
|
||||||
|
var
|
||||||
|
ARow, fc, lc, XF: Word;
|
||||||
|
pending: integer;
|
||||||
|
begin
|
||||||
|
ARow := WordLEtoN(AStream.ReadWord);
|
||||||
|
fc := WordLEtoN(AStream.ReadWord);
|
||||||
|
pending := RecordSize - Sizeof(fc) - Sizeof(ARow);
|
||||||
|
while pending > SizeOf(XF) do begin
|
||||||
|
XF := AStream.ReadWord; //XF record (not used)
|
||||||
|
FWorksheet.WriteBlank(ARow, fc);
|
||||||
|
ApplyCellFormatting(ARow, fc, XF);
|
||||||
|
inc(fc);
|
||||||
|
dec(pending, SizeOf(XF));
|
||||||
|
end;
|
||||||
|
if pending = 2 then begin
|
||||||
|
//Just for completeness
|
||||||
|
lc := WordLEtoN(AStream.ReadWord);
|
||||||
|
if lc + 1 <> fc then begin
|
||||||
|
//Stream error... bypass by now
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
// Reads a floating point number and seeks the number format
|
// Reads a floating point number and seeks the number format
|
||||||
// NOTE: This procedure is valid after BIFF 3.
|
// NOTE: This procedure is valid after BIFF 3.
|
||||||
procedure TsSpreadBIFFReader.ReadNumber(AStream: TStream);
|
procedure TsSpreadBIFFReader.ReadNumber(AStream: TStream);
|
||||||
|
Reference in New Issue
Block a user