Field-Map Scripting

4.6.3.7 AddUserFormat

AddUserFormat procedure


Prototype:

procedure AddUserFormat( const FormatName :string;

                            const FontSize :integer;

                            const FontStyle :string;

                            const FontColor :string;

                            const DecimalPlaces :integer;

                            const Indent :integer;

                            const HorizontalAlignment :string;

                            const VerticalAlignment :string;

                            const WrapText :boolean);


Description:

Adds a new format to a format list.

Syntax:

xls.AddUserFormat(FormatName,FontSize,FontStyle,FontColor,DecimalPlaces,Indent,HorizontalAlignment,VerticalAlignment,WrapText);


Part

Description


xls

Variable declared as an instance of the TExcelWrapper class


FormatName

Variable declared as string that represents the format name to be added to the format list.


FontSize

Variable declared as integer that represents fornt size. Set -1 to keep the defaut font size.


FontStyle

Variable declared as string that represents font style. The value can be set to one of the following constants: BOLD, ITALIC, UNDRELINE


FontColor

Variable declared as integer that represents column number of the last cell in the range


DecimalPlaces

Variable declared as integer that specifies the number of decimal places display numbers.


Indent

Variable declared as boolean. Set true to indent cell contents from any edge of the cell.


HorizontalAlignment

Variable declared as string that represents horizontal align on the cell. The value can be set to one of the following constants:

LEFT,RIGHT,CENTER


VerticalAlignment

Variable declared as string that represents vertical align on the cell. The value can be set to one of the following constants:

TOP, BOTTOM, CENTER


WrapText

Variable declared as boolean. Set true to wrap text to fit the column width.

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}
  //...
  
  {------------------Formats-------------------}
  xls.AddUserFormat('Title_h1',14,'BOLD','0,0,0',0,0,'CENTER','CENTER',false);       
  xls.AddUserFormat('Title_h2',12,'','0,0,0',0,0,'CENTER','CENTER',false);
  
  {setting default cloumn width abd height}
  xls.SetDefaultColWidth(3500);
  xls.SetDefaultRowHeight(15);
  
  {setting cell values}
  //...  
  
  {formatting cells examples}
  xls.MergeCells(Row,1,Row,Cols);
  xls.DrawBorders(Row,1,Row,Cols,'BOTTOM','THIN');
  xls.SetTextOrientation(Row,1,Row,Cols,45);
  xls.FillColor(Row,1,Row,Cols,clOceanGreen); 
     
  xls.FormatCells(Row+1,1,Row+1,Cols,'BOLD',2,true,'RIGHT','CENTER');
  
  xls.Align(Row+3,1,Row+3,Cols,'LEFT','CENTER');

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