fpspreadsheet: Read entire biff record of label and number cells to speed up reading (30% improvement for biff2). Numerous clean-up, mostly debugger settings.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3355 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-07-21 20:33:25 +00:00
parent 7fe3c4402a
commit ba37ace85f
24 changed files with 188 additions and 288 deletions

View File

@ -54,10 +54,5 @@
<UseAnsiStrings Value="False"/> <UseAnsiStrings Value="False"/>
</SyntaxOptions> </SyntaxOptions>
</Parsing> </Parsing>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
</Debugging>
</Linking>
</CompilerOptions> </CompilerOptions>
</CONFIG> </CONFIG>

View File

@ -52,10 +52,5 @@
<UseAnsiStrings Value="False"/> <UseAnsiStrings Value="False"/>
</SyntaxOptions> </SyntaxOptions>
</Parsing> </Parsing>
<Linking>
<Debugging>
<DebugInfoType Value="dsStabs"/>
</Debugging>
</Linking>
</CompilerOptions> </CompilerOptions>
</CONFIG> </CONFIG>

View File

@ -41,7 +41,6 @@
</CodeGeneration> </CodeGeneration>
<Linking> <Linking>
<Debugging> <Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
<UseExternalDbgSyms Value="True"/> <UseExternalDbgSyms Value="True"/>
</Debugging> </Debugging>
</Linking> </Linking>

View File

@ -28,21 +28,19 @@
<FormatVersion Value="1"/> <FormatVersion Value="1"/>
</local> </local>
</RunParams> </RunParams>
<RequiredPackages Count="3"> <RequiredPackages Count="2">
<Item1> <Item1>
<PackageName Value="SQLDBLaz"/> <PackageName Value="laz_fpspreadsheet"/>
</Item1> </Item1>
<Item2> <Item2>
<PackageName Value="laz_fpspreadsheet"/>
</Item2>
<Item3>
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item3> </Item2>
</RequiredPackages> </RequiredPackages>
<Units Count="2"> <Units Count="2">
<Unit0> <Unit0>
<Filename Value="fpsspeedtest.pas"/> <Filename Value="fpsspeedtest.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="fpsspeedtest"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>

View File

@ -66,9 +66,6 @@
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Linking> <Linking>
<Debugging>
<DebugInfoType Value="dsStabs"/>
</Debugging>
<Options> <Options>
<Win32> <Win32>
<GraphicApplication Value="True"/> <GraphicApplication Value="True"/>

View File

@ -48,9 +48,6 @@
</Win32> </Win32>
</Options> </Options>
</Linking> </Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
</Item2> </Item2>
<Item3 Name="Release"> <Item3 Name="Release">
@ -82,9 +79,6 @@
</Win32> </Win32>
</Options> </Options>
</Linking> </Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
</Item3> </Item3>
</BuildModes> </BuildModes>
@ -134,18 +128,12 @@
</SyntaxOptions> </SyntaxOptions>
</Parsing> </Parsing>
<Linking> <Linking>
<Debugging>
<DebugInfoType Value="dsStabs"/>
</Debugging>
<Options> <Options>
<Win32> <Win32>
<GraphicApplication Value="True"/> <GraphicApplication Value="True"/>
</Win32> </Win32>
</Options> </Options>
</Linking> </Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<Exceptions Count="5"> <Exceptions Count="5">

View File

