diff --git a/components/fpspreadsheet/examples/excel2demo/excel2write.lpi b/components/fpspreadsheet/examples/excel2demo/excel2write.lpi index 5d80f62c2..b796af7d9 100644 --- a/components/fpspreadsheet/examples/excel2demo/excel2write.lpi +++ b/components/fpspreadsheet/examples/excel2demo/excel2write.lpi @@ -54,10 +54,5 @@ - - - - - diff --git a/components/fpspreadsheet/examples/excel8demo/excel8read.lpi b/components/fpspreadsheet/examples/excel8demo/excel8read.lpi index 0664f45bf..2d2b59dde 100644 --- a/components/fpspreadsheet/examples/excel8demo/excel8read.lpi +++ b/components/fpspreadsheet/examples/excel8demo/excel8read.lpi @@ -52,10 +52,5 @@ - - - - - diff --git a/components/fpspreadsheet/examples/excel8demo/excel8write.lpi b/components/fpspreadsheet/examples/excel8demo/excel8write.lpi index dc6cee5f3..733107628 100644 --- a/components/fpspreadsheet/examples/excel8demo/excel8write.lpi +++ b/components/fpspreadsheet/examples/excel8demo/excel8write.lpi @@ -41,7 +41,6 @@ - diff --git a/components/fpspreadsheet/examples/fpsSpeedTest/fpsspeedtest.lpi b/components/fpspreadsheet/examples/fpsSpeedTest/fpsspeedtest.lpi index 898b75340..05d314092 100644 --- a/components/fpspreadsheet/examples/fpsSpeedTest/fpsspeedtest.lpi +++ b/components/fpspreadsheet/examples/fpsSpeedTest/fpsspeedtest.lpi @@ -28,21 +28,19 @@ - + - + - - - - + + diff --git a/components/fpspreadsheet/examples/fpschart/fpschart.lpi b/components/fpspreadsheet/examples/fpschart/fpschart.lpi index 94c8fef93..543c006b6 100644 --- a/components/fpspreadsheet/examples/fpschart/fpschart.lpi +++ b/components/fpspreadsheet/examples/fpschart/fpschart.lpi @@ -66,9 +66,6 @@ - - - diff --git a/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi b/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi index ed788ad24..ea7c3493a 100644 --- a/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi +++ b/components/fpspreadsheet/examples/fpsgrid/fpsgrid.lpi @@ -48,9 +48,6 @@ - - - @@ -82,9 +79,6 @@ - - - @@ -134,18 +128,12 @@ - - - - - - diff --git a/components/fpspreadsheet/examples/fpsgrid/mainform.lfm b/components/fpspreadsheet/examples/fpsgrid/mainform.lfm index f4b683368..4d31079f3 100644 --- a/components/fpspreadsheet/examples/fpsgrid/mainform.lfm +++ b/components/fpspreadsheet/examples/fpsgrid/mainform.lfm @@ -63,7 +63,7 @@ object Form1: TForm1 TabOrder = 1 TitleStyle = tsNative ColWidths = ( - 56 + 42 64 64 64 @@ -104,19 +104,19 @@ object Form1: TForm1 TabOrder = 2 object Label1: TLabel Left = 8 - Height = 20 + Height = 15 Top = 9 - Width = 46 + Width = 37 Caption = 'Sheets:' ParentColor = False end object SheetsCombo: TComboBox Left = 72 - Height = 28 + Height = 23 Top = 4 Width = 808 Anchors = [akTop, akLeft, akRight] - ItemHeight = 20 + ItemHeight = 15 ItemIndex = 0 Items.Strings = ( 'Sheet 1' diff --git a/components/fpspreadsheet/examples/fpsgrid/mainform.pas b/components/fpspreadsheet/examples/fpsgrid/mainform.pas index 871ab4c60..9397f5daa 100644 --- a/components/fpspreadsheet/examples/fpsgrid/mainform.pas +++ b/components/fpspreadsheet/examples/fpsgrid/mainform.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, - StdCtrls, Menus, ExtCtrls, ComCtrls, ActnList, Spin, Grids, ColorBox, Buttons, + StdCtrls, Menus, ExtCtrls, ActnList, Spin, Buttons, ButtonPanel, fpspreadsheetgrid, fpspreadsheet, fpsallformats; type @@ -31,16 +31,6 @@ type private { private declarations } procedure LoadFile(const AFileName: String); - procedure SetupBackgroundColorBox; - procedure UpdateBackgroundColorIndex; - procedure UpdateFontNameIndex; - procedure UpdateFontSizeIndex; - procedure UpdateFontStyleActions; - procedure UpdateHorAlignmentActions; - procedure UpdateNumFormatActions; - procedure UpdateTextRotationActions; - procedure UpdateVertAlignmentActions; - procedure UpdateWordwraps; public { public declarations } end; @@ -60,7 +50,6 @@ procedure TForm1.BtnNewClick(Sender: TObject); var dlg: TForm; edCols, edRows: TSpinEdit; - x: Integer; begin dlg := TForm.Create(nil); try @@ -73,7 +62,7 @@ begin Parent := dlg; Left := dlg.ClientWidth - Width - 24; Top := 16; - Value := WorksheetGrid.ColCount - ord(WorksheetGrid.DisplayFixedColRow); + Value := WorksheetGrid.ColCount - ord(WorksheetGrid.ShowHeaders); end; with TLabel.Create(dlg) do begin Parent := dlg; @@ -87,7 +76,7 @@ begin Parent := dlg; Left := edCols.Left; Top := edCols.Top + edCols.Height + 8; - Value := WorksheetGrid.RowCount - ord(WorksheetGrid.DisplayFixedColRow); + Value := WorksheetGrid.RowCount - ord(WorksheetGrid.ShowHeaders); end; with TLabel.Create(dlg) do begin Parent := dlg; @@ -142,8 +131,6 @@ end; // Loads first worksheet from file into grid procedure TForm1.LoadFile(const AFileName: String); -var - i: Integer; begin // Load file Screen.Cursor := crHourglass; @@ -166,55 +153,6 @@ begin end; end; -procedure TForm1.SetupBackgroundColorBox; -begin - -end; - -procedure TForm1.UpdateBackgroundColorIndex; -begin - -end; - -procedure TForm1.UpdateFontNameIndex; -begin - -end; - -procedure TForm1.UpdateFontSizeIndex; -begin - -end; - -procedure TForm1.UpdateFontStyleActions; -begin - -end; - -procedure TForm1.UpdateHorAlignmentActions; -begin - -end; - -procedure TForm1.UpdateNumFormatActions; -begin - -end; - -procedure TForm1.UpdateTextRotationActions; -begin - -end; - -procedure TForm1.UpdateVertAlignmentActions; -begin - -end; - -procedure TForm1.UpdateWordwraps; -begin - -end; initialization {$I mainform.lrs} diff --git a/components/fpspreadsheet/examples/ooxmldemo/ooxmlwrite.lpi b/components/fpspreadsheet/examples/ooxmldemo/ooxmlwrite.lpi index b6001cc16..484d5ec88 100644 --- a/components/fpspreadsheet/examples/ooxmldemo/ooxmlwrite.lpi +++ b/components/fpspreadsheet/examples/ooxmldemo/ooxmlwrite.lpi @@ -54,10 +54,5 @@ - - - - - diff --git a/components/fpspreadsheet/examples/other/test_formula_func.lpi b/components/fpspreadsheet/examples/other/test_formula_func.lpi index cf20902e9..b78f60f22 100644 --- a/components/fpspreadsheet/examples/other/test_formula_func.lpi +++ b/components/fpspreadsheet/examples/other/test_formula_func.lpi @@ -64,12 +64,10 @@ - - @@ -82,11 +80,6 @@ - - - - - diff --git a/components/fpspreadsheet/examples/other/test_recursive_calc.lpi b/components/fpspreadsheet/examples/other/test_recursive_calc.lpi index 267889f24..d17f5cef3 100644 --- a/components/fpspreadsheet/examples/other/test_recursive_calc.lpi +++ b/components/fpspreadsheet/examples/other/test_recursive_calc.lpi @@ -77,9 +77,6 @@ - - - diff --git a/components/fpspreadsheet/examples/other/test_virtualmode.lpi b/components/fpspreadsheet/examples/other/test_virtualmode.lpi index f88cb3f45..506681666 100644 --- a/components/fpspreadsheet/examples/other/test_virtualmode.lpi +++ b/components/fpspreadsheet/examples/other/test_virtualmode.lpi @@ -77,7 +77,6 @@ - diff --git a/components/fpspreadsheet/examples/spready/mainform.lfm b/components/fpspreadsheet/examples/spready/mainform.lfm index e316b054f..3eb72ae8b 100644 --- a/components/fpspreadsheet/examples/spready/mainform.lfm +++ b/components/fpspreadsheet/examples/spready/mainform.lfm @@ -4,7 +4,7 @@ object Form1: TForm1 Top = 248 Width = 884 Caption = 'spready' - ClientHeight = 624 + ClientHeight = 629 ClientWidth = 884 Menu = MainMenu OnActivate = FormActivate @@ -14,7 +14,7 @@ object Form1: TForm1 object Panel1: TPanel Left = 0 Height = 85 - Top = 539 + Top = 544 Width = 884 Align = alBottom BevelOuter = bvNone @@ -23,9 +23,9 @@ object Form1: TForm1 TabOrder = 0 object CbShowHeaders: TCheckBox Left = 8 - Height = 24 + Height = 19 Top = 8 - Width = 116 + Width = 93 Caption = 'Show headers' Checked = True OnClick = CbShowHeadersClick @@ -34,9 +34,9 @@ object Form1: TForm1 end object CbShowGridLines: TCheckBox Left = 8 - Height = 24 + Height = 19 Top = 32 - Width = 125 + Width = 100 Caption = 'Show grid lines' Checked = True OnClick = CbShowGridLinesClick @@ -45,7 +45,7 @@ object Form1: TForm1 end object EdFrozenCols: TSpinEdit Left = 389 - Height = 28 + Height = 23 Top = 8 Width = 52 OnChange = EdFrozenColsChange @@ -53,7 +53,7 @@ object Form1: TForm1 end object EdFrozenRows: TSpinEdit Left = 389 - Height = 28 + Height = 23 Top = 39 Width = 52 OnChange = EdFrozenRowsChange @@ -61,37 +61,37 @@ object Form1: TForm1 end object Label1: TLabel Left = 304 - Height = 20 + Height = 15 Top = 13 - Width = 77 + Width = 62 Caption = 'Frozen cols:' FocusControl = EdFrozenCols ParentColor = False end object Label2: TLabel Left = 304 - Height = 20 + Height = 15 Top = 40 - Width = 82 + Width = 66 Caption = 'Frozen rows:' FocusControl = EdFrozenRows ParentColor = False end object CbReadFormulas: TCheckBox Left = 8 - Height = 24 + Height = 19 Top = 56 - Width = 120 + Width = 96 Caption = 'Read formulas' OnChange = CbReadFormulasChange TabOrder = 4 end object CbHeaderStyle: TComboBox Left = 152 - Height = 28 + Height = 23 Top = 8 Width = 116 - ItemHeight = 20 + ItemHeight = 15 ItemIndex = 2 Items.Strings = ( 'Lazarus' @@ -106,7 +106,7 @@ object Form1: TForm1 end object PageControl1: TPageControl Left = 0 - Height = 460 + Height = 465 Top = 79 Width = 884 ActivePage = TabSheet1 @@ -116,11 +116,11 @@ object Form1: TForm1 OnChange = PageControl1Change object TabSheet1: TTabSheet Caption = 'Sheet1' - ClientHeight = 427 + ClientHeight = 437 ClientWidth = 876 object WorksheetGrid: TsWorksheetGrid Left = 0 - Height = 427 + Height = 437 Top = 0 Width = 876 FrozenCols = 0 @@ -136,7 +136,7 @@ object Form1: TForm1 TitleStyle = tsNative OnSelection = WorksheetGridSelection ColWidths = ( - 56 + 42 64 64 64 @@ -244,19 +244,19 @@ object Form1: TForm1 end object FontComboBox: TComboBox Left = 52 - Height = 28 + Height = 23 Top = 2 Width = 127 - ItemHeight = 20 + ItemHeight = 15 OnSelect = FontComboBoxSelect TabOrder = 0 end object FontSizeComboBox: TComboBox Left = 179 - Height = 28 + Height = 23 Top = 2 Width = 48 - ItemHeight = 20 + ItemHeight = 15 Items.Strings = ( '8' '9' diff --git a/components/fpspreadsheet/examples/spready/spready.lpi b/components/fpspreadsheet/examples/spready/spready.lpi index fdee744dc..ea3cd5fa6 100644 --- a/components/fpspreadsheet/examples/spready/spready.lpi +++ b/components/fpspreadsheet/examples/spready/spready.lpi @@ -48,9 +48,6 @@ - - - @@ -82,9 +79,6 @@ - - - @@ -99,13 +93,16 @@ - + - + - + + + + @@ -134,18 +131,12 @@ - - - - - - diff --git a/components/fpspreadsheet/examples/spready/spready.lpr b/components/fpspreadsheet/examples/spready/spready.lpr index ab244e99b..e20dec961 100644 --- a/components/fpspreadsheet/examples/spready/spready.lpr +++ b/components/fpspreadsheet/examples/spready/spready.lpr @@ -4,7 +4,7 @@ program spready; uses Interfaces, // this includes the LCL widgetset - Forms, mainform, laz_fpspreadsheet_visual; + Forms, mainform, laz_fpspreadsheet_visual, laz_fpspreadsheet; {$R *.res} diff --git a/components/fpspreadsheet/examples/wikitabledemo/wikitableread.lpi b/components/fpspreadsheet/examples/wikitabledemo/wikitableread.lpi index 004b4f183..f129d363c 100644 --- a/components/fpspreadsheet/examples/wikitabledemo/wikitableread.lpi +++ b/components/fpspreadsheet/examples/wikitabledemo/wikitableread.lpi @@ -38,7 +38,6 @@ - @@ -53,13 +52,5 @@ - - - - - - - - diff --git a/components/fpspreadsheet/examples/wikitabledemo/wikitablewrite.lpi b/components/fpspreadsheet/examples/wikitabledemo/wikitablewrite.lpi index 15316260c..815f73380 100644 --- a/components/fpspreadsheet/examples/wikitabledemo/wikitablewrite.lpi +++ b/components/fpspreadsheet/examples/wikitabledemo/wikitablewrite.lpi @@ -54,10 +54,5 @@ - - - - - diff --git a/components/fpspreadsheet/fpsopendocument.pas b/components/fpspreadsheet/fpsopendocument.pas index 1636891d8..541e96787 100755 --- a/components/fpspreadsheet/fpsopendocument.pas +++ b/components/fpspreadsheet/fpsopendocument.pas @@ -3046,13 +3046,12 @@ procedure TsSpreadOpenDocWriter.WriteRowStyles(AStream: TStream); var i: Integer; rowstyle: TRowStyleData; - s: String; useOptRowH: String; begin if FRowStyleList.Count = 0 then begin AppendToStream(AStream, - '', - '', + '' + + '' + ''); exit; end; diff --git a/components/fpspreadsheet/laz_fpspreadsheet.lpk b/components/fpspreadsheet/laz_fpspreadsheet.lpk index 6125bc066..dbd66ea70 100644 --- a/components/fpspreadsheet/laz_fpspreadsheet.lpk +++ b/components/fpspreadsheet/laz_fpspreadsheet.lpk @@ -63,56 +63,56 @@ This package is all you need if you don't want graphical components (like grids - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/fpspreadsheet/laz_fpspreadsheet.pas b/components/fpspreadsheet/laz_fpspreadsheet.pas index f84eb279a..78de7261f 100644 --- a/components/fpspreadsheet/laz_fpspreadsheet.pas +++ b/components/fpspreadsheet/laz_fpspreadsheet.pas @@ -8,10 +8,10 @@ interface uses fpolestorage, fpsallformats, fpsopendocument, fpspreadsheet, xlsbiff2, - xlsbiff5, xlsbiff8, xlsxooxml, fpsutils, fpszipper, uvirtuallayer_types, - uvirtuallayer, uvirtuallayer_ole, uvirtuallayer_ole_helpers, - uvirtuallayer_ole_types, uvirtuallayer_stream, fpolebasic, xlscommon, - wikitable, fpsNumFormatParser, fpsfunc, fpsStreams; + xlsbiff5, xlsbiff8, xlsxooxml, fpsutils, fpsStreams, fpszipper, + uvirtuallayer_types, uvirtuallayer, uvirtuallayer_ole, + uvirtuallayer_ole_helpers, uvirtuallayer_ole_types, uvirtuallayer_stream, + fpolebasic, xlscommon, wikitable, fpsNumFormatParser, fpsfunc; implementation diff --git a/components/fpspreadsheet/xlsbiff2.pas b/components/fpspreadsheet/xlsbiff2.pas index c8788a8cd..873b083d8 100755 --- a/components/fpspreadsheet/xlsbiff2.pas +++ b/components/fpspreadsheet/xlsbiff2.pas @@ -167,6 +167,29 @@ const INT_EXCEL_CHART = $0020; INT_EXCEL_MACRO_SHEET = $0040; +type + TBIFF2LabelRecord = packed record + RecordID: Word; + RecordSize: Word; + Row: Word; + Col: Word; + Attrib1: Byte; + Attrib2: Byte; + Attrib3: Byte; + TextLen: Byte; + end; + + TBIFF2NumberRecord = packed record + RecordID: Word; + RecordSize: Word; + Row: Word; + Col: Word; + Attrib1: Byte; + Attrib2: Byte; + Attrib3: Byte; + Value: Double; + end; + { TsBIFF2NumFormatList } @@ -541,19 +564,23 @@ end; procedure TsSpreadBIFF2Reader.ReadLabel(AStream: TStream); var + rec: TBIFF2LabelRecord; L: Byte; ARow, ACol: Cardinal; XF: Word; - AValue: array[0..255] of Char; + AValue: ansistring; AStrValue: UTF8String; begin - { BIFF Record row/column/style } - ReadRowColXF(AStream, ARow, ACol, XF); + { Read entire record, starting at Row, except for string data } + AStream.ReadBuffer(rec.Row, SizeOf(TBIFF2LabelRecord) - 2*SizeOf(Word)); + ARow := WordLEToN(rec.Row); + ACol := WordLEToN(rec.Col); + XF := rec.Attrib1 and $3F; { String with 8-bit size } - L := AStream.ReadByte(); - AStream.ReadBuffer(AValue, L); - AValue[L] := #0; + L := rec.TextLen; + SetLength(AValue, L); + AStream.ReadBuffer(AValue[1], L); { Save the data } case WorkBookEncoding of @@ -575,6 +602,7 @@ end; procedure TsSpreadBIFF2Reader.ReadNumber(AStream: TStream); var + rec: TBIFF2NumberRecord; ARow, ACol: Cardinal; XF: Word; value: Double = 0.0; @@ -582,11 +610,12 @@ var nf: TsNumberFormat; nfs: String; begin - { BIFF Record row/column/style } - ReadRowColXF(AStream, ARow, ACol, XF); - - { IEE 754 floating-point value } - AStream.ReadBuffer(value, 8); + { Read entire record, starting at Row } + AStream.ReadBuffer(rec.Row, SizeOf(TBIFF2NumberRecord) - 2*SizeOf(Word)); + ARow := WordLEToN(rec.Row); + ACol := WordLEToN(rec.Col); + XF := rec.Attrib1 and $3F; + value := rec.Value; {Find out what cell type, set content type and value} ExtractNumberFormat(XF, nf, nfs); @@ -1560,24 +1589,13 @@ end; *******************************************************************} procedure TsSpreadBIFF2Writer.WriteLabel(AStream: TStream; const ARow, ACol: Cardinal; const AValue: string; ACell: PCell); -type - TLabelRecord = packed record - RecordID: Word; - RecordSize: Word; - Row: Word; - Col: Word; - Attrib1: Byte; - Attrib2: Byte; - Attrib3: Byte; - TextLen: Byte; - end; const MAXBYTES = 255; //limit for this format var L: Byte; AnsiText: ansistring; TextTooLong: boolean=false; - rec: TLabelRecord; + rec: TBIFF2LabelRecord; buf: array of byte; var xf: Word; @@ -1659,20 +1677,9 @@ end; *******************************************************************} procedure TsSpreadBIFF2Writer.WriteNumber(AStream: TStream; const ARow, ACol: Cardinal; const AValue: double; ACell: PCell); -type - TNumberRecord = packed record - RecordID: Word; - RecordSize: Word; - Row: Word; - Col: Word; - Attrib1: Byte; - Attrib2: Byte; - Attrib3: Byte; - Value: Double; - end; var xf: Word; - rec: TNumberRecord; + rec: TBIFF2NumberRecord; begin xf := FindXFIndex(ACell); if xf >= 63 then diff --git a/components/fpspreadsheet/xlsbiff5.pas b/components/fpspreadsheet/xlsbiff5.pas index 3334a2a0b..34c16306b 100755 --- a/components/fpspreadsheet/xlsbiff5.pas +++ b/components/fpspreadsheet/xlsbiff5.pas @@ -307,6 +307,16 @@ const XF_ROTATION_STACKED ); +type + TBIFF5LabelRecord = packed record + RecordID: Word; + RecordSize: Word; + Row: Word; + Col: Word; + XFIndex: Word; + TextLen: Word; + end; + { TsSpreadBIFF5Writer } @@ -933,22 +943,13 @@ end; *******************************************************************} procedure TsSpreadBIFF5Writer.WriteLabel(AStream: TStream; const ARow, ACol: Cardinal; const AValue: string; ACell: PCell); -type - TLabelRecord = packed record - RecordID: Word; - RecordSize: Word; - Row: Word; - Col: Word; - XFIndex: Word; - TextLen: Word; - end; const MAXBYTES = 255; //limit for this format var L: Word; AnsiValue: ansistring; TextTooLong: boolean=false; - rec: TLabelRecord; + rec: TBIFF5LabelRecord; buf: array of byte; begin case WorkBookEncoding of @@ -1756,12 +1757,29 @@ end; procedure TsSpreadBIFF5Reader.ReadLabel(AStream: TStream); var + rec: TBIFF5LabelRecord; L: Word; ARow, ACol: Cardinal; XF: WORD; - AValue: array[0..255] of Char; +// AValue: array[0..255] of Char; + AValue: ansistring; AStrValue: ansistring; begin + { Read entire record, starting at Row, except for string data } + AStream.ReadBuffer(rec.Row, SizeOf(TBIFF5LabelRecord) - 2*SizeOf(Word)); + ARow := WordLEToN(rec.Row); + ACol := WordLEToN(rec.Col); + XF := WordLEToN(rec.XFIndex); + + { Byte String with 16-bit size } + L := WordLEToN(rec.TextLen); + SetLength(AValue, L); + AStream.ReadBuffer(AValue[1], L); + + { Save the data } + FWorksheet.WriteUTF8Text(ARow, ACol, ISO_8859_1ToUTF8(AValue)); + + (* ReadRowColXF(AStream, ARow, ACol, XF); { Byte String with 16-bit size } @@ -1772,7 +1790,7 @@ begin { Save the data } FWorksheet.WriteUTF8Text(ARow, ACol, ISO_8859_1ToUTF8(AStrValue)); - + *) { Add attributes } ApplyCellFormatting(ARow, ACol, XF); end; diff --git a/components/fpspreadsheet/xlscommon.pas b/components/fpspreadsheet/xlscommon.pas index c1b41a463..808c00c21 100644 --- a/components/fpspreadsheet/xlscommon.pas +++ b/components/fpspreadsheet/xlscommon.pas @@ -677,6 +677,15 @@ const INT_EXCEL_TOKEN_TATTR {fekOpSum} ); +type + TBIFF58NumberRecord = packed record + RecordID: Word; + RecordSize: Word; + Row: Word; + Col: Word; + XFIndex: Word; + Value: Double; + end; function ConvertExcelDateTimeToDateTime( const AExcelDateNum: Double; ADateMode: TDateMode): TDateTime; @@ -1230,6 +1239,7 @@ end; // NOTE: This procedure is valid after BIFF 3. procedure TsSpreadBIFFReader.ReadNumber(AStream: TStream); var + rec: TBIFF58NumberRecord; ARow, ACol: Cardinal; XF: WORD; value: Double = 0.0; @@ -1237,10 +1247,18 @@ var nf: TsNumberFormat; nfs: String; begin + { Read entire record, starting at Row } + AStream.ReadBuffer(rec.Row, SizeOf(TBIFF58NumberRecord) - 2*SizeOf(Word)); + ARow := WordLEToN(rec.Row); + ACol := WordLEToN(rec.Col); + XF := WordLEToN(rec.XFIndex); + value := rec.Value; + (* ReadRowColXF(AStream, ARow, ACol, XF); { IEE 754 floating-point value } AStream.ReadBuffer(value, 8); + *) {Find out what cell type, set content type and value} ExtractNumberFormat(XF, nf, nfs); @@ -1921,17 +1939,8 @@ end; Valid for BIFF5 and BIFF8 (BIFF2 has a different record structure.). } procedure TsSpreadBIFFWriter.WriteNumber(AStream: TStream; const ARow, ACol: Cardinal; const AValue: double; ACell: PCell); -type - TNumberRecord = packed record - RecordID: Word; - RecordSize: Word; - Row: Word; - Col: Word; - XFIndex: Word; - Value: Double; - end; var - rec: TNumberRecord; + rec: TBIFF58NumberRecord; begin { BIFF Record header } rec.RecordID := WordToLE(INT_EXCEL_ID_NUMBER); diff --git a/components/fpspreadsheet/xlsxooxml.pas b/components/fpspreadsheet/xlsxooxml.pas index 5c0bceaee..437fe6179 100755 --- a/components/fpspreadsheet/xlsxooxml.pas +++ b/components/fpspreadsheet/xlsxooxml.pas @@ -243,8 +243,6 @@ procedure TsSpreadOOXMLWriter.AddDefaultFormats(); // We store the index of the XF record that will be assigned to this style in // the "row" of the style. Will be needed when writing the XF record. // --- This is needed for BIFF. Not clear if it is important here as well... -var - len: Integer; begin SetLength(FFormattingStyles, 2); @@ -559,7 +557,6 @@ var item: TsNumFormatData; s: String; n: Integer; - fmt: String; begin s := ''; n := 0; @@ -1066,7 +1063,6 @@ end; { Is called before zipping the individual file parts. Rewinds the streams. } procedure TsSpreadOOXMLWriter.ResetStreams; var - stream: TStream; i: Integer; begin ResetStream(FSContentTypes);