PdfTableSetCellSpacing(tblHandle As Integer, row As Integer, column As Integer, left As Double, top As Double, right As Double, bottom As Double) As Boolean

 

Sets the cell spacing (space between cells), i.e. the outer margin of the table, a row or cells.

 

PdfTableSetCellSpacing controls the space between cells (outer margin) and PdfTableSetCellPadding controls the space

between the cell contents and the cell boundary including borders (inner margin).

 

 

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.

If row is -1, all rows are modified

column

Integer

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

If column is -1, all columns are modified

left

Double

Width of left cell spacing in points

top

Double

Height of top cell spacing in points

right

Double

Width of right cell spacing in points

bottom

Double

Height of bottom cell spacing in points

 

Returns:

 

Type

Value

Description

Boolean

True or False

Returns True when cell spacing successfully has been applied

Returns False upon failure

 

Available in:

 

WindowMain

WindowLink

YES

YES

 

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 '%PdfTableSetCellSpacing%'

 

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)

 

// Setting the cell spacing (space between cells)

// i.e. outer margin of the table, a row or cells

 

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

Call PdfTableSetCellSpacing(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 some contents into cells

For i As Integer = 0 To rows-1

rowNum = PdfTableAddRow(hTbl)

Dim cnt As String = Str(rowNum+1)

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")