fpspreadsheet: Fix remaining pagebreak fails of ODS reader. All tests passed now.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7078 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2019-07-27 16:19:41 +00:00
parent 65a63b37d9
commit a66ccaf563
2 changed files with 18 additions and 7 deletions

View File

@ -97,7 +97,7 @@ type
FRichTextFontList: TFPList;
FRepeatedCols: TsRowColRange;
FRepeatedRows: TsRowColRange;
procedure ApplyColWidths;
procedure ApplyColData;
procedure ApplyStyleToCell(ACell: PCell; AStyleIndex: Integer);
function ApplyStyleToCell(ACell: PCell; AStyleName: String): Boolean;
function ApplyTableStyle(ASheet: TsBasicWorksheet;
@ -1110,9 +1110,10 @@ begin
FNumFormatList.Add('N0:');
end;
{ Creates for each non-default column width stored internally in FColumnList
a TCol record in the current worksheet. }
procedure TsSpreadOpenDocReader.ApplyColWidths;
{ Creates for each non-default column width as well as non-default column
property stored internally in FColumnList a TCol record in the
current worksheet. }
procedure TsSpreadOpenDocReader.ApplyColData;
var
colIndex: Integer;
colData: TColumnData;
@ -1128,6 +1129,15 @@ begin
sheet := FWorksheet as TsWorksheet;
defColWidth := sheet.ReadDefaultColWidth(FWorkbook.Units);
lastOccCol := sheet.GetLastOccupiedColIndex;
for i:=0 to FColumnList.Count-1 do begin
colData := TColumnData(FColumnList[i]);
if (colData.Col > lastOccCol) then begin
if colData.Hidden or colData.PageBreak then
lastOccCol := colData.Col
end;
end;
for i:=0 to FColumnList.Count-1 do
begin
colData := TColumnData(FColumnList[i]);
@ -1149,6 +1159,7 @@ begin
else
fmtIndex := 0;
}
// Prepare column record for the worksheet
colWidth := colStyle.ColWidth; // is already in workbook units
if SameValue(colWidth, defColWidth, COLWIDTH_EPS) then
@ -2651,7 +2662,7 @@ begin
// Apply table style
ApplyTableStyle(FWorksheet, tablestylename);
// Handle columns
ApplyColWidths;
ApplyColData;
// Page layout
FixCols(FWorksheet);
FixRows(FWorksheet);

View File

@ -479,10 +479,10 @@ begin
// to the DefaultRowHeight ...
sheet.WriteDefaultRowHeight(h, FWorkbook.Units);
// ... and delete all visible row records with default format.
// ... and delete all visible row records with default properties.
for r := sheet.Rows.Count-1 downto 0 do begin
lRow := PRow(sheet.Rows[r]);
if (lRow^.FormatIndex = 0) and not (croHidden in lRow^.Options) then
if (lRow^.FormatIndex = 0) and ([croHidden, croPageBreak] * lRow^.Options = []) then
sheet.RemoveRow(lRow^.Row);
end;
end;