diff --git a/components/fpspreadsheet/examples/excel8demo/excel8write.lpr b/components/fpspreadsheet/examples/excel8demo/excel8write.lpr index 2f11383c8..6d4fcc1cd 100644 --- a/components/fpspreadsheet/examples/excel8demo/excel8write.lpr +++ b/components/fpspreadsheet/examples/excel8demo/excel8write.lpr @@ -76,6 +76,11 @@ begin MyWorksheet.WriteBorderStyle(5, 5, cbSouth, lsDotted, scRed); 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 MyWorksheet.WriteBorders(5, 7, [cbNorth, cbEast, cbSouth, cbWest]); MyWorksheet.WriteBorderColor(5, 7, cbSouth, scBlack); diff --git a/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi b/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi index 3001b7542..5632700e5 100644 --- a/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi +++ b/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi @@ -97,7 +97,6 @@ - @@ -148,7 +147,6 @@ - @@ -267,8 +265,8 @@ - - + + @@ -292,18 +290,19 @@ - - + + + - - + + @@ -547,123 +546,127 @@ - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/fpspreadsheet/xlsbiff5.pas b/components/fpspreadsheet/xlsbiff5.pas index b18a103f1..aabab0b11 100755 --- a/components/fpspreadsheet/xlsbiff5.pas +++ b/components/fpspreadsheet/xlsbiff5.pas @@ -1266,6 +1266,7 @@ begin case RecordType of INT_EXCEL_ID_BLANK : ReadBlank(AStream); + INT_EXCEL_ID_MULBLANK: ReadMulBlank(AStream); INT_EXCEL_ID_NUMBER : ReadNumber(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. diff --git a/components/fpspreadsheet/xlsbiff8.pas b/components/fpspreadsheet/xlsbiff8.pas index c745bdea1..5367fbb3f 100755 --- a/components/fpspreadsheet/xlsbiff8.pas +++ b/components/fpspreadsheet/xlsbiff8.pas @@ -1510,6 +1510,7 @@ begin case RecordType of INT_EXCEL_ID_BLANK : ReadBlank(AStream); + INT_EXCEL_ID_MULBLANK: ReadMulBlank(AStream); INT_EXCEL_ID_NUMBER : ReadNumber(AStream); INT_EXCEL_ID_LABEL : ReadLabel(AStream); INT_EXCEL_ID_FORMULA : ReadFormula(AStream); diff --git a/components/fpspreadsheet/xlscommon.pas b/components/fpspreadsheet/xlscommon.pas index 74c074c9b..1f1aec913 100644 --- a/components/fpspreadsheet/xlscommon.pas +++ b/components/fpspreadsheet/xlscommon.pas @@ -48,6 +48,7 @@ const { 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_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_RSTRING = $00D6; // does not exist before BIFF5 INT_EXCEL_ID_BOF = $0809; // BIFF2:$0009, BIFF3:$0209; BIFF4:$0409 @@ -394,6 +395,8 @@ type procedure ReadDateMode(AStream: TStream); // Read FORMAT record (cell formatting) procedure ReadFormat(AStream: TStream); virtual; + // Read multiple blank cells + procedure ReadMulBlank(AStream: TStream); // Read floating point number procedure ReadNumber(AStream: TStream); override; // Read palette @@ -851,6 +854,31 @@ begin // to be overridden 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 // NOTE: This procedure is valid after BIFF 3. procedure TsSpreadBIFFReader.ReadNumber(AStream: TStream);