diff --git a/components/fpspreadsheet/source/common/fpspreadsheet.pas b/components/fpspreadsheet/source/common/fpspreadsheet.pas index aa07cc980..35e273327 100644 --- a/components/fpspreadsheet/source/common/fpspreadsheet.pas +++ b/components/fpspreadsheet/source/common/fpspreadsheet.pas @@ -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; diff --git a/components/fpspreadsheet/source/common/xlscommon.pas b/components/fpspreadsheet/source/common/xlscommon.pas index bc76ed899..5b5b7f144 100644 --- a/components/fpspreadsheet/source/common/xlscommon.pas +++ b/components/fpspreadsheet/source/common/xlscommon.pas @@ -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; diff --git a/components/fpspreadsheet/source/common/xlsxooxml.pas b/components/fpspreadsheet/source/common/xlsxooxml.pas index ed360406e..fe771e3e0 100644 --- a/components/fpspreadsheet/source/common/xlsxooxml.pas +++ b/components/fpspreadsheet/source/common/xlsxooxml.pas @@ -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;