fpspreadsheet: Greatly reduce hints and warnings.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3632 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-10-06 10:43:10 +00:00
parent e2a302b8e6
commit af452001d4
25 changed files with 144 additions and 122 deletions

View File

@ -23,7 +23,6 @@ const
var var
MyWorkbook: TsWorkbook; MyWorkbook: TsWorkbook;
MyWorksheet: TsWorksheet; MyWorksheet: TsWorksheet;
MyRPNFormula: TsRPNFormula;
MyDir: string; MyDir: string;
number: Double; number: Double;
lCell: PCell; lCell: PCell;

View File

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

View File

@ -7,7 +7,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Menus, ExtCtrls, ActnList, Spin, Buttons, StdCtrls, Menus, ExtCtrls, ActnList, Spin, Buttons,
ButtonPanel, fpspreadsheetgrid, fpspreadsheet, fpsallformats; ButtonPanel, fpspreadsheetgrid, fpspreadsheet, {%H-}fpsallformats;
type type

View File

@ -51,13 +51,10 @@
<FormatVersion Value="1"/> <FormatVersion Value="1"/>
</local> </local>
</RunParams> </RunParams>
<RequiredPackages Count="2"> <RequiredPackages Count="1">
<Item1> <Item1>
<PackageName Value="LazUtils"/>
</Item1>
<Item2>
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item2> </Item1>
</RequiredPackages> </RequiredPackages>
<Units Count="2"> <Units Count="2">
<Unit0> <Unit0>

View File

@ -7,7 +7,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
ComCtrls, StdCtrls, Grids, ComCtrls, StdCtrls, Grids,
fpSpreadsheet, fpspreadsheetgrid, fpsallformats; fpSpreadsheet, fpspreadsheetgrid, {%H-}fpsallformats;
type type

View File

