Field-Map Scripting

4.6.2.8 SetHTMLAndMerge

SetHTMLAndMerge procedure


Prototype:

procedure SetHTMLAndMerge(const row1,col1, row2, col2 :integer;const Value :string;const Format_ :string;const Borders_ :string;const BorderStyle_ :string);

Description:

Adds a new image to the active sheet.

Syntax:

xls.SetHTMLAndMerge(row1, col1, row2, col2, value,format,borders,borderstyle);  


Part

Description


xls

Variable declared as an instance of the TExcelWrapper class


Row1, Col1, Row2, Col2

Variables declared as integer that represent the cells to be merged


Value

Variables declared as string that represents text


Format

Variable declared as string that represents the format name. Default formats are: Default, DefaultCentered, DefaultIndented, DefaultWrapped, DefaultCenteredWrapped, Bold, BoldCentered, ColCaption, ColCaptionItalic, MainTitle, Dec0, Dec1, Dec2, Dec3, Dec4, Dec5, Dec6


Borders

Variable declared as string that defines which parts of the borders will be applied. The value can be set to one of the following constants:

LEFT,RIGHT,TOP,BOTTOM


BorderStyle

Variable declared as string that represents border style. The value can be set to one of the following constants:

HAIR,THIN,MEDIUM,THICK,DOUBLE

Return value:

none


See also:

SetFormula, GetCellValue, AddImage ,AddImageExt, SetHTML, SetHTMLAndMerge, Complex example


Example:

Var
  Row, Rows:integer;
  v:variant;
  xls :TExcelWrapper;
Begin
  {document preparation}
  //...
  {managing worksheets}
  //...  
  {set cell values examples}
  xls.SetValueAndMerge(Row,4,Row,5,'Species','ColCaption','','');
  inc(Row);
  xls.SetValue(Row,4,'Species ID','ColCaption','','');
  xls.SetValue(Row,5,'Species value','ColCaption','','');
  inc(Row);
  xls.SetValue(Row,4,ValueAsInteger['IDSpecies'],'DEC0','','');
  xls.SetValue(Row,5,ValueAsString['Species'],'TXT','','');
  xls.SetHTML(Row,20,'Volume, m<sup>3</sup>','Dec2','',''); 
  inc(Row)
  //...
  {get cell value example}
  v:=xls.GetCellValue(Row-1,5);
  
  xls.SetValue(Row, 4 , format('Number of trees per plot ID %d: ',[PlotID]), 'TXT','',''); 
  
  {set formula example}
  xls.SetFormula(Row, 5 ,format('=SUM(R[-%d]C:R[-1]C)',[Rows]),'DEC0','R1C1');
  
  {add image example}
  xls.AddImage(ProjectDir+'Pictures\LogoFirmy.png', 6,1,12,20);
  xls.AddImageExt(ProjectDir+'Misc\HlavickaFirmy.png',1,nCol-5,1,nCol,'RIGHT','CENTER',0.02,0.02,0.02,0.02);
  {document saving / previewing}
  //...
End.