@ -63,7 +63,7 @@ object Form1: TForm1
TabOrder = 1 TabOrder = 1
TitleStyle = tsNative TitleStyle = tsNative
ColWidths = ( ColWidths = (
56 42
64 64
64 64
64 64
@ -104,19 +104,19 @@ object Form1: TForm1
TabOrder = 2 TabOrder = 2
object Label1: TLabel object Label1: TLabel
Left = 8 Left = 8
Height = 20 Height = 15
Top = 9 Top = 9
Width = 46 Width = 37
Caption = 'Sheets:' Caption = 'Sheets:'
ParentColor = False ParentColor = False
end end
object SheetsCombo: TComboBox object SheetsCombo: TComboBox
Left = 72 Left = 72
Height = 28 Height = 23
Top = 4 Top = 4
Width = 808 Width = 808
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
ItemHeight = 20 ItemHeight = 15
ItemIndex = 0 ItemIndex = 0
Items.Strings = ( Items.Strings = (
'Sheet 1' 'Sheet 1'

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, 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; ButtonPanel, fpspreadsheetgrid, fpspreadsheet, fpsallformats;
type type
@ -31,16 +31,6 @@ type
private private
{ private declarations } { private declarations }
procedure LoadFile(const AFileName: String); 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
{ public declarations } { public declarations }
end; end;
@ -60,7 +50,6 @@ procedure TForm1.BtnNewClick(Sender: TObject);
var var
dlg: TForm; dlg: TForm;
edCols, edRows: TSpinEdit; edCols, edRows: TSpinEdit;
x: Integer;
begin begin
dlg := TForm.Create(nil); dlg := TForm.Create(nil);
try try
@ -73,7 +62,7 @@ begin
Parent := dlg; Parent := dlg;
Left := dlg.ClientWidth - Width - 24; Left := dlg.ClientWidth - Width - 24;
Top := 16; Top := 16;
Value := WorksheetGrid.ColCount - ord(WorksheetGrid.DisplayFixedColRow); Value := WorksheetGrid.ColCount - ord(WorksheetGrid.ShowHeaders);
end; end;
with TLabel.Create(dlg) do begin with TLabel.Create(dlg) do begin
Parent := dlg; Parent := dlg;
@ -87,7 +76,7 @@ begin
Parent := dlg; Parent := dlg;
Left := edCols.Left; Left := edCols.Left;
Top := edCols.Top + edCols.Height + 8; Top := edCols.Top + edCols.Height + 8;
Value := WorksheetGrid.RowCount - ord(WorksheetGrid.DisplayFixedColRow); Value := WorksheetGrid.RowCount - ord(WorksheetGrid.ShowHeaders);
end; end;
with TLabel.Create(dlg) do begin with TLabel.Create(dlg) do begin
Parent := dlg; Parent := dlg;
@ -142,8 +131,6 @@ end;
// Loads first worksheet from file into grid // Loads first worksheet from file into grid
procedure TForm1.LoadFile(const AFileName: String); procedure TForm1.LoadFile(const AFileName: String);
var
i: Integer;
begin begin
// Load file // Load file
Screen.Cursor := crHourglass; Screen.Cursor := crHourglass;
@ -166,55 +153,6 @@ begin
end; end;
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 initialization
{$I mainform.lrs} {$I mainform.lrs}

View File

@ -54,10 +54,5 @@
<UseAnsiStrings Value="False"/> <UseAnsiStrings Value="False"/>
</SyntaxOptions> </SyntaxOptions>
</Parsing> </Parsing>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
</Debugging>
</Linking>
</CompilerOptions> </CompilerOptions>
</CONFIG> </CONFIG>

View File

@ -64,12 +64,10 @@
<Unit0> <Unit0>
<Filename Value="test_formula_func.pas"/> <Filename Value="test_formula_func.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="test_formula_func"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="financemath.pas"/> <Filename Value="financemath.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="financemath"/>
</Unit1> </Unit1>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
@ -82,11 +80,6 @@
<CodeGeneration> <CodeGeneration>
<SmartLinkUnit Value="True"/> <SmartLinkUnit Value="True"/>
</CodeGeneration> </CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
</Debugging>
</Linking>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<Exceptions Count="3"> <Exceptions Count="3">

View File

@ -77,9 +77,6 @@
<SmartLinkUnit Value="True"/> <SmartLinkUnit Value="True"/>
</CodeGeneration> </CodeGeneration>
<Linking> <Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
</Debugging>
<Options> <Options>
<Win32> <Win32>
<GraphicApplication Value="True"/> <GraphicApplication Value="True"/>

View File

@ -77,7 +77,6 @@
</CodeGeneration> </CodeGeneration>
<Linking> <Linking>
<Debugging> <Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
<UseHeaptrc Value="True"/> <UseHeaptrc Value="True"/>
</Debugging> </Debugging>
</Linking> </Linking>

View File

@ -4,7 +4,7 @@ object Form1: TForm1
Top = 248 Top = 248
Width = 884 Width = 884
Caption = 'spready' Caption = 'spready'
ClientHeight = 624 ClientHeight = 629
ClientWidth = 884 ClientWidth = 884
Menu = MainMenu Menu = MainMenu
OnActivate = FormActivate OnActivate = FormActivate
@ -14,7 +14,7 @@ object Form1: TForm1
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 85 Height = 85
Top = 539 Top = 544
Width = 884 Width = 884
Align = alBottom Align = alBottom
BevelOuter = bvNone BevelOuter = bvNone
@ -23,9 +23,9 @@ object Form1: TForm1
TabOrder = 0 TabOrder = 0
object CbShowHeaders: TCheckBox object CbShowHeaders: TCheckBox
Left = 8 Left = 8
Height = 24 Height = 19
Top = 8 Top = 8
Width = 116 Width = 93
Caption = 'Show headers' Caption = 'Show headers'
Checked = True Checked = True
OnClick = CbShowHeadersClick OnClick = CbShowHeadersClick
@ -34,9 +34,9 @@ object Form1: TForm1
end end
object CbShowGridLines: TCheckBox object CbShowGridLines: TCheckBox
Left = 8 Left = 8
Height = 24 Height = 19
Top = 32 Top = 32
Width = 125 Width = 100
Caption = 'Show grid lines' Caption = 'Show grid lines'
Checked = True Checked = True
OnClick = CbShowGridLinesClick OnClick = CbShowGridLinesClick
@ -45,7 +45,7 @@ object Form1: TForm1
end end
object EdFrozenCols: TSpinEdit object EdFrozenCols: TSpinEdit
Left = 389 Left = 389
Height = 28 Height = 23
Top = 8 Top = 8
Width = 52 Width = 52
OnChange = EdFrozenColsChange OnChange = EdFrozenColsChange
@ -53,7 +53,7 @@ object Form1: TForm1
end end
object EdFrozenRows: TSpinEdit object EdFrozenRows: TSpinEdit
Left = 389 Left = 389
Height = 28 Height = 23
Top = 39 Top = 39
Width = 52 Width = 52
OnChange = EdFrozenRowsChange OnChange = EdFrozenRowsChange
@ -61,37 +61,37 @@ object Form1: TForm1
end end
object Label1: TLabel object Label1: TLabel
Left = 304 Left = 304
Height = 20 Height = 15
Top = 13 Top = 13
Width = 77 Width = 62
Caption = 'Frozen cols:' Caption = 'Frozen cols:'
FocusControl = EdFrozenCols FocusControl = EdFrozenCols
ParentColor = False ParentColor = False
end end
object Label2: TLabel object Label2: TLabel
Left = 304 Left = 304
Height = 20 Height = 15
Top = 40 Top = 40
Width = 82 Width = 66
Caption = 'Frozen rows:' Caption = 'Frozen rows:'
FocusControl = EdFrozenRows FocusControl = EdFrozenRows
ParentColor = False ParentColor = False
end end
object CbReadFormulas: TCheckBox object CbReadFormulas: TCheckBox
Left = 8 Left = 8
Height = 24 Height = 19
Top = 56 Top = 56
Width = 120 Width = 96
Caption = 'Read formulas' Caption = 'Read formulas'
OnChange = CbReadFormulasChange OnChange = CbReadFormulasChange
TabOrder = 4 TabOrder = 4
end end
object CbHeaderStyle: TComboBox object CbHeaderStyle: TComboBox
Left = 152 Left = 152
Height = 28 Height = 23
Top = 8 Top = 8
Width = 116 Width = 116
ItemHeight = 20 ItemHeight = 15
ItemIndex = 2 ItemIndex = 2
Items.Strings = ( Items.Strings = (
'Lazarus' 'Lazarus'
@ -106,7 +106,7 @@ object Form1: TForm1
end end
object PageControl1: TPageControl object PageControl1: TPageControl
Left = 0 Left = 0
Height = 460 Height = 465
Top = 79 Top = 79
Width = 884 Width = 884
ActivePage = TabSheet1 ActivePage = TabSheet1
@ -116,11 +116,11 @@ object Form1: TForm1
OnChange = PageControl1Change OnChange = PageControl1Change
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Sheet1' Caption = 'Sheet1'
ClientHeight = 427 ClientHeight = 437
ClientWidth = 876 ClientWidth = 876
object WorksheetGrid: TsWorksheetGrid object WorksheetGrid: TsWorksheetGrid
Left = 0 Left = 0
Height = 427 Height = 437
Top = 0 Top = 0
Width = 876 Width = 876
FrozenCols = 0 FrozenCols = 0
@ -136,7 +136,7 @@ object Form1: TForm1
TitleStyle = tsNative TitleStyle = tsNative
OnSelection = WorksheetGridSelection OnSelection = WorksheetGridSelection
ColWidths = ( ColWidths = (
56 42
64 64
64 64
64 64
@ -244,19 +244,19 @@ object Form1: TForm1
end end
object FontComboBox: TComboBox object FontComboBox: TComboBox
Left = 52 Left = 52
Height = 28 Height = 23
Top = 2 Top = 2
Width = 127 Width = 127
ItemHeight = 20 ItemHeight = 15
OnSelect = FontComboBoxSelect OnSelect = FontComboBoxSelect
TabOrder = 0 TabOrder = 0
end end
object FontSizeComboBox: TComboBox object FontSizeComboBox: TComboBox
Left = 179 Left = 179
Height = 28 Height = 23
Top = 2 Top = 2
Width = 48 Width = 48
ItemHeight = 20 ItemHeight = 15
Items.Strings = ( Items.Strings = (
'8' '8'
'9' '9'

View File

@ -48,9 +48,6 @@
</Win32> </Win32>
</Options> </Options>
</Linking> </Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
</Item2> </Item2>
<Item3 Name="Release"> <Item3 Name="Release">
@ -82,9 +79,6 @@
</Win32> </Win32>
</Options> </Options>
</Linking> </Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
</Item3> </Item3>
</BuildModes> </BuildModes>
@ -99,13 +93,16 @@
<FormatVersion Value="1"/> <FormatVersion Value="1"/>
</local> </local>
</RunParams> </RunParams>
<RequiredPackages Count="2"> <RequiredPackages Count="3">
<Item1> <Item1>
<PackageName Value="laz_fpspreadsheet_visual"/> <PackageName Value="laz_fpspreadsheet"/>
</Item1> </Item1>
<Item2> <Item2>
<PackageName Value="LCL"/> <PackageName Value="laz_fpspreadsheet_visual"/>
</Item2> </Item2>
<Item3>
<PackageName Value="LCL"/>
</Item3>
</RequiredPackages> </RequiredPackages>
<Units Count="2"> <Units Count="2">
<Unit0> <Unit0>
@ -134,18 +131,12 @@
</SyntaxOptions> </SyntaxOptions>
</Parsing> </Parsing>
<Linking> <Linking>
<Debugging>
<DebugInfoType Value="dsStabs"/>
</Debugging>
<Options> <Options>
<Win32> <Win32>
<GraphicApplication Value="True"/> <GraphicApplication Value="True"/>
</Win32> </Win32>
</Options> </Options>
</Linking> </Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<Exceptions Count="5"> <Exceptions Count="5">

View File

@ -4,7 +4,7 @@ program spready;
uses uses
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, mainform, laz_fpspreadsheet_visual; Forms, mainform, laz_fpspreadsheet_visual, laz_fpspreadsheet;
{$R *.res} {$R *.res}

View File

@ -38,7 +38,6 @@
<Unit0> <Unit0>
<Filename Value="wikitableread.lpr"/> <Filename Value="wikitableread.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="wikitableread"/>
</Unit0> </Unit0>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
@ -53,13 +52,5 @@
<UseAnsiStrings Value="False"/> <UseAnsiStrings Value="False"/>
</SyntaxOptions> </SyntaxOptions>
</Parsing> </Parsing>
<Linking>
<Debugging>
<DebugInfoType Value="dsStabs"/>
</Debugging>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
</CONFIG> </CONFIG>

View File

@ -54,10 +54,5 @@
<UseAnsiStrings Value="False"/> <UseAnsiStrings Value="False"/>
</SyntaxOptions> </SyntaxOptions>
</Parsing> </Parsing>
<Linking>
<Debugging>
<DebugInfoType Value="dsStabs"/>
</Debugging>
</Linking>
</CompilerOptions> </CompilerOptions>
</CONFIG> </CONFIG>

View File

@ -3046,13 +3046,12 @@ procedure TsSpreadOpenDocWriter.WriteRowStyles(AStream: TStream);
var var
i: Integer; i: Integer;
rowstyle: TRowStyleData; rowstyle: TRowStyleData;
s: String;
useOptRowH: String; useOptRowH: String;
begin begin
if FRowStyleList.Count = 0 then begin if FRowStyleList.Count = 0 then begin
AppendToStream(AStream, AppendToStream(AStream,
'<style:style style:name="ro1" style:family="table-row">', '<style:style style:name="ro1" style:family="table-row">' +
'<style:table-row-properties style:row-height="0.416cm" fo:break-before="auto" style:use-optimal-row-height="true"/>', '<style:table-row-properties style:row-height="0.416cm" fo:break-before="auto" style:use-optimal-row-height="true"/>' +
'</style:style>'); '</style:style>');
exit; exit;
end; end;

View File

@ -63,56 +63,56 @@ This package is all you need if you don't want graphical components (like grids
<UnitName Value="fpsutils"/> <UnitName Value="fpsutils"/>
</Item9> </Item9>
<Item10> <Item10>
<Filename Value="fpszipper.pp"/>
<UnitName Value="fpszipper"/>
</Item10>
<Item11>
<Filename Value="uvirtuallayer_types.pas"/>
<UnitName Value="uvirtuallayer_types"/>
</Item11>
<Item12>
<Filename Value="uvirtuallayer.pas"/>
<UnitName Value="uvirtuallayer"/>
</Item12>
<Item13>
<Filename Value="uvirtuallayer_ole.pas"/>
<UnitName Value="uvirtuallayer_ole"/>
</Item13>
<Item14>
<Filename Value="uvirtuallayer_ole_helpers.pas"/>
<UnitName Value="uvirtuallayer_ole_helpers"/>
</Item14>
<Item15>
<Filename Value="uvirtuallayer_ole_types.pas"/>
<UnitName Value="uvirtuallayer_ole_types"/>
</Item15>
<Item16>
<Filename Value="uvirtuallayer_stream.pas"/>
<UnitName Value="uvirtuallayer_stream"/>
</Item16>
<Item17>
<Filename Value="fpolebasic.pas"/>
<UnitName Value="fpolebasic"/>
</Item17>
<Item18>
<Filename Value="xlscommon.pas"/>
<UnitName Value="xlscommon"/>
</Item18>
<Item19>
<Filename Value="wikitable.pas"/>
<UnitName Value="wikitable"/>
</Item19>
<Item20>
<Filename Value="fpsnumformatparser.pas"/>
<UnitName Value="fpsNumFormatParser"/>
</Item20>
<Item21>
<Filename Value="fpsfunc.pas"/>
<UnitName Value="fpsfunc"/>
</Item21>
<Item22>
<Filename Value="fpsstreams.pas"/> <Filename Value="fpsstreams.pas"/>
<UnitName Value="fpsStreams"/> <UnitName Value="fpsStreams"/>
</Item10>
<Item11>
<Filename Value="fpszipper.pp"/>
<UnitName Value="fpszipper"/>
</Item11>
<Item12>
<Filename Value="uvirtuallayer_types.pas"/>
<UnitName Value="uvirtuallayer_types"/>
</Item12>
<Item13>
<Filename Value="uvirtuallayer.pas"/>
<UnitName Value="uvirtuallayer"/>
</Item13>
<Item14>
<Filename Value="uvirtuallayer_ole.pas"/>
<UnitName Value="uvirtuallayer_ole"/>
</Item14>
<Item15>
<Filename Value="uvirtuallayer_ole_helpers.pas"/>
<UnitName Value="uvirtuallayer_ole_helpers"/>
</Item15>
<Item16>
<Filename Value="uvirtuallayer_ole_types.pas"/>
<UnitName Value="uvirtuallayer_ole_types"/>
</Item16>
<Item17>
<Filename Value="uvirtuallayer_stream.pas"/>
<UnitName Value="uvirtuallayer_stream"/>
</Item17>
<Item18>
<Filename Value="fpolebasic.pas"/>
<UnitName Value="fpolebasic"/>
</Item18>
<Item19>
<Filename Value="xlscommon.pas"/>
<UnitName Value="xlscommon"/>
</Item19>
<Item20>
<Filename Value="wikitable.pas"/>
<UnitName Value="wikitable"/>
</Item20>
<Item21>
<Filename Value="fpsnumformatparser.pas"/>
<UnitName Value="fpsNumFormatParser"/>
</Item21>
<Item22>
<Filename Value="fpsfunc.pas"/>
<UnitName Value="fpsfunc"/>
</Item22> </Item22>
</Files> </Files>
<RequiredPkgs Count="2"> <RequiredPkgs Count="2">

View File

@ -8,10 +8,10 @@ interface
uses uses
fpolestorage, fpsallformats, fpsopendocument, fpspreadsheet, xlsbiff2, fpolestorage, fpsallformats, fpsopendocument, fpspreadsheet, xlsbiff2,
xlsbiff5, xlsbiff8, xlsxooxml, fpsutils, fpszipper, uvirtuallayer_types, xlsbiff5, xlsbiff8, xlsxooxml, fpsutils, fpsStreams, fpszipper,
uvirtuallayer, uvirtuallayer_ole, uvirtuallayer_ole_helpers, uvirtuallayer_types, uvirtuallayer, uvirtuallayer_ole,
uvirtuallayer_ole_types, uvirtuallayer_stream, fpolebasic, xlscommon, uvirtuallayer_ole_helpers, uvirtuallayer_ole_types, uvirtuallayer_stream,
wikitable, fpsNumFormatParser, fpsfunc, fpsStreams; fpolebasic, xlscommon, wikitable, fpsNumFormatParser, fpsfunc;
implementation implementation

View File

@ -167,6 +167,29 @@ const
INT_EXCEL_CHART = $0020; INT_EXCEL_CHART = $0020;
INT_EXCEL_MACRO_SHEET = $0040; 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 } { TsBIFF2NumFormatList }
@ -541,19 +564,23 @@ end;
procedure TsSpreadBIFF2Reader.ReadLabel(AStream: TStream); procedure TsSpreadBIFF2Reader.ReadLabel(AStream: TStream);
var var
rec: TBIFF2LabelRecord;
L: Byte; L: Byte;
ARow, ACol: Cardinal; ARow, ACol: Cardinal;
XF: Word; XF: Word;
AValue: array[0..255] of Char; AValue: ansistring;
AStrValue: UTF8String; AStrValue: UTF8String;
begin begin
{ BIFF Record row/column/style } { Read entire record, starting at Row, except for string data }
ReadRowColXF(AStream, ARow, ACol, XF); 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 } { String with 8-bit size }
L := AStream.ReadByte(); L := rec.TextLen;
AStream.ReadBuffer(AValue, L); SetLength(AValue, L);
AValue[L] := #0; AStream.ReadBuffer(AValue[1], L);
{ Save the data } { Save the data }
case WorkBookEncoding of case WorkBookEncoding of
@ -575,6 +602,7 @@ end;
procedure TsSpreadBIFF2Reader.ReadNumber(AStream: TStream); procedure TsSpreadBIFF2Reader.ReadNumber(AStream: TStream);
var var
rec: TBIFF2NumberRecord;
ARow, ACol: Cardinal; ARow, ACol: Cardinal;
XF: Word; XF: Word;
value: Double = 0.0; value: Double = 0.0;
@ -582,11 +610,12 @@ var
nf: TsNumberFormat; nf: TsNumberFormat;
nfs: String; nfs: String;
begin begin
{ BIFF Record row/column/style } { Read entire record, starting at Row }
ReadRowColXF(AStream, ARow, ACol, XF); AStream.ReadBuffer(rec.Row, SizeOf(TBIFF2NumberRecord) - 2*SizeOf(Word));
ARow := WordLEToN(rec.Row);
{ IEE 754 floating-point value } ACol := WordLEToN(rec.Col);
AStream.ReadBuffer(value, 8); XF := rec.Attrib1 and $3F;
value := rec.Value;
{Find out what cell type, set content type and value} {Find out what cell type, set content type and value}
ExtractNumberFormat(XF, nf, nfs); ExtractNumberFormat(XF, nf, nfs);
@ -1560,24 +1589,13 @@ end;
*******************************************************************} *******************************************************************}
procedure TsSpreadBIFF2Writer.WriteLabel(AStream: TStream; const ARow, procedure TsSpreadBIFF2Writer.WriteLabel(AStream: TStream; const ARow,
ACol: Cardinal; const AValue: string; ACell: PCell); 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 const
MAXBYTES = 255; //limit for this format MAXBYTES = 255; //limit for this format
var var
L: Byte; L: Byte;
AnsiText: ansistring; AnsiText: ansistring;
TextTooLong: boolean=false; TextTooLong: boolean=false;
rec: TLabelRecord; rec: TBIFF2LabelRecord;
buf: array of byte; buf: array of byte;
var var
xf: Word; xf: Word;
@ -1659,20 +1677,9 @@ end;
*******************************************************************} *******************************************************************}
procedure TsSpreadBIFF2Writer.WriteNumber(AStream: TStream; const ARow, procedure TsSpreadBIFF2Writer.WriteNumber(AStream: TStream; const ARow,
ACol: Cardinal; const AValue: double; ACell: PCell); 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 var
xf: Word; xf: Word;
rec: TNumberRecord; rec: TBIFF2NumberRecord;
begin begin
xf := FindXFIndex(ACell); xf := FindXFIndex(ACell);
if xf >= 63 then if xf >= 63 then

View File

@ -307,6 +307,16 @@ const
XF_ROTATION_STACKED XF_ROTATION_STACKED
); );
type
TBIFF5LabelRecord = packed record
RecordID: Word;
RecordSize: Word;
Row: Word;
Col: Word;
XFIndex: Word;
TextLen: Word;
end;
{ TsSpreadBIFF5Writer } { TsSpreadBIFF5Writer }
@ -933,22 +943,13 @@ end;
*******************************************************************} *******************************************************************}
procedure TsSpreadBIFF5Writer.WriteLabel(AStream: TStream; const ARow, procedure TsSpreadBIFF5Writer.WriteLabel(AStream: TStream; const ARow,
ACol: Cardinal; const AValue: string; ACell: PCell); 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 const
MAXBYTES = 255; //limit for this format MAXBYTES = 255; //limit for this format
var var
L: Word; L: Word;
AnsiValue: ansistring; AnsiValue: ansistring;
TextTooLong: boolean=false; TextTooLong: boolean=false;
rec: TLabelRecord; rec: TBIFF5LabelRecord;
buf: array of byte; buf: array of byte;
begin begin
case WorkBookEncoding of case WorkBookEncoding of
@ -1756,12 +1757,29 @@ end;
procedure TsSpreadBIFF5Reader.ReadLabel(AStream: TStream); procedure TsSpreadBIFF5Reader.ReadLabel(AStream: TStream);
var var
rec: TBIFF5LabelRecord;
L: Word; L: Word;
ARow, ACol: Cardinal; ARow, ACol: Cardinal;
XF: WORD; XF: WORD;
AValue: array[0..255] of Char; // AValue: array[0..255] of Char;
AValue: ansistring;
AStrValue: ansistring; AStrValue: ansistring;
begin 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); ReadRowColXF(AStream, ARow, ACol, XF);
{ Byte String with 16-bit size } { Byte String with 16-bit size }
@ -1772,7 +1790,7 @@ begin
{ Save the data } { Save the data }
FWorksheet.WriteUTF8Text(ARow, ACol, ISO_8859_1ToUTF8(AStrValue)); FWorksheet.WriteUTF8Text(ARow, ACol, ISO_8859_1ToUTF8(AStrValue));
*)
{ Add attributes } { Add attributes }
ApplyCellFormatting(ARow, ACol, XF); ApplyCellFormatting(ARow, ACol, XF);
end; end;

View File

@ -677,6 +677,15 @@ const
INT_EXCEL_TOKEN_TATTR {fekOpSum} INT_EXCEL_TOKEN_TATTR {fekOpSum}
); );
type
TBIFF58NumberRecord = packed record
RecordID: Word;
RecordSize: Word;
Row: Word;
Col: Word;
XFIndex: Word;
Value: Double;
end;
function ConvertExcelDateTimeToDateTime( function ConvertExcelDateTimeToDateTime(
const AExcelDateNum: Double; ADateMode: TDateMode): TDateTime; const AExcelDateNum: Double; ADateMode: TDateMode): TDateTime;
@ -1230,6 +1239,7 @@ end;
// 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);
var var
rec: TBIFF58NumberRecord;
ARow, ACol: Cardinal; ARow, ACol: Cardinal;
XF: WORD; XF: WORD;
value: Double = 0.0; value: Double = 0.0;
@ -1237,10 +1247,18 @@ var
nf: TsNumberFormat; nf: TsNumberFormat;
nfs: String; nfs: String;
begin 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); ReadRowColXF(AStream, ARow, ACol, XF);
{ IEE 754 floating-point value } { IEE 754 floating-point value }
AStream.ReadBuffer(value, 8); AStream.ReadBuffer(value, 8);
*)
{Find out what cell type, set content type and value} {Find out what cell type, set content type and value}
ExtractNumberFormat(XF, nf, nfs); ExtractNumberFormat(XF, nf, nfs);
@ -1921,17 +1939,8 @@ end;
Valid for BIFF5 and BIFF8 (BIFF2 has a different record structure.). } Valid for BIFF5 and BIFF8 (BIFF2 has a different record structure.). }
procedure TsSpreadBIFFWriter.WriteNumber(AStream: TStream; procedure TsSpreadBIFFWriter.WriteNumber(AStream: TStream;
const ARow, ACol: Cardinal; const AValue: double; ACell: PCell); 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 var
rec: TNumberRecord; rec: TBIFF58NumberRecord;
begin begin
{ BIFF Record header } { BIFF Record header }
rec.RecordID := WordToLE(INT_EXCEL_ID_NUMBER); rec.RecordID := WordToLE(INT_EXCEL_ID_NUMBER);

View File

@ -243,8 +243,6 @@ procedure TsSpreadOOXMLWriter.AddDefaultFormats();
// We store the index of the XF record that will be assigned to this style in // 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. // 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... // --- This is needed for BIFF. Not clear if it is important here as well...
var
len: Integer;
begin begin
SetLength(FFormattingStyles, 2); SetLength(FFormattingStyles, 2);
@ -559,7 +557,6 @@ var
item: TsNumFormatData; item: TsNumFormatData;
s: String; s: String;
n: Integer; n: Integer;
fmt: String;
begin begin
s := ''; s := '';
n := 0; n := 0;
@ -1066,7 +1063,6 @@ end;
{ Is called before zipping the individual file parts. Rewinds the streams. } { Is called before zipping the individual file parts. Rewinds the streams. }
procedure TsSpreadOOXMLWriter.ResetStreams; procedure TsSpreadOOXMLWriter.ResetStreams;
var var
stream: TStream;
i: Integer; i: Integer;
begin begin
ResetStream(FSContentTypes); ResetStream(FSContentTypes);