You've already forked lazarus-ccr
fpspreadsheet: Read hidden state of row/column records for XLSX and XLS (BIFF5 and BIFF8) formats.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6635 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -8038,6 +8038,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;
|
||||||
ChangedRow(ARow);
|
ChangedRow(ARow);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -8114,6 +8115,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;
|
||||||
ChangedCol(ACol);
|
ChangedCol(ACol);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -1618,6 +1618,7 @@ var
|
|||||||
c, c1, c2: Cardinal;
|
c, c1, c2: Cardinal;
|
||||||
w: Word;
|
w: Word;
|
||||||
xf: Word;
|
xf: Word;
|
||||||
|
flags: Word;
|
||||||
lCol: TCol;
|
lCol: TCol;
|
||||||
idx: Integer;
|
idx: Integer;
|
||||||
fmt: PsCellFormat;
|
fmt: PsCellFormat;
|
||||||
@@ -1650,8 +1651,12 @@ begin
|
|||||||
end else
|
end else
|
||||||
lCol.FormatIndex := 0;
|
lCol.FormatIndex := 0;
|
||||||
|
|
||||||
|
{ Read column visibility }
|
||||||
|
flags := WordLEToN(AStream.ReadWord);
|
||||||
|
lCol.Hidden := (flags and $0001 <> 0);
|
||||||
|
|
||||||
{ 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) then
|
if (lCol.FormatIndex > 0) or (lCol.ColWidthType = cwtCustom) or lCol.Hidden then
|
||||||
for c := c1 to c2 do
|
for c := c1 to c2 do
|
||||||
sheet.WriteColInfo(c, lCol);
|
sheet.WriteColInfo(c, lCol);
|
||||||
end;
|
end;
|
||||||
@@ -2527,9 +2532,13 @@ begin
|
|||||||
// Find the format with ID xf
|
// Find the format with ID xf
|
||||||
lRow.FormatIndex := XFToFormatIndex(xf);
|
lRow.FormatIndex := XFToFormatIndex(xf);
|
||||||
|
|
||||||
|
{ Row visibility }
|
||||||
|
if DWordLEToN(rowRec.Flags) and $00000020 <> 0 then
|
||||||
|
lRow.Hidden := true;
|
||||||
|
|
||||||
// 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 then
|
if isNonDefaultHeight or hasFormat or lRow.Hidden then
|
||||||
TsWorksheet(FWorksheet).WriteRowInfo(rowrec.RowIndex, lRow);
|
TsWorksheet(FWorksheet).WriteRowInfo(rowrec.RowIndex, lRow);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -1172,7 +1172,10 @@ begin
|
|||||||
end else
|
end else
|
||||||
lCol.FormatIndex := 0;
|
lCol.FormatIndex := 0;
|
||||||
|
|
||||||
if (lCol.ColWidthType = cwtCustom) or (lCol.FormatIndex > 0) then
|
s := GetAttrValue(colNode, 'hidden');
|
||||||
|
lCol.Hidden := StrIsTrue(s);
|
||||||
|
|
||||||
|
if (lCol.ColWidthType = cwtCustom) or (lCol.FormatIndex > 0) or lCol.Hidden 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;
|
||||||
@@ -1979,8 +1982,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ Row visibility }
|
||||||
|
s := GetAttrvalue(ANode, 'hidden');
|
||||||
|
lRow.Hidden := StrIsTrue(s);
|
||||||
|
|
||||||
{ Write out }
|
{ Write out }
|
||||||
if (lRow.RowHeightType <> rhtDefault) or (lRow.FormatIndex <> 0) then
|
if (lRow.RowHeightType <> rhtDefault) or (lRow.FormatIndex <> 0) or lRow.Hidden then
|
||||||
(AWorksheet as TsWorksheet).WriteRowInfo(r, lRow);
|
(AWorksheet as TsWorksheet).WriteRowInfo(r, lRow);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user