Field-Map Scripting

4.6.3.9 AutofitRow

AutoFitRow procedure


Prototype:

procedure AutofitRow(const row1,row2 :integer; const keepHeightAutomatic :boolean; const adjustment :double);

Description:

Autofits a row so it adapts its height to show all the text inside.  

Syntax:

xls.AutofitRow(col1,row2,keepHeightAutomatic,adjustment);  


Part

Description


xls

Variable declared as an instance of the TExcelWrapper class


row1

Variable declared as integer that represents row number of the first row to autofit


row2

Variable declared as integer that represents column number of the last row to autofit


keepHeightAutomatic

Variable declared as boolean. If true, rows will be still autoheight when you open the file in Excel, so Excel will recalculate the values, probably changing the page breaks. If you set it to false, rows will be fixed in size, and when you open it on Excel they will remain so.


adjustment

Variable declared as double. You will normally want to set this parameter to 1, which means that autofit will be made with standard measurements.

If you set it to for example 1.1, then rows will be adjusted to 110% percent of what their calculated height was.

Use this parameter to fine-tune autofiting, if for example rows are too small when opening the file in Excel.

Return value:

none


See also:

MergeCells , SetTextOrientation , Align , DrawBorders , FormatCells , AddUserFormat , AutofitCol , AutofitRow , SetOptimalColWidth , SetColWidth ,SetDefaultColWidth,SetRowHeight, SetDefaultRowHeight , SetColWidth_mm , SetRowHeight_mm , GetTextWidth , GetTextHeight , GetCellWidth, Complex example


Example:

Var
  Row, Rows, Cols:integer;
  xls :TExcelWrapper;
Begin
  {document preparation}
  //...
  {managing worksheets}
  //...
  {setting cell values}
  //...  
  
  {formatting cells examples}
  xls.AutofitCol(1,Cols,true,1.05); 
  xls.AutofitRow(1,Rows,true,1.05); 
  
  xls.SetRowHeight(1,1,15);
  xls.SetColWidth_mm(3,Cols-2,20.00);  
  xls.SetOptimalColWidth(Cols-2,Cols);

  {document saving / previewing}
  //...
End.