You've already forked lazarus-ccr
fpspreadsheet: Add properties ShowGridLines, ShowHeaders, Selected to Worksheet to interface with fpSpreadsheetGrid. Read/write to xls file.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3002 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -40,6 +40,7 @@ begin
|
|||||||
MyWorkbook.UsePalette(@PALETTE_BIFF8, Length(PALETTE_BIFF8));
|
MyWorkbook.UsePalette(@PALETTE_BIFF8, Length(PALETTE_BIFF8));
|
||||||
|
|
||||||
MyWorksheet := MyWorkbook.AddWorksheet(Str_Worksheet1);
|
MyWorksheet := MyWorkbook.AddWorksheet(Str_Worksheet1);
|
||||||
|
MyWorksheet.ShowGridLines := false;
|
||||||
|
|
||||||
// Write some cells
|
// Write some cells
|
||||||
MyWorksheet.WriteNumber(0, 0, 1.0);// A1
|
MyWorksheet.WriteNumber(0, 0, 1.0);// A1
|
||||||
|
@ -127,11 +127,15 @@
|
|||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="mainform"/>
|
<UnitName Value="mainform"/>
|
||||||
|
<IsVisibleTab Value="True"/>
|
||||||
<EditorIndex Value="1"/>
|
<EditorIndex Value="1"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="43"/>
|
<TopLine Value="125"/>
|
||||||
<CursorPos X="38" Y="63"/>
|
<CursorPos X="68" Y="141"/>
|
||||||
<UsageCount Value="125"/>
|
<UsageCount Value="125"/>
|
||||||
|
<Bookmarks Count="1">
|
||||||
|
<Item0 X="1" Y="142" ID="1"/>
|
||||||
|
</Bookmarks>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
</Unit1>
|
</Unit1>
|
||||||
@ -148,11 +152,10 @@
|
|||||||
<Unit3>
|
<Unit3>
|
||||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||||
<UnitName Value="fpspreadsheetgrid"/>
|
<UnitName Value="fpspreadsheetgrid"/>
|
||||||
<IsVisibleTab Value="True"/>
|
|
||||||
<EditorIndex Value="3"/>
|
<EditorIndex Value="3"/>
|
||||||
<WindowIndex Value="0"/>
|
<WindowIndex Value="0"/>
|
||||||
<TopLine Value="400"/>
|
<TopLine Value="36"/>
|
||||||
<CursorPos X="63" Y="425"/>
|
<CursorPos X="3" Y="62"/>
|
||||||
<UsageCount Value="61"/>
|
<UsageCount Value="61"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit3>
|
</Unit3>
|
||||||
@ -314,9 +317,6 @@
|
|||||||
<TopLine Value="219"/>
|
<TopLine Value="219"/>
|
||||||
<CursorPos X="26" Y="233"/>
|
<CursorPos X="26" Y="233"/>
|
||||||
<UsageCount Value="19"/>
|
<UsageCount Value="19"/>
|
||||||
<Bookmarks Count="1">
|
|
||||||
<Item0 X="21" Y="544" ID="1"/>
|
|
||||||
</Bookmarks>
|
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit22>
|
</Unit22>
|
||||||
<Unit23>
|
<Unit23>
|
||||||
@ -372,123 +372,127 @@
|
|||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit28>
|
</Unit28>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="29" HistoryIndex="28">
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
<Caret Line="962" Column="1" TopLine="938"/>
|
<Caret Line="1040" Column="1" TopLine="1014"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
<Caret Line="968" Column="1" TopLine="938"/>
|
<Caret Line="1043" Column="1" TopLine="1014"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
<Caret Line="1034" Column="1" TopLine="1014"/>
|
<Caret Line="1044" Column="1" TopLine="1014"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
<Caret Line="1037" Column="1" TopLine="1014"/>
|
<Caret Line="1077" Column="19" TopLine="1064"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
<Caret Line="1040" Column="1" TopLine="1014"/>
|
<Caret Line="536" Column="32" TopLine="530"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
<Caret Line="1043" Column="1" TopLine="1014"/>
|
<Caret Line="124" Column="32" TopLine="97"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
<Caret Line="1044" Column="1" TopLine="1014"/>
|
<Caret Line="537" Column="24" TopLine="517"/>
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
<Caret Line="1077" Column="19" TopLine="1064"/>
|
<Caret Line="283" Column="14" TopLine="272"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
<Caret Line="536" Column="32" TopLine="530"/>
|
<Caret Line="124" Column="30" TopLine="104"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
<Caret Line="124" Column="32" TopLine="97"/>
|
<Caret Line="283" Column="9" TopLine="251"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
<Filename Value="d:\Prog_Delphi\common\units\XLS.pas"/>
|
||||||
<Caret Line="537" Column="24" TopLine="517"/>
|
<Caret Line="130" Column="20" TopLine="113"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
<Caret Line="283" Column="14" TopLine="272"/>
|
<Caret Line="290" Column="31" TopLine="238"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
<Caret Line="124" Column="30" TopLine="104"/>
|
<Caret Line="233" Column="26" TopLine="219"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
|
||||||
<Caret Line="283" Column="9" TopLine="251"/>
|
|
||||||
</Position14>
|
|
||||||
<Position15>
|
|
||||||
<Filename Value="d:\Prog_Delphi\common\units\XLS.pas"/>
|
|
||||||
<Caret Line="130" Column="20" TopLine="113"/>
|
|
||||||
</Position15>
|
|
||||||
<Position16>
|
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
|
||||||
<Caret Line="290" Column="31" TopLine="238"/>
|
|
||||||
</Position16>
|
|
||||||
<Position17>
|
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
|
||||||
<Caret Line="233" Column="26" TopLine="219"/>
|
|
||||||
</Position17>
|
|
||||||
<Position18>
|
|
||||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||||
<Caret Line="1993" Column="32" TopLine="1989"/>
|
<Caret Line="1993" Column="32" TopLine="1989"/>
|
||||||
</Position18>
|
</Position14>
|
||||||
<Position19>
|
<Position15>
|
||||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||||
<Caret Line="441" Column="5" TopLine="376"/>
|
<Caret Line="441" Column="5" TopLine="376"/>
|
||||||
</Position19>
|
</Position15>
|
||||||
<Position20>
|
<Position16>
|
||||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||||
<Caret Line="414" Column="1" TopLine="389"/>
|
<Caret Line="414" Column="1" TopLine="389"/>
|
||||||
</Position20>
|
</Position16>
|
||||||
<Position21>
|
<Position17>
|
||||||
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
|
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
|
||||||
<Caret Line="1226" Column="14" TopLine="1212"/>
|
<Caret Line="1226" Column="14" TopLine="1212"/>
|
||||||
|
</Position17>
|
||||||
|
<Position18>
|
||||||
|
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
|
||||||
|
<Caret Line="636" Column="3" TopLine="619"/>
|
||||||
|
</Position18>
|
||||||
|
<Position19>
|
||||||
|
<Filename Value="..\..\xlsbiff5.pas"/>
|
||||||
|
<Caret Line="1667" Column="95" TopLine="1637"/>
|
||||||
|
</Position19>
|
||||||
|
<Position20>
|
||||||
|
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||||
|
<Caret Line="2062" Column="79" TopLine="2048"/>
|
||||||
|
</Position20>
|
||||||
|
<Position21>
|
||||||
|
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||||
|
<Caret Line="418" Column="31" TopLine="374"/>
|
||||||
</Position21>
|
</Position21>
|
||||||
<Position22>
|
<Position22>
|
||||||
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
|
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
|
||||||
<Caret Line="636" Column="3" TopLine="619"/>
|
<Caret Line="586" Column="3" TopLine="570"/>
|
||||||
</Position22>
|
</Position22>
|
||||||
<Position23>
|
<Position23>
|
||||||
<Filename Value="..\..\xlsbiff5.pas"/>
|
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||||
<Caret Line="1667" Column="95" TopLine="1637"/>
|
<Caret Line="392" Column="6" TopLine="388"/>
|
||||||
</Position23>
|
</Position23>
|
||||||
<Position24>
|
<Position24>
|
||||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
|
||||||
<Caret Line="2062" Column="79" TopLine="2048"/>
|
<Caret Line="1226" Column="14" TopLine="1212"/>
|
||||||
</Position24>
|
</Position24>
|
||||||
<Position25>
|
<Position25>
|
||||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||||
<Caret Line="418" Column="31" TopLine="374"/>
|
<Caret Line="250" Column="38" TopLine="235"/>
|
||||||
</Position25>
|
</Position25>
|
||||||
<Position26>
|
<Position26>
|
||||||
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
|
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||||
<Caret Line="586" Column="3" TopLine="570"/>
|
<Caret Line="833" Column="3" TopLine="830"/>
|
||||||
</Position26>
|
</Position26>
|
||||||
<Position27>
|
<Position27>
|
||||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||||
<Caret Line="392" Column="6" TopLine="388"/>
|
<Caret Line="826" Column="3" TopLine="823"/>
|
||||||
</Position27>
|
</Position27>
|
||||||
<Position28>
|
<Position28>
|
||||||
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
|
<Filename Value="mainform.pas"/>
|
||||||
<Caret Line="1226" Column="14" TopLine="1212"/>
|
<Caret Line="53" Column="17" TopLine="67"/>
|
||||||
</Position28>
|
</Position28>
|
||||||
<Position29>
|
<Position29>
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
<Filename Value="mainform.pas"/>
|
||||||
<Caret Line="250" Column="38" TopLine="235"/>
|
<Caret Line="142" Column="1" TopLine="129"/>
|
||||||
</Position29>
|
</Position29>
|
||||||
|
<Position30>
|
||||||
|
<Filename Value="mainform.pas"/>
|
||||||
|
<Caret Line="33" Column="1" TopLine="33"/>
|
||||||
|
</Position30>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -138,6 +138,7 @@ begin
|
|||||||
AFilename,
|
AFilename,
|
||||||
GetFileFormatName(sWorksheetGrid1.Workbook.FileFormat)
|
GetFileFormatName(sWorksheetGrid1.Workbook.FileFormat)
|
||||||
]);
|
]);
|
||||||
|
CbDisplayGrid.Checked := sWorksheetGrid1.Worksheet.ShowGridLines;
|
||||||
|
|
||||||
// Create a tab in the pagecontrol for each worksheet contained in the workbook
|
// Create a tab in the pagecontrol for each worksheet contained in the workbook
|
||||||
// This would be easer with a TTabControl. This has display issues, though.
|
// This would be easer with a TTabControl. This has display issues, though.
|
||||||
|
@ -315,6 +315,9 @@ type
|
|||||||
FCells: TAvlTree; // Items are TCell
|
FCells: TAvlTree; // Items are TCell
|
||||||
FCurrentNode: TAVLTreeNode; // For GetFirstCell and GetNextCell
|
FCurrentNode: TAVLTreeNode; // For GetFirstCell and GetNextCell
|
||||||
FRows, FCols: TIndexedAVLTree; // This lists contain only rows or cols with styles different from the standard
|
FRows, FCols: TIndexedAVLTree; // This lists contain only rows or cols with styles different from the standard
|
||||||
|
FShowGridLines: Boolean;
|
||||||
|
FShowHeaders: Boolean;
|
||||||
|
FSelected: Boolean;
|
||||||
procedure RemoveCallback(data, arg: pointer);
|
procedure RemoveCallback(data, arg: pointer);
|
||||||
public
|
public
|
||||||
Name: string;
|
Name: string;
|
||||||
@ -384,6 +387,10 @@ type
|
|||||||
property Cols: TIndexedAVLTree read FCols;
|
property Cols: TIndexedAVLTree read FCols;
|
||||||
property Rows: TIndexedAVLTree read FRows;
|
property Rows: TIndexedAVLTree read FRows;
|
||||||
property Workbook: TsWorkbook read FWorkbook;
|
property Workbook: TsWorkbook read FWorkbook;
|
||||||
|
// These are properties to interface to fpspreadsheetgrid.
|
||||||
|
property ShowGridLines: Boolean read FShowGridLines write FShowGridLines;
|
||||||
|
property ShowHeaders: Boolean read FShowHeaders write FShowHeaders;
|
||||||
|
property Selected: Boolean read FSelected write FSelected;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TsWorkbook }
|
{ TsWorkbook }
|
||||||
|
@ -813,6 +813,10 @@ begin
|
|||||||
RowHeights[i] := DefaultRowHeight;
|
RowHeights[i] := DefaultRowHeight;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
if FWorksheet.ShowGridLines then
|
||||||
|
Options := Options + [goHorzLine, goVertLine]
|
||||||
|
else
|
||||||
|
Options := Options - [goHorzLine, goVertLine];
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for i:=0 to RowCount-1 do begin
|
for i:=0 to RowCount-1 do begin
|
||||||
|
@ -126,7 +126,7 @@ type
|
|||||||
const AFormula: TsRPNFormula; ACell: PCell); override;
|
const AFormula: TsRPNFormula; ACell: PCell); override;
|
||||||
procedure WriteStyle(AStream: TStream);
|
procedure WriteStyle(AStream: TStream);
|
||||||
procedure WriteWindow1(AStream: TStream);
|
procedure WriteWindow1(AStream: TStream);
|
||||||
procedure WriteWindow2(AStream: TStream; ASheetSelected: Boolean);
|
procedure WriteWindow2(AStream: TStream; ASheet: TsWorksheet);
|
||||||
procedure WriteXF(AStream: TStream; AFontIndex: Word;
|
procedure WriteXF(AStream: TStream; AFontIndex: Word;
|
||||||
AFormatIndex: Word; AXF_TYPE_PROT, ATextRotation: Byte; ABorders: TsCellBorders;
|
AFormatIndex: Word; AXF_TYPE_PROT, ATextRotation: Byte; ABorders: TsCellBorders;
|
||||||
const ABorderStyles: TsCellBorderStyles; AHorAlignment: TsHorAlignment = haDefault;
|
const ABorderStyles: TsCellBorderStyles; AHorAlignment: TsHorAlignment = haDefault;
|
||||||
@ -230,8 +230,6 @@ const
|
|||||||
INT_EXCEL_ID_ROWINFO = $0208;
|
INT_EXCEL_ID_ROWINFO = $0208;
|
||||||
INT_EXCEL_ID_STYLE = $0293;
|
INT_EXCEL_ID_STYLE = $0293;
|
||||||
INT_EXCEL_ID_WINDOW1 = $003D;
|
INT_EXCEL_ID_WINDOW1 = $003D;
|
||||||
INT_EXCEL_ID_WINDOW2 = $023E;
|
|
||||||
INT_EXCEL_ID_XF = $00E0;
|
|
||||||
INT_EXCEL_ID_RSTRING = $00D6;
|
INT_EXCEL_ID_RSTRING = $00D6;
|
||||||
INT_EXCEL_ID_RK = $027E;
|
INT_EXCEL_ID_RK = $027E;
|
||||||
INT_EXCEL_ID_MULRK = $00BD;
|
INT_EXCEL_ID_MULRK = $00BD;
|
||||||
@ -291,19 +289,6 @@ const
|
|||||||
MASK_WINDOW1_OPTION_VERT_SCROLL_VISIBLE = $0010;
|
MASK_WINDOW1_OPTION_VERT_SCROLL_VISIBLE = $0010;
|
||||||
MASK_WINDOW1_OPTION_WORKSHEET_TAB_VISIBLE = $0020;
|
MASK_WINDOW1_OPTION_WORKSHEET_TAB_VISIBLE = $0020;
|
||||||
|
|
||||||
{ WINDOW2 record constants }
|
|
||||||
MASK_WINDOW2_OPTION_SHOW_FORMULAS = $0001;
|
|
||||||
MASK_WINDOW2_OPTION_SHOW_GRID_LINES = $0002;
|
|
||||||
MASK_WINDOW2_OPTION_SHOW_SHEET_HEADERS = $0004;
|
|
||||||
MASK_WINDOW2_OPTION_PANES_ARE_FROZEN = $0008;
|
|
||||||
MASK_WINDOW2_OPTION_SHOW_ZERO_VALUES = $0010;
|
|
||||||
MASK_WINDOW2_OPTION_AUTO_GRIDLINE_COLOR = $0020;
|
|
||||||
MASK_WINDOW2_OPTION_COLUMNS_RIGHT_TO_LEFT = $0040;
|
|
||||||
MASK_WINDOW2_OPTION_SHOW_OUTLINE_SYMBOLS = $0080;
|
|
||||||
MASK_WINDOW2_OPTION_REMOVE_SPLITS_ON_UNFREEZE = $0100;
|
|
||||||
MASK_WINDOW2_OPTION_SHEET_SELECTED = $0200;
|
|
||||||
MASK_WINDOW2_OPTION_SHEET_ACTIVE = $0400;
|
|
||||||
|
|
||||||
{ XF substructures }
|
{ XF substructures }
|
||||||
|
|
||||||
{ XF substructures --- see xlscommon! }
|
{ XF substructures --- see xlscommon! }
|
||||||
@ -426,7 +411,7 @@ begin
|
|||||||
WriteIndex(AStream);
|
WriteIndex(AStream);
|
||||||
WriteColInfos(AStream, sheet);
|
WriteColInfos(AStream, sheet);
|
||||||
WriteDimensions(AStream, sheet);
|
WriteDimensions(AStream, sheet);
|
||||||
WriteWindow2(AStream, True);
|
WriteWindow2(AStream, sheet);
|
||||||
WriteCellsToStream(AStream, sheet.Cells);
|
WriteCellsToStream(AStream, sheet.Cells);
|
||||||
WriteEOF(AStream);
|
WriteEOF(AStream);
|
||||||
end;
|
end;
|
||||||
@ -1017,7 +1002,7 @@ end;
|
|||||||
*
|
*
|
||||||
*******************************************************************}
|
*******************************************************************}
|
||||||
procedure TsSpreadBIFF5Writer.WriteWindow2(AStream: TStream;
|
procedure TsSpreadBIFF5Writer.WriteWindow2(AStream: TStream;
|
||||||
ASheetSelected: Boolean);
|
ASheet: TsWorksheet);
|
||||||
var
|
var
|
||||||
Options: Word;
|
Options: Word;
|
||||||
begin
|
begin
|
||||||
@ -1026,14 +1011,18 @@ begin
|
|||||||
AStream.WriteWord(WordToLE(10));
|
AStream.WriteWord(WordToLE(10));
|
||||||
|
|
||||||
{ Options flags }
|
{ Options flags }
|
||||||
Options := MASK_WINDOW2_OPTION_SHOW_GRID_LINES or
|
Options :=
|
||||||
MASK_WINDOW2_OPTION_SHOW_SHEET_HEADERS or
|
|
||||||
MASK_WINDOW2_OPTION_SHOW_ZERO_VALUES or
|
MASK_WINDOW2_OPTION_SHOW_ZERO_VALUES or
|
||||||
MASK_WINDOW2_OPTION_AUTO_GRIDLINE_COLOR or
|
MASK_WINDOW2_OPTION_AUTO_GRIDLINE_COLOR or
|
||||||
MASK_WINDOW2_OPTION_SHOW_OUTLINE_SYMBOLS or
|
MASK_WINDOW2_OPTION_SHOW_OUTLINE_SYMBOLS or
|
||||||
MASK_WINDOW2_OPTION_SHEET_ACTIVE;
|
MASK_WINDOW2_OPTION_SHEET_ACTIVE;
|
||||||
|
|
||||||
if ASheetSelected then Options := Options or MASK_WINDOW2_OPTION_SHEET_SELECTED;
|
if ASheet.ShowGridLines then
|
||||||
|
Options := Options or MASK_WINDOW2_OPTION_SHOW_GRID_LINES;
|
||||||
|
if ASheet.ShowHeaders then
|
||||||
|
Options := Options or MASK_WINDOW2_OPTION_SHOW_SHEET_HEADERS;
|
||||||
|
if ASheet.Selected then
|
||||||
|
Options := Options or MASK_WINDOW2_OPTION_SHEET_SELECTED;
|
||||||
|
|
||||||
AStream.WriteWord(WordToLE(Options));
|
AStream.WriteWord(WordToLE(Options));
|
||||||
|
|
||||||
@ -1352,6 +1341,7 @@ begin
|
|||||||
INT_EXCEL_ID_COLINFO: ReadColInfo(AStream);
|
INT_EXCEL_ID_COLINFO: ReadColInfo(AStream);
|
||||||
INT_EXCEL_ID_ROWINFO: ReadRowInfo(AStream);
|
INT_EXCEL_ID_ROWINFO: ReadRowInfo(AStream);
|
||||||
INT_EXCEL_ID_FORMULA: ReadFormulaExcel(AStream);
|
INT_EXCEL_ID_FORMULA: ReadFormulaExcel(AStream);
|
||||||
|
INT_EXCEL_ID_WINDOW2: ReadWindow2(AStream);
|
||||||
INT_EXCEL_ID_BOF: ;
|
INT_EXCEL_ID_BOF: ;
|
||||||
INT_EXCEL_ID_EOF: SectionEOF := True;
|
INT_EXCEL_ID_EOF: SectionEOF := True;
|
||||||
// Show unsupported record types to console.
|
// Show unsupported record types to console.
|
||||||
|
@ -127,7 +127,7 @@ type
|
|||||||
const AFormula: TsRPNFormula; ACell: PCell); override;
|
const AFormula: TsRPNFormula; ACell: PCell); override;
|
||||||
procedure WriteStyle(AStream: TStream);
|
procedure WriteStyle(AStream: TStream);
|
||||||
procedure WriteWindow1(AStream: TStream);
|
procedure WriteWindow1(AStream: TStream);
|
||||||
procedure WriteWindow2(AStream: TStream; ASheetSelected: Boolean);
|
procedure WriteWindow2(AStream: TStream; ASheet: TsWorksheet);
|
||||||
procedure WriteXF(AStream: TStream; AFontIndex: Word;
|
procedure WriteXF(AStream: TStream; AFontIndex: Word;
|
||||||
AFormatIndex: Word; AXF_TYPE_PROT, ATextRotation: Byte; ABorders: TsCellBorders;
|
AFormatIndex: Word; AXF_TYPE_PROT, ATextRotation: Byte; ABorders: TsCellBorders;
|
||||||
const ABorderStyles: TsCellBorderStyles; AHorAlignment: TsHorAlignment = haDefault;
|
const ABorderStyles: TsCellBorderStyles; AHorAlignment: TsHorAlignment = haDefault;
|
||||||
@ -270,19 +270,6 @@ const
|
|||||||
MASK_WINDOW1_OPTION_VERT_SCROLL_VISIBLE = $0010;
|
MASK_WINDOW1_OPTION_VERT_SCROLL_VISIBLE = $0010;
|
||||||
MASK_WINDOW1_OPTION_WORKSHEET_TAB_VISIBLE = $0020;
|
MASK_WINDOW1_OPTION_WORKSHEET_TAB_VISIBLE = $0020;
|
||||||
|
|
||||||
{ WINDOW2 record constants }
|
|
||||||
MASK_WINDOW2_OPTION_SHOW_FORMULAS = $0001;
|
|
||||||
MASK_WINDOW2_OPTION_SHOW_GRID_LINES = $0002;
|
|
||||||
MASK_WINDOW2_OPTION_SHOW_SHEET_HEADERS = $0004;
|
|
||||||
MASK_WINDOW2_OPTION_PANES_ARE_FROZEN = $0008;
|
|
||||||
MASK_WINDOW2_OPTION_SHOW_ZERO_VALUES = $0010;
|
|
||||||
MASK_WINDOW2_OPTION_AUTO_GRIDLINE_COLOR = $0020;
|
|
||||||
MASK_WINDOW2_OPTION_COLUMNS_RIGHT_TO_LEFT = $0040;
|
|
||||||
MASK_WINDOW2_OPTION_SHOW_OUTLINE_SYMBOLS = $0080;
|
|
||||||
MASK_WINDOW2_OPTION_REMOVE_SPLITS_ON_UNFREEZE = $0100;
|
|
||||||
MASK_WINDOW2_OPTION_SHEET_SELECTED = $0200;
|
|
||||||
MASK_WINDOW2_OPTION_SHEET_ACTIVE = $0400;
|
|
||||||
|
|
||||||
{ XF substructures }
|
{ XF substructures }
|
||||||
|
|
||||||
{ XF_ROTATION }
|
{ XF_ROTATION }
|
||||||
@ -514,7 +501,7 @@ begin
|
|||||||
WriteIndex(AStream);
|
WriteIndex(AStream);
|
||||||
WriteColInfos(AStream, sheet);
|
WriteColInfos(AStream, sheet);
|
||||||
WriteDimensions(AStream, sheet);
|
WriteDimensions(AStream, sheet);
|
||||||
WriteWindow2(AStream, True);
|
WriteWindow2(AStream, sheet);
|
||||||
WriteCellsToStream(AStream, sheet.Cells);
|
WriteCellsToStream(AStream, sheet.Cells);
|
||||||
WriteEOF(AStream);
|
WriteEOF(AStream);
|
||||||
end;
|
end;
|
||||||
@ -1185,7 +1172,7 @@ end;
|
|||||||
*
|
*
|
||||||
*******************************************************************}
|
*******************************************************************}
|
||||||
procedure TsSpreadBIFF8Writer.WriteWindow2(AStream: TStream;
|
procedure TsSpreadBIFF8Writer.WriteWindow2(AStream: TStream;
|
||||||
ASheetSelected: Boolean);
|
ASheet: TsWorksheet);
|
||||||
var
|
var
|
||||||
Options: Word;
|
Options: Word;
|
||||||
begin
|
begin
|
||||||
@ -1194,14 +1181,18 @@ begin
|
|||||||
AStream.WriteWord(WordToLE(18));
|
AStream.WriteWord(WordToLE(18));
|
||||||
|
|
||||||
{ Options flags }
|
{ Options flags }
|
||||||
Options := MASK_WINDOW2_OPTION_SHOW_GRID_LINES or
|
Options :=
|
||||||
MASK_WINDOW2_OPTION_SHOW_SHEET_HEADERS or
|
|
||||||
MASK_WINDOW2_OPTION_SHOW_ZERO_VALUES or
|
MASK_WINDOW2_OPTION_SHOW_ZERO_VALUES or
|
||||||
MASK_WINDOW2_OPTION_AUTO_GRIDLINE_COLOR or
|
MASK_WINDOW2_OPTION_AUTO_GRIDLINE_COLOR or
|
||||||
MASK_WINDOW2_OPTION_SHOW_OUTLINE_SYMBOLS or
|
MASK_WINDOW2_OPTION_SHOW_OUTLINE_SYMBOLS or
|
||||||
MASK_WINDOW2_OPTION_SHEET_ACTIVE;
|
MASK_WINDOW2_OPTION_SHEET_ACTIVE;
|
||||||
|
|
||||||
if ASheetSelected then Options := Options or MASK_WINDOW2_OPTION_SHEET_SELECTED;
|
if ASheet.ShowGridLines then
|
||||||
|
Options := Options or MASK_WINDOW2_OPTION_SHOW_GRID_LINES;
|
||||||
|
if ASheet.ShowHeaders then
|
||||||
|
Options := Options or MASK_WINDOW2_OPTION_SHOW_SHEET_HEADERS;
|
||||||
|
if ASheet.Selected then
|
||||||
|
Options := Options or MASK_WINDOW2_OPTION_SHEET_SELECTED;
|
||||||
|
|
||||||
AStream.WriteWord(WordToLE(Options));
|
AStream.WriteWord(WordToLE(Options));
|
||||||
|
|
||||||
@ -1601,6 +1592,7 @@ begin
|
|||||||
INT_EXCEL_ID_LABELSST:ReadLabelSST(AStream); //BIFF8 only
|
INT_EXCEL_ID_LABELSST:ReadLabelSST(AStream); //BIFF8 only
|
||||||
INT_EXCEL_ID_COLINFO: ReadColInfo(AStream);
|
INT_EXCEL_ID_COLINFO: ReadColInfo(AStream);
|
||||||
INT_EXCEL_ID_ROWINFO: ReadRowInfo(AStream);
|
INT_EXCEL_ID_ROWINFO: ReadRowInfo(AStream);
|
||||||
|
INT_EXCEL_ID_WINDOW2: ReadWindow2(AStream);
|
||||||
INT_EXCEL_ID_BOF: ;
|
INT_EXCEL_ID_BOF: ;
|
||||||
INT_EXCEL_ID_EOF: SectionEOF := True;
|
INT_EXCEL_ID_EOF: SectionEOF := True;
|
||||||
else
|
else
|
||||||
|
@ -27,6 +27,7 @@ const
|
|||||||
INT_EXCEL_ID_BLANK = $0201;
|
INT_EXCEL_ID_BLANK = $0201;
|
||||||
INT_EXCEL_ID_NUMBER = $0203;
|
INT_EXCEL_ID_NUMBER = $0203;
|
||||||
INT_EXCEL_ID_LABEL = $0204;
|
INT_EXCEL_ID_LABEL = $0204;
|
||||||
|
INT_EXCEL_ID_WINDOW2 = $023E;
|
||||||
|
|
||||||
{ FONT record constants }
|
{ FONT record constants }
|
||||||
INT_FONT_WEIGHT_NORMAL = $0190;
|
INT_FONT_WEIGHT_NORMAL = $0190;
|
||||||
@ -225,7 +226,6 @@ const
|
|||||||
FORMAT_PERCENT_0_DECIMALS = 9; //percent, 0 decimals
|
FORMAT_PERCENT_0_DECIMALS = 9; //percent, 0 decimals
|
||||||
FORMAT_PERCENT_2_DECIMALS = 10; //percent, 2 decimals
|
FORMAT_PERCENT_2_DECIMALS = 10; //percent, 2 decimals
|
||||||
FORMAT_EXP_2_DECIMALS = 11; //exponent, 2 decimals
|
FORMAT_EXP_2_DECIMALS = 11; //exponent, 2 decimals
|
||||||
FORMAT_SCI_1_DECIMAL = 48; //scientific, 1 decimal
|
|
||||||
FORMAT_SHORT_DATE = 14; //short date
|
FORMAT_SHORT_DATE = 14; //short date
|
||||||
FORMAT_DATE_DM = 16; //date D-MMM
|
FORMAT_DATE_DM = 16; //date D-MMM
|
||||||
FORMAT_DATE_MY = 17; //date MMM-YYYY
|
FORMAT_DATE_MY = 17; //date MMM-YYYY
|
||||||
@ -235,8 +235,22 @@ const
|
|||||||
FORMAT_LONG_TIME = 21; //long time H:MM:SS
|
FORMAT_LONG_TIME = 21; //long time H:MM:SS
|
||||||
FORMAT_SHORT_DATETIME = 22; //short date+time
|
FORMAT_SHORT_DATETIME = 22; //short date+time
|
||||||
FORMAT_TIME_MS = 45; //time MM:SS
|
FORMAT_TIME_MS = 45; //time MM:SS
|
||||||
FORMAT_TIME_MSZ = 47; //time MM:SS.0
|
|
||||||
FORMAT_TIME_INTERVAL = 46; //time [hh]:mm:ss, hh can be >24
|
FORMAT_TIME_INTERVAL = 46; //time [hh]:mm:ss, hh can be >24
|
||||||
|
FORMAT_TIME_MSZ = 47; //time MM:SS.0
|
||||||
|
FORMAT_SCI_1_DECIMAL = 48; //scientific, 1 decimal
|
||||||
|
|
||||||
|
{ WINDOW2 record constants - BIFF3-BIFF8}
|
||||||
|
MASK_WINDOW2_OPTION_SHOW_FORMULAS = $0001;
|
||||||
|
MASK_WINDOW2_OPTION_SHOW_GRID_LINES = $0002;
|
||||||
|
MASK_WINDOW2_OPTION_SHOW_SHEET_HEADERS = $0004;
|
||||||
|
MASK_WINDOW2_OPTION_PANES_ARE_FROZEN = $0008;
|
||||||
|
MASK_WINDOW2_OPTION_SHOW_ZERO_VALUES = $0010;
|
||||||
|
MASK_WINDOW2_OPTION_AUTO_GRIDLINE_COLOR = $0020;
|
||||||
|
MASK_WINDOW2_OPTION_COLUMNS_RIGHT_TO_LEFT = $0040;
|
||||||
|
MASK_WINDOW2_OPTION_SHOW_OUTLINE_SYMBOLS = $0080;
|
||||||
|
MASK_WINDOW2_OPTION_REMOVE_SPLITS_ON_UNFREEZE = $0100; //BIFF5-BIFF8
|
||||||
|
MASK_WINDOW2_OPTION_SHEET_SELECTED = $0200; //BIFF5-BIFF8
|
||||||
|
MASK_WINDOW2_OPTION_SHEET_ACTIVE = $0400; //BIFF5-BIFF8
|
||||||
|
|
||||||
{ XF substructures }
|
{ XF substructures }
|
||||||
|
|
||||||
@ -358,6 +372,8 @@ type
|
|||||||
procedure ReadRowColXF(AStream: TStream; out ARow, ACol: Cardinal; out AXF: Word); virtual;
|
procedure ReadRowColXF(AStream: TStream; out ARow, ACol: Cardinal; out AXF: Word); virtual;
|
||||||
// Read row info
|
// Read row info
|
||||||
procedure ReadRowInfo(AStream: TStream); virtual;
|
procedure ReadRowInfo(AStream: TStream); virtual;
|
||||||
|
// Read WINDOW2 record (gridlines, sheet headers)
|
||||||
|
procedure ReadWindow2(AStream: TStream); virtual;
|
||||||
public
|
public
|
||||||
constructor Create(AWorkbook: TsWorkbook); override;
|
constructor Create(AWorkbook: TsWorkbook); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -865,6 +881,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ Reads the WINDOW2 record containing information like "show grid lines", or
|
||||||
|
"show sheet headers".
|
||||||
|
The record structure is different for BIFF5 and BIFF8, but we use here only
|
||||||
|
the common part.
|
||||||
|
BIFF2 is completely different and has to be overridden. }
|
||||||
|
procedure TsSpreadBIFFReader.ReadWindow2(AStream: TStream);
|
||||||
|
var
|
||||||
|
flags: Word;
|
||||||
|
begin
|
||||||
|
flags := WordLEToN(AStream.ReadWord);
|
||||||
|
FWorksheet.ShowGridLines := (flags and MASK_WINDOW2_OPTION_SHOW_GRID_LINES <> 0);
|
||||||
|
FWorksheet.ShowHeaders := (flags and MASK_WINDOW2_OPTION_SHOW_SHEET_HEADERS <> 0);
|
||||||
|
FWorksheet.Selected := (flags and MASK_WINDOW2_OPTION_SHEET_SELECTED <> 0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{ TsSpreadBIFFWriter }
|
{ TsSpreadBIFFWriter }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user