KeepRowsTogether
Prototype: |
procedure KeepRowsTogether(const R1,R2 :integer; const Level_ :integer; const ReplaceBiggerLevels_ :boolean); |
|
Description: |
Tells the document that it must try to keep together the rows between row1 and row2 (inclusive) when printing. This method does nothing to the resulting Excel file since this is not an Excel feature. To actually do something, you need to call AutoPageBreaks after calling this method. |
|
Syntax: |
xls.KeepRowsTogether(1,r,1,false); |
|
Part |
Description |
|
R1 |
Variable declared as integer. It represents the first row of the group you want to keep together. |
|
R2 |
Variable declared as integer. It represents the last row of the group you want to keep together. |
|
Level |
Variable declared as integer. Set this parameter to 0 to remove the condition to keep rows together. Any bigger than zero value will mean that the rows must be kept together. You can use more than one level to try to keep different groups together. If all rows cannot be kept together in one page, it will try to keep as much rows with higher levels as possible. |
|
ReplaceBiggerLevels |
Variable declared as booloean. If true, all existing level values in the row range will be replaced. If false, the new level values will be written only if they are bigger than the existing ones. You can use the false setting to set many values in any order. For example, if you first call KeepRowsTogether(2, 3, 5, false) and then KeepRowsTogether(1, 10, 1, false), rows 2 and 3 will keep the level in 5. If you did so with this parameter true, the second call would replace the levels of rows 2 and 3 to level 1, making all row levels between 1 and 10 equal to 1. |
|
Return value: |
none |
|
See also:
Landscape , SetPrintMargins , SetHeader , SetFooter , SetHeaderAndFooter , SetFirstHeaderAndFooter , SetTitleRows , SetTitleRowsAndCols , InsertHPageBreak , InsertVPageBreak , CreateHeaderOfTableContent , CreateTableOfContent , AddBackToTableOfContent , SetPrintArea , RowCount , ColCount , Header and footer codes , Predefined paper sizes, KeepColsTogether, KeepRowsTogether, AutoPageBreaks, PrintNumberOfHorizontalPages, PrintNumberOfVerticalPages, PrintToFit, Complex example
Example:
Var
Row, Rows, Cols:integer;
xls :TExcelWrapper;
Begin
{document preparation}
//...
{managing worksheets}
{setting cell values}
xls.Landscape:=true;
xls.SetPaperSize('A4');
xls.SetPrintArea(1,1,Cols, Rows);
xls.SetPrintMargins(25,25,20,25,10,10);
xls.InsertHPageBreak(10,true);
{making the sheet fit in one page of width }
xls.PrintNumberOfHorizontalPages:=1;
xls.PrintToFit:=true;
{document saving / previewing}
//...
End.
© 2024 IFER-Monitoring and Mapping Solutions