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:
wp_xxyyzz
2018-09-06 09:47:01 +00:00
parent 8f9b01368d
commit 014658c6f2
3 changed files with 22 additions and 4 deletions

View File

@@ -8038,6 +8038,7 @@ begin
lRow^.Height := AData.Height;
lRow^.RowHeightType := AData.RowHeightType;
lRow^.FormatIndex := AData.FormatIndex;
lRow^.Hidden := AData.Hidden;
ChangedRow(ARow);
end;
@@ -8114,6 +8115,7 @@ begin
lCol^.Width := AData.Width;
lCol^.ColWidthType := AData.ColWidthType;
lCol^.FormatIndex := AData.FormatIndex;
lCol^.Hidden := AData.Hidden;
ChangedCol(ACol);
end;

View File

@@ -1618,6 +1618,7 @@ var
c, c1, c2: Cardinal;
w: Word;
xf: Word;
flags: Word;
lCol: TCol;
idx: Integer;
fmt: PsCellFormat;
@@ -1650,8 +1651,12 @@ begin
end else
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 }
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
sheet.WriteColInfo(c, lCol);
end;
@@ -2527,9 +2532,13 @@ begin
// Find the format with ID 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
// 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);
end;

View File

@@ -1172,7 +1172,10 @@ begin
end else
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
sheet.WriteColInfo(col, lCol);
end;
@@ -1979,8 +1982,12 @@ begin
end;
end;
{ Row visibility }
s := GetAttrvalue(ANode, 'hidden');
lRow.Hidden := StrIsTrue(s);
{ 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);
end;