www.gnostice.com 

 

TextOut procedure (TgtCustomDocumentEngine)

TgtCustomDocumentEngine

Top 

Places a line of text on the image.

 

function TextOut(Text: WideString): Double; virtual; overload;

procedure TextOut(Row, Column: Integer;Text: WideString; Alignment: TgtHAlignment; CellType: TgtCellType);

procedure TextOut(X, Y: Double; Text: WideString); virtual; overload;

 

 

Description

 

Call TextOut with only the WideString parameter to place text as paragraph. This method should be called between calls to BeginPara and EndPara. TextFormatting property can be used to specify options for paragraph rendering.

 

Return: Remaining space on the page is returned.

 

Call TextOut with ColumnNo to draw a text in a table. ColumnNo is Zero based.Allows you to use the General cell type in Excel by allowing a property Alignment to be set to 'haGeneral'.

TableSettings property can be used to specify options for table rendering.

 

Call TextOut with X,Y coordinates to place the string at a specified location.

 

Example:

 

Delphi:

procedure TForm1.Button1Click(Sender: TObject);

var

List1: TList;

J, I: Integer;

begin

with gtPDFEngine1 do

begin

   FileName := 'C:\TextOut';

   Page.PaperSize := A4;

   //... Set any other document properties as required

   TableSettings.RowHeight := 1;

   TableSettings.ColumnWidth := 1;

   TableSettings.EnableTitle := False;

   BeginDoc;

     Brush.Color := clYellow;

     Brush.Style := bsVertical;

     //... Set any text properties as required

     BeginPara;

       TextOut('eDocEngine delivers unprecedented power to Delphi & C++Builder');

     EndPara;

     TextOut(0, 0.5, 'This is a sample. Visit www.gnostice.com');

     //List1 is a TList variable

     List1 := BeginTable(0, 1, 5);

       for J := 0 to 3 do //4 rows in the table

       begin

         NewRow;

         for I := 0 to 4 do

           TextOut(I, 'Row No. ' + IntToStr(J+1) + ' ' + 'Column No. ' + IntToStr(I+1));

       end;

     EndTable;

   EndDoc;

end;

end;

 

C++Builder:

 

gtPDFEngine1->FileName = "C:\\TextOut";

gtPDFEngine1->Page->PaperSize = A4;

//... Set any other document properties as required

gtPDFEngine1->BeginDoc();

gtPDFEngine1->Brush->Color = clYellow;

gtPDFEngine1->Brush->Style = bsVertical;

//... Set any text properties as required

gtPDFEngine1->TextOut(0, 0, "This is a sample. Visit www.gnostice.com");

gtPDFEngine1->BeginPara();

gtPDFEngine1->TextOut("eDocEngine delivers unprecedented power to Delphi & C++Builder");

gtPDFEngine1->EndPara();

//List1 is a TList variable

List1 = gtPDFEngine1->BeginTable(0, 0, 5);

for(J=0;J<=3;J++)//4 rows in the table

{

gtPDFEngine1->NewRow();

for(I = 0; I <= 4; I++)

gtPDFEngine1->TextOut(I, "Row No. " + IntToStr(J+1) + ' ' + "Column No. " + IntToStr(I+1));

}

gtPDFEngine1->EndTable();

gtPDFEngine1->EndDoc();