@ -88,7 +88,7 @@ object Form1: TForm1
ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1 ChildSizing.ControlsPerLine = 1
ClientHeight = 66 ClientHeight = 63
ClientWidth = 156 ClientWidth = 156
ItemIndex = 0 ItemIndex = 0
Items.Strings = ( Items.Strings = (
@ -113,7 +113,7 @@ object Form1: TForm1
ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1 ChildSizing.ControlsPerLine = 1
ClientHeight = 115 ClientHeight = 112
ClientWidth = 156 ClientWidth = 156
Items.Strings = ( Items.Strings = (
'ods' 'ods'
@ -142,7 +142,7 @@ object Form1: TForm1
ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1 ChildSizing.ControlsPerLine = 1
ClientHeight = 155 ClientHeight = 152
ClientWidth = 156 ClientWidth = 156
Items.Strings = ( Items.Strings = (
'10k' '10k'

View File

@ -60,7 +60,7 @@ var
implementation implementation
uses uses
LclIntf, StrUtils; LclIntf, StrUtils, fpsUtils;
{$R *.lfm} {$R *.lfm}
@ -92,6 +92,7 @@ const
procedure TForm1.ReadCellDataHandler(Sender: TObject; ARow, ACol: Cardinal; procedure TForm1.ReadCellDataHandler(Sender: TObject; ARow, ACol: Cardinal;
const ADataCell: PCell); const ADataCell: PCell);
begin begin
Unused(ACol, ADataCell);
// nothing to do here. Just do a progress display // nothing to do here. Just do a progress display
if ARow mod 1000 = 0 then if ARow mod 1000 = 0 then
StatusMsg(Format('Virtual mode reading %s: Row %d...', [GetFileFormatName(FCurFormat), ARow])); StatusMsg(Format('Virtual mode reading %s: Row %d...', [GetFileFormatName(FCurFormat), ARow]));
@ -102,6 +103,7 @@ procedure TForm1.WriteCellStringHandler(Sender: TObject; ARow, ACol: cardinal;
var var
S: string; S: string;
begin begin
Unused(AStyleCell);
S := 'Xy' + IntToStr(ARow) + 'x' + IntToStr(ACol); S := 'Xy' + IntToStr(ARow) + 'x' + IntToStr(ACol);
AValue := S; AValue := S;
if ARow mod 1000 = 0 then if ARow mod 1000 = 0 then
@ -111,6 +113,7 @@ end;
procedure TForm1.WriteCellNumberHandler(Sender: TObject; ARow, ACol: cardinal; procedure TForm1.WriteCellNumberHandler(Sender: TObject; ARow, ACol: cardinal;
var AValue: variant; var AStyleCell: PCell); var AValue: variant; var AStyleCell: PCell);
begin begin
UnUsed(AStyleCell);
AValue := ARow * 1E5 + ACol; AValue := ARow * 1E5 + ACol;
if ARow mod 1000 = 0 then if ARow mod 1000 = 0 then
StatusMsg(Format('Virtual mode writing %s: Row %d...', [GetFileFormatName(FCurFormat), ARow])); StatusMsg(Format('Virtual mode writing %s: Row %d...', [GetFileFormatName(FCurFormat), ARow]));
@ -129,13 +132,14 @@ procedure TForm1.RunReadTest(Idx: Integer; Log: String;
Options: TsWorkbookOptions); Options: TsWorkbookOptions);
var var
MyWorkbook: TsWorkbook; MyWorkbook: TsWorkbook;
MyWorksheet: TsWorksheet;
Tm: DWord; Tm: DWord;
fName, s: String; fName, s: String;
i, j: Integer; i, j: Integer;
F: File; F: File;
ok: Boolean; ok: Boolean;
begin begin
Unused(idx);
s := Trim(Log); s := Trim(Log);
Log := Log + ' '; Log := Log + ' ';
try try
@ -324,10 +328,9 @@ end;
procedure TForm1.BtnReadClick(Sender: TObject); procedure TForm1.BtnReadClick(Sender: TObject);
var var
i, j, k, len: Integer; i, len: Integer;
s, fname: String; s: String;
rows: Integer; rows: Integer;
ext: String;
begin begin
WriteToIni; WriteToIni;

View File

@ -35,16 +35,11 @@
<PackageName Value="LazUtils"/> <PackageName Value="LazUtils"/>
</Item1> </Item1>
</RequiredPackages> </RequiredPackages>
<Units Count="2"> <Units Count="1">
<Unit0> <Unit0>
<Filename Value="ooxmlread.lpr"/> <Filename Value="ooxmlread.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
</Unit0> </Unit0>
<Unit1>
<Filename Value="..\..\fpsxmlcommon.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="fpsxmlcommon"/>
</Unit1>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@ -10,7 +10,7 @@ program ooxmlread;
{$mode delphi}{$H+} {$mode delphi}{$H+}
uses uses
Classes, SysUtils, fpspreadsheet, xlsxooxml, fpsxmlcommon; //fpsallformats; Classes, SysUtils, fpspreadsheet, xlsxooxml; //fpsallformats;
var var
MyWorkbook: TsWorkbook; MyWorkbook: TsWorkbook;

View File

@ -17,7 +17,6 @@ var
MyWorksheet: TsWorksheet; MyWorksheet: TsWorksheet;
MyDir: string; MyDir: string;
i: Integer; i: Integer;
a: TStringList;
MyCell: PCell; MyCell: PCell;
begin begin

View File

@ -4,7 +4,7 @@ object MainFrm: TMainFrm
Top = 258 Top = 258
Width = 884 Width = 884
Caption = 'spready' Caption = 'spready'
ClientHeight = 619 ClientHeight = 614
ClientWidth = 884 ClientWidth = 884
Menu = MainMenu Menu = MainMenu
OnActivate = FormActivate OnActivate = FormActivate
@ -14,7 +14,7 @@ object MainFrm: TMainFrm
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 82 Height = 82
Top = 537 Top = 532
Width = 884 Width = 884
Align = alBottom Align = alBottom
BevelOuter = bvNone BevelOuter = bvNone
@ -23,7 +23,7 @@ object MainFrm: TMainFrm
TabOrder = 6 TabOrder = 6
object EdFrozenCols: TSpinEdit object EdFrozenCols: TSpinEdit
Left = 429 Left = 429
Height = 23 Height = 28
Top = 8 Top = 8
Width = 52 Width = 52
OnChange = EdFrozenColsChange OnChange = EdFrozenColsChange
@ -31,7 +31,7 @@ object MainFrm: TMainFrm
end end
object EdFrozenRows: TSpinEdit object EdFrozenRows: TSpinEdit
Left = 429 Left = 429
Height = 23 Height = 28
Top = 39 Top = 39
Width = 52 Width = 52
OnChange = EdFrozenRowsChange OnChange = EdFrozenRowsChange
@ -39,37 +39,37 @@ object MainFrm: TMainFrm
end end
object Label1: TLabel object Label1: TLabel
Left = 344 Left = 344
Height = 15 Height = 20
Top = 13 Top = 13
Width = 62 Width = 77
Caption = 'Frozen cols:' Caption = 'Frozen cols:'
FocusControl = EdFrozenCols FocusControl = EdFrozenCols
ParentColor = False ParentColor = False
end end
object Label2: TLabel object Label2: TLabel
Left = 344 Left = 344
Height = 15 Height = 20
Top = 40 Top = 40
Width = 66 Width = 82
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 = 19 Height = 24
Top = 8 Top = 8
Width = 96 Width = 120
Caption = 'Read formulas' Caption = 'Read formulas'
OnChange = CbReadFormulasChange OnChange = CbReadFormulasChange
TabOrder = 0 TabOrder = 0
end end
object CbHeaderStyle: TComboBox object CbHeaderStyle: TComboBox
Left = 200 Left = 200
Height = 23 Height = 28
Top = 8 Top = 8
Width = 116 Width = 116
ItemHeight = 15 ItemHeight = 20
ItemIndex = 2 ItemIndex = 2
Items.Strings = ( Items.Strings = (
'Lazarus' 'Lazarus'
@ -83,18 +83,18 @@ object MainFrm: TMainFrm
end end
object CbAutoCalcFormulas: TCheckBox object CbAutoCalcFormulas: TCheckBox
Left = 8 Left = 8
Height = 19 Height = 24
Top = 32 Top = 32
Width = 128 Width = 158
Caption = 'Calculate on change' Caption = 'Calculate on change'
OnChange = CbAutoCalcFormulasChange OnChange = CbAutoCalcFormulasChange
TabOrder = 1 TabOrder = 1
end end
object CbTextOverflow: TCheckBox object CbTextOverflow: TCheckBox
Left = 8 Left = 8
Height = 19 Height = 24
Top = 56 Top = 56
Width = 91 Width = 114
Caption = 'Text overflow' Caption = 'Text overflow'
Checked = True Checked = True
OnChange = CbTextOverflowChange OnChange = CbTextOverflowChange
@ -206,19 +206,19 @@ object MainFrm: TMainFrm
end end
object FontComboBox: TComboBox object FontComboBox: TComboBox
Left = 52 Left = 52
Height = 23 Height = 28
Top = 2 Top = 2
Width = 127 Width = 127
ItemHeight = 15 ItemHeight = 20
OnSelect = FontComboBoxSelect OnSelect = FontComboBoxSelect
TabOrder = 0 TabOrder = 0
end end
object FontSizeComboBox: TComboBox object FontSizeComboBox: TComboBox
Left = 179 Left = 179
Height = 23 Height = 28
Top = 2 Top = 2
Width = 48 Width = 48
ItemHeight = 15 ItemHeight = 20
Items.Strings = ( Items.Strings = (
'8' '8'
'9' '9'
@ -392,7 +392,7 @@ object MainFrm: TMainFrm
end end
object InspectorSplitter: TSplitter object InspectorSplitter: TSplitter
Left = 648 Left = 648
Height = 458 Height = 453
Top = 79 Top = 79
Width = 5 Width = 5
Align = alRight Align = alRight
@ -400,7 +400,7 @@ object MainFrm: TMainFrm
end end
object InspectorPageControl: TPageControl object InspectorPageControl: TPageControl
Left = 653 Left = 653
Height = 458 Height = 453
Top = 79 Top = 79
Width = 231 Width = 231
ActivePage = PgCellValue ActivePage = PgCellValue
@ -410,11 +410,11 @@ object MainFrm: TMainFrm
OnChange = InspectorPageControlChange OnChange = InspectorPageControlChange
object PgCellValue: TTabSheet object PgCellValue: TTabSheet
Caption = 'Cell value' Caption = 'Cell value'
ClientHeight = 430 ClientHeight = 420
ClientWidth = 223 ClientWidth = 223
object CellInspector: TValueListEditor object CellInspector: TValueListEditor
Left = 0 Left = 0
Height = 430 Height = 420
Top = 0 Top = 0
Width = 223 Width = 223
Align = alClient Align = alClient
@ -458,7 +458,7 @@ object MainFrm: TMainFrm
end end
object TabControl: TTabControl object TabControl: TTabControl
Left = 0 Left = 0
Height = 458 Height = 453
Top = 79 Top = 79
Width = 648 Width = 648
OnChange = TabControlChange OnChange = TabControlChange
@ -466,7 +466,7 @@ object MainFrm: TMainFrm
TabOrder = 3 TabOrder = 3
object WorksheetGrid: TsWorksheetGrid object WorksheetGrid: TsWorksheetGrid
Left = 2 Left = 2
Height = 453 Height = 448
Top = 3 Top = 3
Width = 644 Width = 644
FrozenCols = 0 FrozenCols = 0
@ -484,7 +484,7 @@ object MainFrm: TMainFrm
OnHeaderClick = WorksheetGridHeaderClick OnHeaderClick = WorksheetGridHeaderClick
OnSelection = WorksheetGridSelection OnSelection = WorksheetGridSelection
ColWidths = ( ColWidths = (
42 56
64 64
64 64
64 64

View File

@ -8,7 +8,7 @@ uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Menus, ExtCtrls, ComCtrls, ActnList, Spin, Grids, StdCtrls, Menus, ExtCtrls, ComCtrls, ActnList, Spin, Grids,
ColorBox, ValEdit, ColorBox, ValEdit,
fpspreadsheetgrid, fpspreadsheet, fpsallformats; fpspreadsheetgrid, fpspreadsheet, {%H-}fpsallformats;
type type
@ -330,8 +330,8 @@ var
implementation implementation
uses uses
StrUtils, TypInfo, LCLIntf, LCLType, TypInfo, LCLIntf, LCLType,
fpcanvas, fpsutils, fpsnumformatparser; fpcanvas, fpsutils;
const const
DROPDOWN_COUNT = 24; DROPDOWN_COUNT = 24;
@ -888,8 +888,6 @@ end;
procedure TMainFrm.LoadFile(const AFileName: String); procedure TMainFrm.LoadFile(const AFileName: String);
// Loads first worksheet from file into grid // Loads first worksheet from file into grid
var var
pages: TStrings;
i: Integer;
err: String; err: String;
begin begin
// Load file // Load file
@ -951,6 +949,8 @@ end;
procedure TMainFrm.WorksheetGridHeaderClick(Sender: TObject; IsColumn: Boolean; procedure TMainFrm.WorksheetGridHeaderClick(Sender: TObject; IsColumn: Boolean;
Index: Integer); Index: Integer);
begin begin
Unused(Sender);
Unused(IsColumn, Index);
//ShowMessage('Header click'); //ShowMessage('Header click');
end; end;
@ -982,7 +982,6 @@ end;
procedure TMainFrm.UpdateCellInfo(ACell: PCell); procedure TMainFrm.UpdateCellInfo(ACell: PCell);
var var
i: Integer;
s: String; s: String;
cb: TsCellBorder; cb: TsCellBorder;
r1,r2,c1,c2: Cardinal; r1,r2,c1,c2: Cardinal;

View File

@ -9,7 +9,7 @@ uses
StdCtrls, Menus, ExtCtrls, ComCtrls, ActnList, Grids, ColorBox, StdCtrls, Menus, ExtCtrls, ComCtrls, ActnList, Grids, ColorBox,
SynEdit, SynEditHighlighter, SynEdit, SynEditHighlighter,
SynHighlighterHTML, SynHighlighterMulti, SynHighlighterCss, SynHighlighterHTML, SynHighlighterMulti, SynHighlighterCss,
fpspreadsheetgrid, fpspreadsheet, fpsallformats; fpspreadsheetgrid, fpspreadsheet, {%H-}fpsallformats;
type type
@ -661,8 +661,6 @@ end;
procedure TMainFrm.LoadFile(const AFileName: String); procedure TMainFrm.LoadFile(const AFileName: String);
// Loads first worksheet from file into grid // Loads first worksheet from file into grid
var var
pages: TStrings;
i: Integer;
err: String; err: String;
begin begin
// Load file // Load file

View File

@ -1254,7 +1254,7 @@ procedure fpsCELL(var Result: TsExpressionResult; const Args: TsExprParameterArr
} }
var var
stype: String; stype: String;
r1,r2, c1,c2: Cardinal; r1, c1: Cardinal;
cell: PCell; cell: PCell;
begin begin
if Length(Args)=1 then if Length(Args)=1 then
@ -1273,15 +1273,11 @@ begin
cell := ArgToCell(Args[1]); cell := ArgToCell(Args[1]);
r1 := Args[1].ResRow; r1 := Args[1].ResRow;
c1 := Args[1].ResCol; c1 := Args[1].ResCol;
r2 := r1;
c2 := c1;
end; end;
rtCellRange: rtCellRange:
begin begin
r1 := Args[1].ResCellRange.Row1; r1 := Args[1].ResCellRange.Row1;
r2 := Args[1].ResCellRange.Row2;
c1 := Args[1].ResCellRange.Col1; c1 := Args[1].ResCellRange.Col1;
c2 := Args[1].ResCellRange.Col2;
cell := Args[1].Worksheet.FindCell(r1, c1); cell := Args[1].Worksheet.FindCell(r1, c1);
end; end;
else else

View File

@ -1777,7 +1777,7 @@ var
formula: TsRPNFormula; formula: TsRPNFormula;
i: Integer; i: Integer;
begin begin
col := LongInt(PtrInt(arg)); col := LongInt({%H-}PtrInt(arg));
cell := PCell(data); cell := PCell(data);
if cell = nil then // This should not happen. Just to make sure... if cell = nil then // This should not happen. Just to make sure...
exit; exit;
@ -1832,7 +1832,7 @@ var
formula: TsRPNFormula; formula: TsRPNFormula;
i: Integer; i: Integer;
begin begin
row := LongInt(PtrInt(arg)); row := LongInt({%H-}PtrInt(arg));
cell := PCell(data); cell := PCell(data);
if cell = nil then // This should not happen. Just to make sure... if cell = nil then // This should not happen. Just to make sure...
exit; exit;
@ -5070,7 +5070,7 @@ begin
// Update column index of cell records // Update column index of cell records
cellnode := FCells.FindLowest; cellnode := FCells.FindLowest;
while Assigned(cellnode) do begin while Assigned(cellnode) do begin
DeleteColCallback(cellnode.Data, pointer(PtrInt(ACol))); DeleteColCallback(cellnode.Data, {%H-}pointer(PtrInt(ACol)));
cellnode := FCells.FindSuccessor(cellnode); cellnode := FCells.FindSuccessor(cellnode);
end; end;
@ -5159,7 +5159,7 @@ begin
// Update row index of cell reocrds // Update row index of cell reocrds
cellnode := FCells.FindLowest; cellnode := FCells.FindLowest;
while Assigned(cellnode) do begin while Assigned(cellnode) do begin
DeleteRowCallback(cellnode.Data, pointer(PtrInt(ARow))); DeleteRowCallback(cellnode.Data, {%H-}pointer(PtrInt(ARow)));
cellnode := FCells.FindSuccessor(cellnode); cellnode := FCells.FindSuccessor(cellnode);
end; end;
@ -5208,7 +5208,7 @@ begin
// Update column index of cell records // Update column index of cell records
cellnode := FCells.FindLowest; cellnode := FCells.FindLowest;
while Assigned(cellnode) do begin while Assigned(cellnode) do begin
InsertColCallback(cellnode.Data, pointer(PtrInt(ACol))); InsertColCallback(cellnode.Data, {%H-}pointer(PtrInt(ACol)));
cellnode := FCells.FindSuccessor(cellnode); cellnode := FCells.FindSuccessor(cellnode);
end; end;
@ -5260,7 +5260,7 @@ var
formula: TsRPNFormula; formula: TsRPNFormula;
i: Integer; i: Integer;
begin begin
col := LongInt(PtrInt(arg)); col := LongInt({%H-}PtrInt(arg));
cell := PCell(data); cell := PCell(data);
if cell = nil then // This should not happen. Just to make sure... if cell = nil then // This should not happen. Just to make sure...
exit; exit;
@ -5319,7 +5319,7 @@ begin
// Update row index of cell records // Update row index of cell records
cellnode := FCells.FindLowest; cellnode := FCells.FindLowest;
while Assigned(cellnode) do begin while Assigned(cellnode) do begin
InsertRowCallback(cellnode.Data, pointer(PtrInt(ARow))); InsertRowCallback(cellnode.Data, {%H-}pointer(PtrInt(ARow)));
cellnode := FCells.FindSuccessor(cellnode); cellnode := FCells.FindSuccessor(cellnode);
end; end;
@ -5369,7 +5369,7 @@ var
i: Integer; i: Integer;
formula: TsRPNFormula; formula: TsRPNFormula;
begin begin
row := LongInt(PtrInt(arg)); row := LongInt({%H-}PtrInt(arg));
cell := PCell(data); cell := PCell(data);
// Update row index of moved cells // Update row index of moved cells

View File

@ -152,24 +152,24 @@ begin
// First calculate the cell position // First calculate the cell position
if XSelectionDirection = fpsVerticalSelection then if XSelectionDirection = fpsVerticalSelection then
begin begin
XRow := FXFirstCellRow + AIndex; XRow := Integer(FXFirstCellRow) + AIndex;
XCol := FXFirstCellCol; XCol := FXFirstCellCol;
end end
else else
begin begin
XRow := FXFirstCellRow; XRow := FXFirstCellRow;
XCol := FXFirstCellCol + AIndex; XCol := Integer(FXFirstCellCol) + AIndex;
end; end;
if YSelectionDirection = fpsVerticalSelection then if YSelectionDirection = fpsVerticalSelection then
begin begin
YRow := FYFirstCellRow + AIndex; YRow := Integer(FYFirstCellRow) + AIndex;
YCol := FYFirstCellCol; YCol := FYFirstCellCol;
end end
else else
begin begin
YRow := FYFirstCellRow; YRow := FYFirstCellRow;
YCol := FYFirstCellCol + AIndex; YCol := Integer(FYFirstCellCol) + AIndex;
end; end;
// Check the corresponding cell, if it is empty, use zero // Check the corresponding cell, if it is empty, use zero

View File

@ -184,10 +184,10 @@ type
procedure EditingDone; override; procedure EditingDone; override;
procedure EndUpdate; procedure EndUpdate;
procedure GetSheets(const ASheets: TStrings); procedure GetSheets(const ASheets: TStrings);
function GetGridCol(ASheetCol: Cardinal): Integer; function GetGridCol(ASheetCol: Cardinal): Integer; inline;
function GetGridRow(ASheetRow: Cardinal): Integer; function GetGridRow(ASheetRow: Cardinal): Integer; inline;
function GetWorksheetCol(AGridCol: Integer): Cardinal; function GetWorksheetCol(AGridCol: Integer): Cardinal; inline;
function GetWorksheetRow(AGridRow: Integer): Cardinal; function GetWorksheetRow(AGridRow: Integer): Cardinal; inline;
procedure InsertCol(AGridCol: Integer); procedure InsertCol(AGridCol: Integer);
procedure InsertRow(AGridRow: Integer); procedure InsertRow(AGridRow: Integer);
procedure LoadFromSpreadsheetFile(AFileName: string; procedure LoadFromSpreadsheetFile(AFileName: string;
@ -619,7 +619,7 @@ end;
function WrapText(ACanvas: TCanvas; const AText: string; AMaxWidth: integer): string; function WrapText(ACanvas: TCanvas; const AText: string; AMaxWidth: integer): string;
var var
DC: HDC; DC: HDC;
textExtent: TSize; textExtent: TSize = (cx:0; cy:0);
S, P, E: PChar; S, P, E: PChar;
line: string; line: string;
isFirstLine: boolean; isFirstLine: boolean;
@ -1007,6 +1007,7 @@ procedure TsCustomWorksheetGrid.ChangedFontHandler(ASender: TObject;
ARow, ACol: Cardinal); ARow, ACol: Cardinal);
var var
lRow: PRow; lRow: PRow;
gr: Integer; // row index in grid units
begin begin
Unused(ASender, ACol); Unused(ASender, ACol);
if (FWorksheet <> nil) then begin if (FWorksheet <> nil) then begin
@ -1014,8 +1015,8 @@ begin
if lRow = nil then begin if lRow = nil then begin
// There is no row record --> row height changes according to font height // There is no row record --> row height changes according to font height
// Otherwise the row height would be fixed according to the value in the row record. // Otherwise the row height would be fixed according to the value in the row record.
ARow := ARow + FHeaderCount; // convert row index to grid units gr := GetGridRow(ARow); // convert row index to grid units
RowHeights[ARow] := CalcAutoRowHeight(ARow); RowHeights[gr] := CalcAutoRowHeight(gr);
end; end;
Invalidate; Invalidate;
end; end;
@ -1337,8 +1338,8 @@ begin
begin begin
if (uffBorder in cell^.UsedFormattingFields) then if (uffBorder in cell^.UsedFormattingFields) then
begin begin
c := cell^.Col + FHeaderCount; c := GetGridCol(cell^.Col);
r := cell^.Row + FHeaderCount; r := GetGridRow(cell^.Row);
rect := CellRect(c, r); rect := CellRect(c, r);
DrawCellBorders(c, r, rect); DrawCellBorders(c, r, rect);
end; end;
@ -1560,7 +1561,7 @@ var
rct, saved_rct, temp_rct: TRect; rct, saved_rct, temp_rct: TRect;
clipArea: Trect; clipArea: Trect;
cell: PCell; cell: PCell;
tmp: Integer; tmp: Integer = 0;
function IsPushCellActive: boolean; function IsPushCellActive: boolean;
begin begin
@ -1734,7 +1735,7 @@ begin
FWorksheet.FindMergedRange(FDrawingCell, sr1, sc1, sr2, sc2); FWorksheet.FindMergedRange(FDrawingCell, sr1, sc1, sr2, sc2);
gr := GetGridRow(sr1); gr := GetGridRow(sr1);
ColRowToOffSet(False, True, gr, rct.Top, tmp); ColRowToOffSet(False, True, gr, rct.Top, tmp);
ColRowToOffSet(False, True, gr + sr2 - sr1, tmp, rct.Bottom); ColRowToOffSet(False, True, gr + integer(sr2) - integer(sr1), tmp, rct.Bottom);
gc := GetGridCol(sc1); gc := GetGridCol(sc1);
gcNext := gc + (sc2 - sc1) + 1; gcNext := gc + (sc2 - sc1) + 1;
end; end;
@ -2656,7 +2657,7 @@ begin
if AGridCol < FHeaderCount then if AGridCol < FHeaderCount then
exit; exit;
if FWorksheet.GetLastColIndex + 1 + FHeaderCount >= FInitColCount then if LongInt(FWorksheet.GetLastColIndex) + 1 + FHeaderCount >= FInitColCount then
ColCount := ColCount + 1; ColCount := ColCount + 1;
c := AGridCol - FHeaderCount; c := AGridCol - FHeaderCount;
FWorksheet.InsertCol(c); FWorksheet.InsertCol(c);
@ -2674,7 +2675,7 @@ begin
if AGridRow < FHeaderCount then if AGridRow < FHeaderCount then
exit; exit;
if FWorksheet.GetlastRowIndex+1 + FHeaderCount >= FInitRowCount then if LongInt(FWorksheet.GetlastRowIndex) + 1 + FHeaderCount >= FInitRowCount then
RowCount := RowCount + 1; RowCount := RowCount + 1;
r := AGridRow - FHeaderCount; r := AGridRow - FHeaderCount;
FWorksheet.InsertRow(r); FWorksheet.InsertRow(r);
@ -2720,7 +2721,8 @@ var
i: Integer; i: Integer;
L: TStrings; L: TStrings;
wrapped: Boolean; wrapped: Boolean;
pLeft, pRight: Integer; pLeft: Integer = 0;
pRight: Integer = 0;
begin begin
wrapped := ATextWrap or (ATextRot = rtStacked); wrapped := ATextWrap or (ATextRot = rtStacked);
if AMeasureText = '' then txt := AText else txt := AMeasureText; if AMeasureText = '' then txt := AText else txt := AMeasureText;
@ -2794,7 +2796,7 @@ begin
begin begin
// Special treatment for overflowing cells: they must be centered // Special treatment for overflowing cells: they must be centered
// at their original column, not in the total enclosing rectangle. // at their original column, not in the total enclosing rectangle.
ColRowToOffset(true, true, FDrawingCell^.Col + FHeaderCount, pLeft, pRight); ColRowToOffset(true, true, integer(FDrawingCell^.Col) + FHeaderCount, pLeft, pRight);
P.X := (pLeft + pRight - w) div 2; P.X := (pLeft + pRight - w) div 2;
P.y := ARect.Top; P.y := ARect.Top;
ts.Alignment := taLeftJustify; ts.Alignment := taLeftJustify;
@ -3148,8 +3150,8 @@ begin
end else end else
if FWorksheet <> nil then begin if FWorksheet <> nil then begin
Convert_sFont_to_Font(FWorkbook.GetDefaultFont, Font); Convert_sFont_to_Font(FWorkbook.GetDefaultFont, Font);
ColCount := Max(FWorksheet.GetLastColIndex + 1 + FHeaderCount, FInitColCount); ColCount := Max(integer(FWorksheet.GetLastColIndex) + 1 + FHeaderCount, FInitColCount);
RowCount := Max(FWorksheet.GetLastRowIndex + 1 + FHeaderCount, FInitRowCount); RowCount := Max(integer(FWorksheet.GetLastRowIndex) + 1 + FHeaderCount, FInitRowCount);
FixedCols := FFrozenCols + FHeaderCount; FixedCols := FFrozenCols + FHeaderCount;
FixedRows := FFrozenRows + FHeaderCount; FixedRows := FFrozenRows + FHeaderCount;
if ShowHeaders then begin if ShowHeaders then begin

View File

@ -148,6 +148,7 @@ procedure AppendToStream(AStream: TStream; const AString1, AString2, AString3: S
function PosInMemory(AMagic: QWord; ABuffer: PByteArray; ABufSize: Integer): Integer; function PosInMemory(AMagic: QWord; ABuffer: PByteArray; ABufSize: Integer): Integer;
{ For silencing the compiler... }
procedure Unused(const A1); procedure Unused(const A1);
procedure Unused(const A1, A2); procedure Unused(const A1, A2);
procedure Unused(const A1, A2, A3); procedure Unused(const A1, A2, A3);
@ -2166,11 +2167,11 @@ begin
// set up magic numbers // set up magic numbers
if L < 128 if L < 128
then begin then begin
n2 := L + Integer(L * S) div 255; n2 := Integer(L) + Integer(L) * S div 255;
n1 := 2 * L - n2; n1 := 2 * L - n2;
end end
else begin else begin
n2 := S + L - Integer(L * S) div 255; n2 := Integer(S) + L - Integer(L) * S div 255;
n1 := 2 * L - n2 - 1; n1 := 2 * L - n2 - 1;
end; end;

View File

@ -336,7 +336,8 @@ Type
Protected Protected
Procedure CloseInput(Item : TZipFileEntry); Procedure CloseInput(Item : TZipFileEntry);
Procedure StartZipFile(Item : TZipFileEntry); Procedure StartZipFile(Item : TZipFileEntry);
Function UpdateZipHeader(Item : TZipFileEntry; FZip : TStream; ACRC : LongWord;AMethod : Word) : Boolean; Function UpdateZipHeader(Item : TZipFileEntry; FZip : TStream;
ACRC : LongWord;AMethod : Word) : Boolean;
Procedure BuildZipDirectory; Procedure BuildZipDirectory;
Procedure DoEndOfFile; Procedure DoEndOfFile;
Procedure ZipOneFile(Item : TZipFileEntry); virtual; Procedure ZipOneFile(Item : TZipFileEntry); virtual;
@ -344,7 +345,8 @@ Type
Procedure GetFileInfo; Procedure GetFileInfo;
Procedure SetBufSize(Value : LongWord); Procedure SetBufSize(Value : LongWord);
Procedure SetFileName(Value : String); Procedure SetFileName(Value : String);
Function CreateCompressor(Item : TZipFileEntry; AinFile,AZipStream : TStream) : TCompressor; virtual; Function CreateCompressor({%H-}Item : TZipFileEntry;
AinFile,AZipStream : TStream) : TCompressor; virtual;
Public Public
Constructor Create; Constructor Create;
Destructor Destroy;override; Destructor Destroy;override;
@ -430,7 +432,7 @@ Type
Procedure SetBufSize(Value : LongWord); Procedure SetBufSize(Value : LongWord);
Procedure SetFileName(Value : String); Procedure SetFileName(Value : String);
Procedure SetOutputPath(Value:String); Procedure SetOutputPath(Value:String);
Function CreateDeCompressor(Item : TZipFileEntry; AMethod : Word;AZipFile,AOutFile : TStream) : TDeCompressor; virtual; Function CreateDeCompressor({%H-}Item : TZipFileEntry; AMethod : Word;AZipFile,AOutFile : TStream) : TDeCompressor; virtual;
Public Public
Constructor Create; Constructor Create;
Destructor Destroy;override; Destructor Destroy;override;
@ -649,7 +651,8 @@ end;
Procedure TDeCompressor.UpdC32(Octet: Byte); Procedure TDeCompressor.UpdC32(Octet: Byte);
Begin Begin
FCrc32Val := Crc_32_Tab[Byte(FCrc32Val XOR LongInt(Octet))] XOR ((FCrc32Val SHR 8) AND $00FFFFFF); FCrc32Val := Crc_32_Tab[Byte(FCrc32Val XOR LongWord(Octet))] XOR
((FCrc32Val SHR 8) AND $00FFFFFF);
end; end;
constructor TDeCompressor.Create(AInFile, AOutFile: TStream; ABufSize: LongWord); constructor TDeCompressor.Create(AInFile, AOutFile: TStream; ABufSize: LongWord);
@ -669,7 +672,8 @@ end;
Procedure TCompressor.UpdC32(Octet: Byte); Procedure TCompressor.UpdC32(Octet: Byte);
Begin Begin
FCrc32Val := Crc_32_Tab[Byte(FCrc32Val XOR LongInt(Octet))] XOR ((FCrc32Val SHR 8) AND $00FFFFFF); FCrc32Val := Crc_32_Tab[Byte(FCrc32Val XOR LongWord(Octet))] XOR
((FCrc32Val SHR 8) AND $00FFFFFF);
end; end;
constructor TCompressor.Create(AInFile, AOutFile: TStream; ABufSize: LongWord); constructor TCompressor.Create(AInFile, AOutFile: TStream; ABufSize: LongWord);
@ -1728,7 +1732,7 @@ Begin
NewNode.Attributes := External_Attributes; NewNode.Attributes := External_Attributes;
ZipDateTimeToDateTime(Last_Mod_Date,Last_Mod_Time,D); ZipDateTimeToDateTime(Last_Mod_Date,Last_Mod_Time,D);
NewNode.DateTime:=D; NewNode.DateTime:=D;
FZipStream.Seek(Extra_Field_Length+File_Comment_Length, soCurrent); FZipStream.Seek(Int64(Extra_Field_Length)+File_Comment_Length, soCurrent);
end; end;
end; end;
end; end;
@ -1746,7 +1750,7 @@ end;
Procedure TUnZipper.UnZipOneFile(Item : TFullZipFileEntry); Procedure TUnZipper.UnZipOneFile(Item : TFullZipFileEntry);
Var Var
Count, Attrs: Longint; {%H-}Count, Attrs: Longint;
ZMethod : Word; ZMethod : Word;
//LinkTargetStream: TStringStream; //LinkTargetStream: TStringStream;
OutputFileName: string; OutputFileName: string;

View File

@ -74,7 +74,7 @@ protected
public public
procedure AddInheritedPath(const APath: UTF8String); procedure AddInheritedPath(const APath: UTF8String);
function Extract(index: integer): TVirtualLayer_Item; function Extract(index: integer): TVirtualLayer_Item;
procedure Sort(const Ascending: Boolean=true;const FoldersFirst: Boolean=true); procedure Sort(const {%H-}Ascending: Boolean=true;const {%H-}FoldersFirst: Boolean=true);
procedure Delete(const Index: integer); procedure Delete(const Index: integer);
property Path: UTF8String read FPath; property Path: UTF8String read FPath;
property Items[index: integer]:TVirtualLayer_Item read GetItems write SetItems; default; property Items[index: integer]:TVirtualLayer_Item read GetItems write SetItems; default;

View File

@ -571,6 +571,7 @@ begin
ReadRowColXF(AStream, ARow, ACol, XF); ReadRowColXF(AStream, ARow, ACol, XF);
{ Result of the formula result in IEEE 754 floating-point value } { Result of the formula result in IEEE 754 floating-point value }
Data[0] := 0; // to silence the compiler...
AStream.ReadBuffer(Data, Sizeof(Data)); AStream.ReadBuffer(Data, Sizeof(Data));
{ Recalculation byte - currently not used } { Recalculation byte - currently not used }
@ -644,6 +645,7 @@ var
cell: PCell; cell: PCell;
begin begin
{ Read entire record, starting at Row, except for string data } { Read entire record, starting at Row, except for string data }
rec.Row := 0; // to silence the compiler...
AStream.ReadBuffer(rec.Row, SizeOf(TBIFF2LabelRecord) - 2*SizeOf(Word)); AStream.ReadBuffer(rec.Row, SizeOf(TBIFF2LabelRecord) - 2*SizeOf(Word));
ARow := WordLEToN(rec.Row); ARow := WordLEToN(rec.Row);
ACol := WordLEToN(rec.Col); ACol := WordLEToN(rec.Col);
@ -694,6 +696,7 @@ var
cell: PCell; cell: PCell;
begin begin
{ Read entire record, starting at Row } { Read entire record, starting at Row }
rec.Row := 0; // to silence the compiler...
AStream.ReadBuffer(rec.Row, SizeOf(TBIFF2NumberRecord) - 2*SizeOf(Word)); AStream.ReadBuffer(rec.Row, SizeOf(TBIFF2NumberRecord) - 2*SizeOf(Word));
ARow := WordLEToN(rec.Row); ARow := WordLEToN(rec.Row);
ACol := WordLEToN(rec.Col); ACol := WordLEToN(rec.Col);
@ -729,6 +732,8 @@ var
cell: PCell; cell: PCell;
rec: TBIFF2IntegerRecord; rec: TBIFF2IntegerRecord;
begin begin
{ Read record into buffer }
rec.Row := 0; // to silence the comiler...
AStream.ReadBuffer(rec.Row, SizeOf(TBIFF2NumberRecord) - 2*SizeOf(Word)); AStream.ReadBuffer(rec.Row, SizeOf(TBIFF2NumberRecord) - 2*SizeOf(Word));
ARow := WordLEToN(rec.Row); ARow := WordLEToN(rec.Row);
ACol := WordLEToN(rec.Col); ACol := WordLEToN(rec.Col);
@ -781,6 +786,7 @@ var
lRow: PRow; lRow: PRow;
h: word; h: word;
begin begin
rowRec.RowIndex := 0; // to silence the compiler...
AStream.ReadBuffer(rowrec, SizeOf(TRowRecord)); AStream.ReadBuffer(rowrec, SizeOf(TRowRecord));
h := WordLEToN(rowrec.Height); h := WordLEToN(rowrec.Height);
if h and $8000 = 0 then begin // if this bit were set, rowheight would be default if h and $8000 = 0 then begin // if this bit were set, rowheight would be default
@ -921,6 +927,8 @@ var
xf: TXFRecord; xf: TXFRecord;
b: Byte; b: Byte;
begin begin
// Read entire xf record into buffer
xf.FontIndex := 0; // to silence the compiler...
AStream.ReadBuffer(xf, SizeOf(xf)); AStream.ReadBuffer(xf, SizeOf(xf));
lData := TXFListData.Create; lData := TXFListData.Create;

View File

@ -1250,6 +1250,7 @@ begin
{ Sheet name: Byte string, 8-bit length } { Sheet name: Byte string, 8-bit length }
Len := AStream.ReadByte(); Len := AStream.ReadByte();
Str[0] := #0; // to silence the compiler...
AStream.ReadBuffer(Str, Len); AStream.ReadBuffer(Str, Len);
Str[Len] := #0; Str[Len] := #0;
@ -1376,6 +1377,9 @@ var
dw: DWord; dw: DWord;
fill: Word; fill: Word;
begin begin
xf.FontIndex := 0; // to silence the compiler...
// Read the complete xf record into a buffer
AStream.ReadBuffer(xf, SizeOf(xf)); AStream.ReadBuffer(xf, SizeOf(xf));
lData := TXFListData.Create; lData := TXFListData.Create;
@ -1499,7 +1503,7 @@ end;
procedure TsSpreadBIFF5Reader.ReadFont(const AStream: TStream); procedure TsSpreadBIFF5Reader.ReadFont(const AStream: TStream);
var var
lCodePage: Word; {%H-}lCodePage: Word;
lHeight: Word; lHeight: Word;
lOptions: Word; lOptions: Word;
lColor: Word; lColor: Word;
@ -1593,6 +1597,8 @@ var
cell: PCell; cell: PCell;
AValue: ansistring; AValue: ansistring;
begin begin
rec.Row := 0; // to silence the compiler...
{ Read entire record, starting at Row, except for string data } { Read entire record, starting at Row, except for string data }
AStream.ReadBuffer(rec.Row, SizeOf(TBIFF5LabelRecord) - 2*SizeOf(Word)); AStream.ReadBuffer(rec.Row, SizeOf(TBIFF5LabelRecord) - 2*SizeOf(Word));
ARow := WordLEToN(rec.Row); ARow := WordLEToN(rec.Row);

View File

@ -1001,10 +1001,10 @@ begin
// Loop writing the merged cell ranges // Loop writing the merged cell ranges
while (n > 0) and (i < Length(rngList)) do begin while (n > 0) and (i < Length(rngList)) do begin
AStream.WriteWord(WordToLE(Lo(rngList[i].Row1))); AStream.WriteWord(WordToLE({%H-}Lo(rngList[i].Row1)));
AStream.WriteWord(WordToLE(Lo(rngList[i].Row2))); AStream.WriteWord(WordToLE({%H-}Lo(rngList[i].Row2)));
AStream.WriteWord(WordToLE(Lo(rngList[i].Col1))); AStream.WriteWord(WordToLE({%H-}Lo(rngList[i].Col1)));
AStream.WriteWord(WordToLE(Lo(rngList[i].Col2))); AStream.WriteWord(WordToLE({%H-}Lo(rngList[i].Col2)));
inc(i); inc(i);
dec(n); dec(n);
end; end;
@ -1617,6 +1617,8 @@ var
rng: packed record Row1, Row2, Col1, Col2: Word; end; rng: packed record Row1, Row2, Col1, Col2: Word; end;
i, n: word; i, n: word;
begin begin
rng.Row1 := 0; // to silence the compiler...
// Count of merged ranges // Count of merged ranges
n := WordLEToN(AStream.ReadWord); n := WordLEToN(AStream.ReadWord);
@ -1848,6 +1850,8 @@ var
rec: TBIFF8LabelSSTRecord; rec: TBIFF8LabelSSTRecord;
cell: PCell; cell: PCell;
begin begin
rec.Row := 0; // to silence the compiler...
{ Read entire record, starting at Row } { Read entire record, starting at Row }
AStream.ReadBuffer(rec.Row, SizeOf(TBIFF8LabelSSTRecord) - 2*SizeOf(Word)); AStream.ReadBuffer(rec.Row, SizeOf(TBIFF8LabelSSTRecord) - 2*SizeOf(Word));
ARow := WordLEToN(rec.Row); ARow := WordLEToN(rec.Row);
@ -1930,6 +1934,9 @@ var
dw: DWord; dw: DWord;
fill: Integer; fill: Integer;
begin begin
xf.FontIndex := 0; // to silence the compiler...
// Read entire xf record into a buffer
AStream.ReadBuffer(xf, SizeOf(xf)); AStream.ReadBuffer(xf, SizeOf(xf));
lData := TXFListData.Create; lData := TXFListData.Create;
@ -2025,7 +2032,7 @@ end;
procedure TsSpreadBIFF8Reader.ReadFont(const AStream: TStream); procedure TsSpreadBIFF8Reader.ReadFont(const AStream: TStream);
var var
lCodePage: Word; {%H-}lCodePage: Word;
lHeight: Word; lHeight: Word;
lOptions: Word; lOptions: Word;
lColor: Word; lColor: Word;

View File

@ -808,6 +808,9 @@ var
rec: TBIFF58BlankRecord; rec: TBIFF58BlankRecord;
cell: PCell; cell: PCell;
begin begin
rec.Row := 0; // to silence the compiler...
// Read entire record into a buffer
AStream.ReadBuffer(rec.Row, SizeOf(TBIFF58BlankRecord) - 2*SizeOf(Word)); AStream.ReadBuffer(rec.Row, SizeOf(TBIFF58BlankRecord) - 2*SizeOf(Word));
ARow := WordLEToN(rec.Row); ARow := WordLEToN(rec.Row);
ACol := WordLEToN(rec.Col); ACol := WordLEToN(rec.Col);
@ -980,6 +983,7 @@ begin
ReadRowColXF(AStream, ARow, ACol, XF); ReadRowColXF(AStream, ARow, ACol, XF);
{ Result of the formula result in IEEE 754 floating-point value } { Result of the formula result in IEEE 754 floating-point value }
Data[0] := 0; // to silence the compiler...
AStream.ReadBuffer(Data, Sizeof(Data)); AStream.ReadBuffer(Data, Sizeof(Data));
{ Options flags } { Options flags }
@ -1145,6 +1149,7 @@ var
cell: PCell; cell: PCell;
begin begin
{ Read entire record, starting at Row } { Read entire record, starting at Row }
rec.Row := 0; // to silence the compiler...
AStream.ReadBuffer(rec.Row, SizeOf(TBIFF58NumberRecord) - 2*SizeOf(Word)); AStream.ReadBuffer(rec.Row, SizeOf(TBIFF58NumberRecord) - 2*SizeOf(Word));
ARow := WordLEToN(rec.Row); ARow := WordLEToN(rec.Row);
ACol := WordLEToN(rec.Col); ACol := WordLEToN(rec.Col);
@ -1287,6 +1292,7 @@ var
lRow: PRow; lRow: PRow;
h: word; h: word;
begin begin
rowrec.RowIndex := 0; // to silence the compiler...
AStream.ReadBuffer(rowrec, SizeOf(TRowRecord)); AStream.ReadBuffer(rowrec, SizeOf(TRowRecord));
// if bit 6 is set in the flags row height does not match the font size. // if bit 6 is set in the flags row height does not match the font size.
@ -1618,7 +1624,7 @@ end;
stored only in the top/left cell of the range. } stored only in the top/left cell of the range. }
procedure TsSpreadBIFFReader.ReadSharedFormula(AStream: TStream); procedure TsSpreadBIFFReader.ReadSharedFormula(AStream: TStream);
var var
r1, r2, c1, c2: Cardinal; r1, {%H-}r2, c1, {%H-}c2: Cardinal;
cell: PCell; cell: PCell;
begin begin
// Cell range in which the formula is valid // Cell range in which the formula is valid
@ -2358,6 +2364,8 @@ var
Data: array[0..3] of word; Data: array[0..3] of word;
FormulaResult: double; FormulaResult: double;
begin begin
Data[0] := 0; // to silence the compiler...
{ Determine encoded result bytes } { Determine encoded result bytes }
case ACell^.ContentType of case ACell^.ContentType of
cctNumber: cctNumber:
@ -2811,10 +2819,10 @@ begin
// Index to last row // Index to last row
AStream.WriteWord(WordToLE(ALastRow)); AStream.WriteWord(WordToLE(ALastRow));
// Index to first column // Index to first column
c := Lo(AFirstCol); c := {%H-}Lo(AFirstCol);
AStream.WriteByte(Lo(c)); AStream.WriteByte(Lo(c));
// Index to last rcolumn // Index to last rcolumn
c := Lo(ALastCol); c := {%H-}Lo(ALastCol);
AStream.WriteByte(Lo(c)); AStream.WriteByte(Lo(c));
end; end;

View File

@ -666,7 +666,7 @@ begin
begin begin
s := GetAttrValue(datanode, 'si'); s := GetAttrValue(datanode, 'si');
if s <> '' then if s <> '' then
FSharedFormulas.AddObject(addr, Pointer(PtrInt(StrToInt(s)))); FSharedFormulas.AddObject(addr, {%H-}Pointer(PtrInt(StrToInt(s))));
FWorksheet.WriteFormula(cell, formulaStr); FWorksheet.WriteFormula(cell, formulaStr);
cell^.SharedFormulaBase := cell; cell^.SharedFormulaBase := cell;
//AWorksheet.WriteSharedFormula(s, formulaStr); //AWorksheet.WriteSharedFormula(s, formulaStr);
@ -675,7 +675,7 @@ begin
s := GetAttrValue(datanode, 'si'); s := GetAttrValue(datanode, 'si');
if s <> '' then if s <> '' then
begin begin
s := FSharedFormulas[FSharedFormulas.IndexOfObject(Pointer(PtrInt(StrToInt(s))))]; s := FSharedFormulas[FSharedFormulas.IndexOfObject({%H-}Pointer(PtrInt(StrToInt(s))))];
cell^.SharedFormulaBase := FWorksheet.FindCell(s); cell^.SharedFormulaBase := FWorksheet.FindCell(s);
end; end;
end; end;
@ -2705,7 +2705,7 @@ begin
'</c>', [ '</c>', [
CellPosText, lStyleIndex, t, CellPosText, lStyleIndex, t,
GetCellRangeString(ACell^.Row, ACell^.Col, r2, c2), GetCellRangeString(ACell^.Row, ACell^.Col, r2, c2),
PtrInt(ACell), // Use the cell pointer as ID of the shared formula {%H-}PtrInt(ACell), // Use the cell pointer as ID of the shared formula
PrepareFormula(ACell^.FormulaValue), PrepareFormula(ACell^.FormulaValue),
v v
])); ]));
@ -2717,7 +2717,7 @@ begin
'%s' + '%s' +
'</c>', [ '</c>', [
CellPosText, lStyleIndex, t, CellPosText, lStyleIndex, t,
PtrInt(ACell^.SharedFormulaBase), // ID of the shared formula {%H-}PtrInt(ACell^.SharedFormulaBase), // ID of the shared formula
v v
])); ]));
end else begin end else begin