PdfTableSetCellText (tblHandle As Integer, row As Integer, column As Integer, hAlign As String, vAlign As String, celltext As String) As Boolean

 

Sets the text of a cell.

 

 

Parameters:

 

Name

Type

Description

tblHandle

Integer

The identification number (handle) of a table,

obtained from the PdfTableCreate function.

row

Integer

The index of the row to set cell padding, first row is 0.

column

Integer

The index of the column to set cell padding, first column is 0.

hAlign

String

Horizontal alignment = left, center, right, justify

vAlign

String

Vertical alignment = bottom, center, top

cellText

String

The text to be written into the cell

 

Returns:

 

Type

Value

Description

Boolean

True or False

Returns True when the text successfully has been written to the cell

Returns False upon failure

 

Available in:

 

WindowMain

WindowLink

YES

YES

 

Used in:

 

XojoScript Name

GUID

Create Seminar Invoice With Slip As PDF

739DA58E-17EE-41CE-BB54-E7362CFE17D4

Create Seminar Invoice As PDF

2C3F7F29-A29A-4338-ACF5-51894B709DA5

 

Hint: You can find references to XojoScripts which make use of this function by sending the following SQL statement to the database:

Select id,GUID, ScriptName,ScriptCode from im_scripts where ScriptCode Like '%PdfTableSetCellText%'

 

Example XojoScript:

 

Dim width As Double = 200.0

Dim rows As Integer = 3

Dim x,y As Double = 30.0

 

If PdfStart("testfile.pdf") > 0 Then

 

// Set top top-left as 0,0 coordinates

PdfSetPageCoordsTopDown

 

// Set output font and color

PdfSetFont("Arial","Regular",10.0)

Call PdfSetFillColor("&c00000000") // black textcolor

 

Dim hTbl As Integer = PdfTableCreate(rows,2,width,9.0)

If hTbl >= 0 Then

 

// Set width of first colum, the last column autoadjusts

Call PdfTableSetColumnWidth(hTbl, 0, 20.0,       False)

 

// Set Font, Size and Style for table

Call pdfTableSetFont(hTbl,-1, -1, "Arial", 10.0, "Regular")

 

// Set outer border

Call PdfTableSetBorderWidth(hTbl,-1, -1, 0.0, 0.5, 0.0, 0.5)

 

// Set inner gridlines

Call PdfTableSetGridWidth(hTbl, 0.5,0.5)

 

// PdfTableSetCellPadding(table,row,column,left,top,right,bottom)

Call PdfTableSetCellPadding(hTbl,-1, 1, 5.0, 0.0, 5.0, 0.0) // column 2 (1st column is 0)

 

// Hold number of PDFTableRows created

Dim rowNum As Integer = 0

 

// Add rows and insert some text to cells

For i As Integer = 0 To rows-1

// Add rows

rowNum = PdfTableAddRow(hTbl)

Dim cnt As String = Str(rowNum+1)

 

// Add some text

Call PdfTableSetCellText(hTbl,rowNum, 0, "Left",   "Top", cnt)

Call PdfTableSetCellText(hTbl,rowNum, 1, "Right",  "Top", "Item" + cnt)

Next

 

// Draw the table out to pdf

Call PdfTableDraw(hTbl,x,y,0.0) // 0.0 = avoid pagebreaks

 

End If // hTbl >= 0

 

// Finalize PDF

Call PdfcloseFile

 

// Open PDF in default viewer

Call Pdflaunch

 

End If // PdfStart("testfile.pdf")