You've already forked lazarus-ccr
fpspreadsheet: Introduce enum field "Options" of TRow and TCol records to replace boolean "Hidden". Prepare for new "PageBreak" option.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7068 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -6270,7 +6270,7 @@ begin
|
|||||||
GetRowStyleAndHeight(ASheet, ARowIndex, stylename, h);
|
GetRowStyleAndHeight(ASheet, ARowIndex, stylename, h);
|
||||||
|
|
||||||
// Row hidden?
|
// Row hidden?
|
||||||
if (round(h) = 0) or (Assigned(row) and row^.Hidden) then
|
if (round(h) = 0) or (Assigned(row) and (croHidden in row^.Options)) then
|
||||||
rowHiddenStr := ' table:visibility="collapse"'
|
rowHiddenStr := ' table:visibility="collapse"'
|
||||||
else
|
else
|
||||||
rowHiddenStr := '';
|
rowHiddenStr := '';
|
||||||
@ -6412,7 +6412,7 @@ begin
|
|||||||
// Determine how often this row is repeated
|
// Determine how often this row is repeated
|
||||||
row := sheet.FindRow(ARowIndex);
|
row := sheet.FindRow(ARowIndex);
|
||||||
|
|
||||||
isHidden1 := (round(h) = 0) or ((row <> nil) and row^.Hidden);
|
isHidden1 := (round(h) = 0) or ((row <> nil) and (croHidden in row^.Options));
|
||||||
rowHiddenStr := IfThen(isHidden1, ' table:visibility="collapse"', '');
|
rowHiddenStr := IfThen(isHidden1, ' table:visibility="collapse"', '');
|
||||||
|
|
||||||
// Rows with format are not repeated - too complicated...
|
// Rows with format are not repeated - too complicated...
|
||||||
@ -6428,7 +6428,7 @@ begin
|
|||||||
break;
|
break;
|
||||||
row := sheet.FindRow(r);
|
row := sheet.FindRow(r);
|
||||||
isHidden := (row <> nil) and
|
isHidden := (row <> nil) and
|
||||||
(row^.Hidden or ((row^.RowHeightType=rhtCustom) and (row^.Height = 0)));
|
((croHidden in row^.Options) or ((row^.RowHeightType=rhtCustom) and (row^.Height = 0)));
|
||||||
if ((row <> nil) and (row^.FormatIndex > 0)) or (isHidden <> isHidden1) then
|
if ((row <> nil) and (row^.FormatIndex > 0)) or (isHidden <> isHidden1) then
|
||||||
break;
|
break;
|
||||||
h1 := sheet.GetRowHeight(r, FWorkbook.Units);
|
h1 := sheet.GetRowHeight(r, FWorkbook.Units);
|
||||||
|
@ -489,6 +489,11 @@ type
|
|||||||
procedure WriteColWidth(ACol: Cardinal; AWidth: Single;
|
procedure WriteColWidth(ACol: Cardinal; AWidth: Single;
|
||||||
AColWidthType: TsColWidthType = cwtCustom); overload; deprecated 'Use version with parameter AUnits';
|
AColWidthType: TsColWidthType = cwtCustom); overload; deprecated 'Use version with parameter AUnits';
|
||||||
|
|
||||||
|
procedure AddPageBreakToCol(ACol: Cardinal);
|
||||||
|
procedure AddPageBreakToRow(ARow: Cardinal);
|
||||||
|
procedure RemovePageBreakFromCol(ACol: Cardinal);
|
||||||
|
procedure RemovePageBreakFromRow(ARow: Cardinal);
|
||||||
|
|
||||||
// Sorting
|
// Sorting
|
||||||
function DefaultCompareCells(ACell1, ACell2: PCell; ASortKey: TsSortKey): Integer;
|
function DefaultCompareCells(ACell1, ACell2: PCell; ASortKey: TsSortKey): Integer;
|
||||||
procedure Sort(const ASortParams: TsSortParams;
|
procedure Sort(const ASortParams: TsSortParams;
|
||||||
@ -7742,7 +7747,7 @@ var
|
|||||||
c: PCol;
|
c: PCol;
|
||||||
begin
|
begin
|
||||||
c := FindCol(ACol);
|
c := FindCol(ACol);
|
||||||
Result := Assigned(c) and c^.Hidden;
|
Result := Assigned(c) and (croHidden in c^.Options);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
@ -7753,7 +7758,7 @@ var
|
|||||||
r: PRow;
|
r: PRow;
|
||||||
begin
|
begin
|
||||||
r := FindRow(ARow);
|
r := FindRow(ARow);
|
||||||
Result := Assigned(r) and r^.Hidden;
|
Result := Assigned(r) and (croHidden in r^.Options);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
@ -7764,8 +7769,8 @@ var
|
|||||||
c: PCol;
|
c: PCol;
|
||||||
begin
|
begin
|
||||||
c := GetCol(ACol);
|
c := GetCol(ACol);
|
||||||
if not c^.Hidden then begin
|
if not (croHidden in c^.Options) then begin
|
||||||
c^.Hidden := true;
|
Include(c^.Options, croHidden);
|
||||||
ChangedCell(0, ACol);
|
ChangedCell(0, ACol);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -7778,8 +7783,8 @@ var
|
|||||||
r: PRow;
|
r: PRow;
|
||||||
begin
|
begin
|
||||||
r := GetRow(ARow);
|
r := GetRow(ARow);
|
||||||
if not r^.Hidden then begin
|
if not (croHidden in r^.Options) then begin
|
||||||
r^.Hidden := true;
|
Include(r^.Options, croHidden);
|
||||||
ChangedCell(ARow, 0);
|
ChangedCell(ARow, 0);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -7792,8 +7797,8 @@ var
|
|||||||
c: PCol;
|
c: PCol;
|
||||||
begin
|
begin
|
||||||
c := FindCol(ACol);
|
c := FindCol(ACol);
|
||||||
if Assigned(c) and c^.Hidden then begin
|
if Assigned(c) and (croHidden in c^.Options) then begin
|
||||||
c^.Hidden := false;
|
Exclude(c^.Options, croHidden);
|
||||||
ChangedCell(0, ACol);
|
ChangedCell(0, ACol);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -7806,8 +7811,8 @@ var
|
|||||||
r: PRow;
|
r: PRow;
|
||||||
begin
|
begin
|
||||||
r := FindRow(ARow);
|
r := FindRow(ARow);
|
||||||
if Assigned(r) and r^.Hidden then begin
|
if Assigned(r) and (croHidden in r^.Options) then begin
|
||||||
r^.Hidden := false;
|
Exclude(r^.Options, croHidden);
|
||||||
ChangedCell(ARow, 0);
|
ChangedCell(ARow, 0);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -8225,7 +8230,7 @@ begin
|
|||||||
lRow^.Height := AData.Height;
|
lRow^.Height := AData.Height;
|
||||||
lRow^.RowHeightType := AData.RowHeightType;
|
lRow^.RowHeightType := AData.RowHeightType;
|
||||||
lRow^.FormatIndex := AData.FormatIndex;
|
lRow^.FormatIndex := AData.FormatIndex;
|
||||||
lRow^.Hidden := AData.Hidden;
|
lRow^.Options := AData.Options;
|
||||||
ChangedRow(ARow);
|
ChangedRow(ARow);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -8302,7 +8307,7 @@ begin
|
|||||||
lCol^.Width := AData.Width;
|
lCol^.Width := AData.Width;
|
||||||
lCol^.ColWidthType := AData.ColWidthType;
|
lCol^.ColWidthType := AData.ColWidthType;
|
||||||
lCol^.FormatIndex := AData.FormatIndex;
|
lCol^.FormatIndex := AData.FormatIndex;
|
||||||
lCol^.Hidden := AData.Hidden;
|
lCol^.Options := AData.Options;
|
||||||
ChangedCol(ACol);
|
ChangedCol(ACol);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -8386,6 +8391,69 @@ begin
|
|||||||
FDefaultRowHeight := FWorkbook.ConvertUnits(AValue, AUnits, FWorkbook.Units);
|
FDefaultRowHeight := FWorkbook.ConvertUnits(AValue, AUnits, FWorkbook.Units);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{@@ ----------------------------------------------------------------------------
|
||||||
|
Sets the PageBreak flag for the column record with the specified column index.
|
||||||
|
This means that, when printed, a page break will occur before this column.
|
||||||
|
Note that FPS currently does not support printing by itself.
|
||||||
|
-------------------------------------------------------------------------------}
|
||||||
|
procedure TsWorksheet.AddPageBreakToCol(ACol: Cardinal);
|
||||||
|
var
|
||||||
|
lCol: PCol;
|
||||||
|
begin
|
||||||
|
lCol := AddCol(ACol);
|
||||||
|
Include(lCol^.Options, croPageBreak);
|
||||||
|
ChangedCol(ACol);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{@@ ----------------------------------------------------------------------------
|
||||||
|
Sets the PageBreak flag for the row record with the specified row index.
|
||||||
|
This means that, when printed, a page break will occur before this row.
|
||||||
|
Note that FPS currently does not support printing by itself.
|
||||||
|
-------------------------------------------------------------------------------}
|
||||||
|
procedure TsWorksheet.AddPageBreakToRow(ARow: Cardinal);
|
||||||
|
var
|
||||||
|
lRow: PRow;
|
||||||
|
begin
|
||||||
|
lRow := AddRow(ARow);
|
||||||
|
Include(lRow^.Options, croPageBreak);
|
||||||
|
ChangedRow(ARow);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{@@ ----------------------------------------------------------------------------
|
||||||
|
Removes the PageBreak flag for the column record with the specified column
|
||||||
|
index.
|
||||||
|
This means that, during printing, page break handling of this column will be
|
||||||
|
automatic.
|
||||||
|
Note that FPS currently does not support printing by itself.
|
||||||
|
-------------------------------------------------------------------------------}
|
||||||
|
procedure TsWorksheet.RemovePageBreakFromCol(ACol: Cardinal);
|
||||||
|
var
|
||||||
|
lCol: PCol;
|
||||||
|
begin
|
||||||
|
lCol := FindCol(ACol);
|
||||||
|
if lCol <> nil then begin
|
||||||
|
Exclude(lCol^.Options, croPageBreak);
|
||||||
|
ChangedCol(ACol);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{@@ ----------------------------------------------------------------------------
|
||||||
|
Removes the PageBreak flag for the row record with the specified row index.
|
||||||
|
This means that, during printing, page break handling of this row will be
|
||||||
|
automatic.
|
||||||
|
Note that FPS currently does not support printing by itself.
|
||||||
|
-------------------------------------------------------------------------------}
|
||||||
|
procedure TsWorksheet.RemovePageBreakFromRow(ARow: Cardinal);
|
||||||
|
var
|
||||||
|
lRow: PRow;
|
||||||
|
begin
|
||||||
|
lRow := FindRow(ARow);
|
||||||
|
if lRow <> nil then begin
|
||||||
|
Exclude(lRow^.Options, croPageBreak);
|
||||||
|
ChangedRow(ARow);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{==============================================================================}
|
{==============================================================================}
|
||||||
{ TsWorkbook }
|
{ TsWorkbook }
|
||||||
|
@ -404,7 +404,7 @@ begin
|
|||||||
break;
|
break;
|
||||||
if sheet.FindNextCellInCol(0, lCol^.Col) <> nil then
|
if sheet.FindNextCellInCol(0, lCol^.Col) <> nil then
|
||||||
break;
|
break;
|
||||||
if lCol^.Hidden then
|
if (lCol^.Options <> []) then
|
||||||
break;
|
break;
|
||||||
sheet.RemoveCol(lCol^.Col);
|
sheet.RemoveCol(lCol^.Col);
|
||||||
dec(c);
|
dec(c);
|
||||||
@ -431,10 +431,11 @@ begin
|
|||||||
// to the DefaultColWidth ...
|
// to the DefaultColWidth ...
|
||||||
sheet.WriteDefaultColWidth(w, FWorkbook.Units);
|
sheet.WriteDefaultColWidth(w, FWorkbook.Units);
|
||||||
|
|
||||||
// ...and delete all column records with non-default format
|
// ...and delete all visible column records with default format
|
||||||
for c := sheet.Cols.Count-1 downto 0 do begin
|
for c := sheet.Cols.Count-1 downto 0 do begin
|
||||||
lCol := PCol(sheet.Cols[c]);
|
lCol := PCol(sheet.Cols[c]);
|
||||||
if (lCol^.FormatIndex = 0) and (not lCol^.Hidden) then sheet.RemoveCol(lCol^.Col);
|
if (lCol^.FormatIndex = 0) and not (croHidden in lCol^.Options) then
|
||||||
|
sheet.RemoveCol(lCol^.Col);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -481,7 +482,7 @@ begin
|
|||||||
// ... and delete all visible row records with default format.
|
// ... and delete all visible row records with default format.
|
||||||
for r := sheet.Rows.Count-1 downto 0 do begin
|
for r := sheet.Rows.Count-1 downto 0 do begin
|
||||||
lRow := PRow(sheet.Rows[r]);
|
lRow := PRow(sheet.Rows[r]);
|
||||||
if (lRow^.FormatIndex = 0) and (not lRow^.Hidden) then
|
if (lRow^.FormatIndex = 0) and not (croHidden in lRow^.Options) then
|
||||||
sheet.RemoveRow(lRow^.Row);
|
sheet.RemoveRow(lRow^.Row);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -774,6 +774,12 @@ type
|
|||||||
in the grid, or by changed by code) }
|
in the grid, or by changed by code) }
|
||||||
TsColWidthtype = (cwtDefault, cwtCustom);
|
TsColWidthtype = (cwtDefault, cwtCustom);
|
||||||
|
|
||||||
|
{@@ Column or row options
|
||||||
|
croHidden - Column or row is hidden
|
||||||
|
croPageBreak - Enforces a pagebreak before this column/row during printing }
|
||||||
|
TsColRowOption = (croHidden, croPageBreak);
|
||||||
|
TsColRowOptions = set of TsColRowOption;
|
||||||
|
|
||||||
{@@ The record TRow contains information about a spreadsheet row:
|
{@@ The record TRow contains information about a spreadsheet row:
|
||||||
@param Row The index of the row (beginning with 0)
|
@param Row The index of the row (beginning with 0)
|
||||||
@param Height The height of the row (expressed in the units defined
|
@param Height The height of the row (expressed in the units defined
|
||||||
@ -782,14 +788,15 @@ type
|
|||||||
automatic height
|
automatic height
|
||||||
@param FormatIndex Row default format, index into the workbook's
|
@param FormatIndex Row default format, index into the workbook's
|
||||||
FCellFormatList
|
FCellFormatList
|
||||||
@param Hidden Indicates that the row is hidden
|
@param Options @See TsColRowOption
|
||||||
Only rows with non-default height or non-default format have a row record. }
|
Only rows with non-default height or non-default format or non-default
|
||||||
|
Options have a row record. }
|
||||||
TRow = record
|
TRow = record
|
||||||
Row: Cardinal;
|
Row: Cardinal;
|
||||||
Height: Single;
|
Height: Single;
|
||||||
RowHeightType: TsRowHeightType;
|
RowHeightType: TsRowHeightType;
|
||||||
FormatIndex: Integer;
|
FormatIndex: Integer;
|
||||||
Hidden: Boolean;
|
Options: TsColRowOptions;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{@@ Pointer to a TRow record }
|
{@@ Pointer to a TRow record }
|
||||||
@ -802,14 +809,15 @@ type
|
|||||||
@param ColWidthType Specifies whether the column has default or custom width
|
@param ColWidthType Specifies whether the column has default or custom width
|
||||||
@param FormatIndex Column default format, index into the workbook's
|
@param FormatIndex Column default format, index into the workbook's
|
||||||
FCellFormatlist
|
FCellFormatlist
|
||||||
@param Hidden Indicates that the column is hidden
|
@param Options @see TsColRowOptions
|
||||||
Only columns with non-default width or non-default format have a column record. }
|
Only columns with non-default width or non-default format or non-default
|
||||||
|
Options have a column record. }
|
||||||
TCol = record
|
TCol = record
|
||||||
Col: Cardinal;
|
Col: Cardinal;
|
||||||
Width: Single;
|
Width: Single;
|
||||||
ColWidthType: TsColWidthType;
|
ColWidthType: TsColWidthType;
|
||||||
FormatIndex: Integer;
|
FormatIndex: Integer;
|
||||||
Hidden: Boolean;
|
Options: TsColRowOptions;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{@@ Pointer to a TCol record }
|
{@@ Pointer to a TCol record }
|
||||||
|
@ -1674,6 +1674,7 @@ var
|
|||||||
fmt: PsCellFormat;
|
fmt: PsCellFormat;
|
||||||
book: TsWorkbook;
|
book: TsWorkbook;
|
||||||
sheet: TsWorksheet;
|
sheet: TsWorksheet;
|
||||||
|
col: PCol;
|
||||||
begin
|
begin
|
||||||
book := FWorkbook as TsWorkbook;
|
book := FWorkbook as TsWorkbook;
|
||||||
sheet := FWorksheet as TsWorksheet;
|
sheet := FWorksheet as TsWorksheet;
|
||||||
@ -1689,24 +1690,36 @@ begin
|
|||||||
{ Calculate width in workbook units }
|
{ Calculate width in workbook units }
|
||||||
lCol.Width := book.ConvertUnits(w / 256, suChars, FWorkbook.Units);
|
lCol.Width := book.ConvertUnits(w / 256, suChars, FWorkbook.Units);
|
||||||
if SameValue(lCol.Width, sheet.ReadDefaultColWidth(FWorkbook.Units), EPS) then
|
if SameValue(lCol.Width, sheet.ReadDefaultColWidth(FWorkbook.Units), EPS) then
|
||||||
lCol.ColWidthType := cwtDefault else
|
lCol.ColWidthType := cwtDefault
|
||||||
|
else
|
||||||
lCol.ColWidthType := cwtCustom;
|
lCol.ColWidthType := cwtCustom;
|
||||||
|
|
||||||
{ Read xf record index }
|
{ Read xf record index }
|
||||||
xf := WordLEToN(AStream.ReadWord);
|
xf := WordLEToN(AStream.ReadWord);
|
||||||
idx := FCellFormatList.FindIndexOfID(xf);
|
idx := FCellFormatList.FindIndexOfID(xf);
|
||||||
if idx > -1 then begin
|
if idx > -1 then
|
||||||
|
begin
|
||||||
fmt := FCellFormatList.Items[idx];
|
fmt := FCellFormatList.Items[idx];
|
||||||
lCol.FormatIndex := book.AddCellFormat(fmt^);
|
lCol.FormatIndex := book.AddCellFormat(fmt^);
|
||||||
end else
|
end else
|
||||||
lCol.FormatIndex := 0;
|
lCol.FormatIndex := 0;
|
||||||
|
|
||||||
|
{ Get current value of column options to keep already set PageBreak option }
|
||||||
|
col := TsWorksheet(FWorksheet).FindCol(c);
|
||||||
|
if col <> nil then
|
||||||
|
lCol.Options := col^.Options
|
||||||
|
else
|
||||||
|
lCol.Options := [];
|
||||||
|
|
||||||
{ Read column visibility }
|
{ Read column visibility }
|
||||||
flags := WordLEToN(AStream.ReadWord);
|
flags := WordLEToN(AStream.ReadWord);
|
||||||
lCol.Hidden := (flags and $0001 <> 0);
|
if flags and $0001 = $0001 then
|
||||||
|
Include(lCol.Options, croHidden)
|
||||||
|
else
|
||||||
|
Exclude(lCol.Options, croHidden);
|
||||||
|
|
||||||
{ Assign width and format to columns, but only if different from defaults }
|
{ Assign width and format to columns, but only if different from defaults }
|
||||||
if (lCol.FormatIndex > 0) or (lCol.ColWidthType = cwtCustom) or lCol.Hidden then
|
if (lCol.FormatIndex > 0) or (lCol.ColWidthType = cwtCustom) or (lCol.Options <> []) then
|
||||||
for c := c1 to c2 do
|
for c := c1 to c2 do
|
||||||
sheet.WriteColInfo(c, lCol);
|
sheet.WriteColInfo(c, lCol);
|
||||||
end;
|
end;
|
||||||
@ -2544,6 +2557,7 @@ type
|
|||||||
var
|
var
|
||||||
rowrec: TRowRecord;
|
rowrec: TRowRecord;
|
||||||
lRow: TRow;
|
lRow: TRow;
|
||||||
|
row: PRow;
|
||||||
h: word;
|
h: word;
|
||||||
hpts: Single;
|
hpts: Single;
|
||||||
hdef: Single;
|
hdef: Single;
|
||||||
@ -2583,12 +2597,21 @@ begin
|
|||||||
// Find the format with ID xf
|
// Find the format with ID xf
|
||||||
lRow.FormatIndex := XFToFormatIndex(xf);
|
lRow.FormatIndex := XFToFormatIndex(xf);
|
||||||
|
|
||||||
|
{ Get current value of row Options to keep Pagebreak already written }
|
||||||
|
row := TsWorksheet(FWorksheet).FindRow(rowRec.RowIndex);
|
||||||
|
if row <> nil then
|
||||||
|
lRow.Options := row^.Options
|
||||||
|
else
|
||||||
|
lRow.Options := [];
|
||||||
{ Row visibility }
|
{ Row visibility }
|
||||||
lRow.Hidden := rowRec.Flags and $00000020 <> 0;
|
if rowRec.Flags and $00000020 <> 0 then
|
||||||
|
Include(lRow.Options, croHidden)
|
||||||
|
else
|
||||||
|
Exclude(lRow.Options, croHidden);
|
||||||
|
|
||||||
// We only create a row record for fpspreadsheet if the row has a
|
// We only create a row record for fpspreadsheet if the row has a
|
||||||
// non-standard height (i.e. different from default row height) or format.
|
// non-standard height (i.e. different from default row height) or format.
|
||||||
if isNonDefaultHeight or hasFormat or lRow.Hidden then
|
if isNonDefaultHeight or hasFormat or (lRow.Options <> []) then
|
||||||
TsWorksheet(FWorksheet).WriteRowInfo(rowrec.RowIndex, lRow);
|
TsWorksheet(FWorksheet).WriteRowInfo(rowrec.RowIndex, lRow);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3988,7 +4011,7 @@ begin
|
|||||||
w := round(width * 256);
|
w := round(width * 256);
|
||||||
|
|
||||||
optn := 0;
|
optn := 0;
|
||||||
if ACol^.Hidden then optn := optn + $0001;
|
if (croHidden in ACol^.Options) then optn := optn + $0001;
|
||||||
// outline, collapsed flags are not used
|
// outline, collapsed flags are not used
|
||||||
|
|
||||||
rec.ColWidth := WordToLE(w);
|
rec.ColWidth := WordToLE(w);
|
||||||
@ -4851,7 +4874,7 @@ begin
|
|||||||
|
|
||||||
{ Option flags }
|
{ Option flags }
|
||||||
dw := $00000100; // bit 8 is always 1
|
dw := $00000100; // bit 8 is always 1
|
||||||
if Assigned(ARow) and ARow^.Hidden then dw := dw or $00000020;
|
if Assigned(ARow) and (croHidden in ARow^.Options) then dw := dw or $00000020;
|
||||||
if spaceabove then dw := dw or $10000000;
|
if spaceabove then dw := dw or $10000000;
|
||||||
if spacebelow then dw := dw or $20000000;
|
if spacebelow then dw := dw or $20000000;
|
||||||
if (ARow <> nil) and (ARow^.RowHeightType = rhtCustom) then // Custom row height
|
if (ARow <> nil) and (ARow^.RowHeightType = rhtCustom) then // Custom row height
|
||||||
|
@ -1187,10 +1187,12 @@ begin
|
|||||||
end else
|
end else
|
||||||
lCol.FormatIndex := 0;
|
lCol.FormatIndex := 0;
|
||||||
|
|
||||||
|
lCol.Options := [];
|
||||||
s := GetAttrValue(colNode, 'hidden');
|
s := GetAttrValue(colNode, 'hidden');
|
||||||
lCol.Hidden := StrIsTrue(s);
|
if StrIsTrue(s) then
|
||||||
|
Include(lCol.Options, croHidden);
|
||||||
|
|
||||||
if (lCol.ColWidthType = cwtCustom) or (lCol.FormatIndex > 0) or lCol.Hidden then
|
if (lCol.ColWidthType = cwtCustom) or (lCol.FormatIndex > 0) or (lCol.Options <> []) then
|
||||||
for col := col1 to Min(col2, FLastCol) do
|
for col := col1 to Min(col2, FLastCol) do
|
||||||
sheet.WriteColInfo(col, lCol);
|
sheet.WriteColInfo(col, lCol);
|
||||||
end;
|
end;
|
||||||
@ -2015,11 +2017,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ Row visibility }
|
{ Row visibility }
|
||||||
|
lRow.Options := [];
|
||||||
s := GetAttrvalue(ANode, 'hidden');
|
s := GetAttrvalue(ANode, 'hidden');
|
||||||
lRow.Hidden := StrIsTrue(s);
|
if StrIsTrue(s) then
|
||||||
|
Include(lRow.Options, croHidden);
|
||||||
|
|
||||||
{ Write out }
|
{ Write out }
|
||||||
if (lRow.RowHeightType <> rhtDefault) or (lRow.FormatIndex <> 0) or lRow.Hidden then
|
if (lRow.RowHeightType <> rhtDefault) or (lRow.FormatIndex <> 0) or (lRow.Options <> []) then
|
||||||
(AWorksheet as TsWorksheet).WriteRowInfo(r, lRow);
|
(AWorksheet as TsWorksheet).WriteRowInfo(r, lRow);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3059,7 +3063,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if lCol^.FormatIndex > 0 then
|
if lCol^.FormatIndex > 0 then
|
||||||
customStyle := Format('style="%d" ', [lCol^.FormatIndex]);
|
customStyle := Format('style="%d" ', [lCol^.FormatIndex]);
|
||||||
if lCol^.Hidden then hiddenStr := ' hidden="1"';
|
if (croHidden in lCol^.Options) then hiddenStr := ' hidden="1"';
|
||||||
end;
|
end;
|
||||||
AppendToStream(AStream, Format(
|
AppendToStream(AStream, Format(
|
||||||
'<col min="%d" max="%d" width="%.2f" %s%s%s />',
|
'<col min="%d" max="%d" width="%.2f" %s%s%s />',
|
||||||
@ -3514,7 +3518,7 @@ begin
|
|||||||
s := s + ' customHeight="1"';
|
s := s + ' customHeight="1"';
|
||||||
if row^.FormatIndex > 0 then
|
if row^.FormatIndex > 0 then
|
||||||
s := s + Format(' s="%d" customFormat="1"', [row^.FormatIndex]);
|
s := s + Format(' s="%d" customFormat="1"', [row^.FormatIndex]);
|
||||||
if row^.Hidden then
|
if (croHidden in row^.Options) then
|
||||||
s := s + ' hidden="1"';
|
s := s + ' hidden="1"';
|
||||||
end;
|
end;
|
||||||
AppendToStream(AStream, Format(
|
AppendToStream(AStream, Format(
|
||||||
@ -3581,7 +3585,7 @@ begin
|
|||||||
s := s + ' customHeight="1"';
|
s := s + ' customHeight="1"';
|
||||||
if row^.FormatIndex > 0 then
|
if row^.FormatIndex > 0 then
|
||||||
s := s + Format(' s="%d" customFormat="1"', [row^.FormatIndex]);
|
s := s + Format(' s="%d" customFormat="1"', [row^.FormatIndex]);
|
||||||
if row^.Hidden then
|
if (croHidden in row^.Options) then
|
||||||
s := s + ' hidden="1"';
|
s := s + ' hidden="1"';
|
||||||
end;
|
end;
|
||||||
AppendToStream(AStream, Format(
|
AppendToStream(AStream, Format(
|
||||||
|
@ -3792,7 +3792,10 @@ begin
|
|||||||
]));
|
]));
|
||||||
UpdateFormatProperties(lCol^.FormatIndex, AStrings);
|
UpdateFormatProperties(lCol^.FormatIndex, AStrings);
|
||||||
AStrings.Add(Format('Hidden=%s', [
|
AStrings.Add(Format('Hidden=%s', [
|
||||||
BoolToStr(lCol^.Hidden, true)
|
BoolToStr(croHidden in lCol^.Options, true)
|
||||||
|
]));
|
||||||
|
AStrings.Add(Format('PageBreak=%s', [
|
||||||
|
BoolToStr(croPageBreak in lCol^.Options, true)
|
||||||
]));
|
]));
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
@ -3837,7 +3840,10 @@ begin
|
|||||||
]));
|
]));
|
||||||
UpdateFormatProperties(lRow^.FormatIndex, AStrings);
|
UpdateFormatProperties(lRow^.FormatIndex, AStrings);
|
||||||
AStrings.Add(Format('Hidden=%s', [
|
AStrings.Add(Format('Hidden=%s', [
|
||||||
BoolToStr(lRow^.Hidden, true)
|
BoolToStr(croHidden in lRow^.Options, true)
|
||||||
|
]));
|
||||||
|
AStrings.Add(Format('PageBreak=%s', [
|
||||||
|
BoolToStr(croPageBreak in lRow^.Options, true)
|
||||||
]));
|
]));
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
|
@ -5753,7 +5753,7 @@ begin
|
|||||||
if Worksheet <> nil then
|
if Worksheet <> nil then
|
||||||
begin
|
begin
|
||||||
lCol := Worksheet.FindCol(ACol - FHeaderCount);
|
lCol := Worksheet.FindCol(ACol - FHeaderCount);
|
||||||
if (lCol <> nil) and lCol^.Hidden then
|
if (lCol <> nil) and (croHidden in lCol^.Options) then
|
||||||
w := 0
|
w := 0
|
||||||
else begin
|
else begin
|
||||||
if (lCol <> nil) and (lCol^.ColWidthType = cwtCustom) then
|
if (lCol <> nil) and (lCol^.ColWidthType = cwtCustom) then
|
||||||
@ -5809,8 +5809,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
sr := ARow - FHeaderCount; // worksheet row index
|
sr := ARow - FHeaderCount; // worksheet row index
|
||||||
lRow := Worksheet.FindRow(sr);
|
lRow := Worksheet.FindRow(sr);
|
||||||
if (lRow <> nil) then begin
|
if (lRow <> nil) then
|
||||||
if lRow^.Hidden then
|
begin
|
||||||
|
if (croHidden in lRow^.Options) then
|
||||||
h := 0
|
h := 0
|
||||||
else begin
|
else begin
|
||||||
case lRow^.RowHeightType of
|
case lRow^.RowHeightType of
|
||||||
|
Reference in New Issue
Block a user