PdfTableSetFlags(tblHandle As Integer, row As Integer, column As Integer, flags As Integer) As Boolean

 

Sets the flags for a cell.

 

 

Parameters:

 

Name

Type

Description

tblHandle

Integer

The identification number (handle) of a table,

obtained from the PdfTableCreate function.

row

Integer

The row index of the cell where the flag will be applied to.

If row is -1, all rows are modified.

First row index starts with 0.

column

Integer

The column index of the cell where the flag will be applied to.

If column is -1, all columns are modified.

First column index starts with 0.

flags

Integer

0

Default

1

Static; avoids the deletion of contents

2

HeaderRow; header rows are the first rows which are drawn after a page break occurred. It is possible to mark more than one row as header row

4

This flag avoids line breaks in cells which contain text

8

If set, images and templates are scaled into the cell so that both sides fit into the given width and height. The aspect ratio will be preserved

16

If set, images are inserted in the native image color space

32

If set, the new flags are added to the current ones. If absent, the new flags override the previous value.

 

Sum values to apply more than one flag

 

Returns:

 

Type

Value

Description

Boolean

True or False

Returns True when flags successfully have 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 '%PdfTableSetFlags%'

 

Example XojoScript:

 

Dim width As Double = 150.0

Dim rows As Integer = 50

Dim x,y As Double = 30.0

Dim pageCounter As Integer = 0

 

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

 

// sets a predefined page or paper format

Call PdfSetPageformat("E6")  // 312.0 x 439.0

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

PdfSetFont("Arial","Regular",10.0) // Set output font

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

pageCounter = pageCounter + 1  // increase page counter

Call PdfWriteText(x,y,"Page " + Str(pageCounter)) // write page number

 

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

If hTbl >= 0 Then

Call PdfTableSetColumnWidth(hTbl, 0, 20.0, False) // Set width of first colum, the last column autoadjusts

Call PdfTableSetFont(hTbl,-1, -1, "Arial", 10.0, "Regular") // Set Font, Size and Style for table

Call PdfTableSetBorderWidth(hTbl,-1, -1, 0.0, 0.5, 0.0, 0.5) // Set outer border

Call PdfTableSetGridWidth(hTbl, 0.5,0.5) // Set inner gridlines

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

Dim rowNum As Integer = 0 // Hold number of PDFTableRows created

rowNum = PdfTableAddRow(hTbl) // Add header row

 

// All columns of first row are set as headers

Call PdfTableSetflags(hTbl,rowNum,-1,2) 

 

// Add header text

Call PdfTableSetCellText(hTbl,rowNum, 0, "Left",   "Top", "NO.")

Call PdfTableSetCellText(hTbl,rowNum, 1, "Right",  "Top", "ITEM")

 

// Add all rows to table and insert some text to 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

y = y + 30.0 // Set new vertical position

 

Do // Now draw table to pdf and add pages if necessary

Call PdfTableDraw(hTbl,x,y,250.0) // 250.0= Maximum height of table, 0.0 = avoid pagebreaks

 

If PdfTableHaveMore(hTbl) Then

Call PdfEndpage // Terminate page

Call PdfAppend  // Add a new page

y = 30.0 // Reset vertical position

PdfSetFont("Arial","Regular",10.0) // Define font for new page and write text

pageCounter = pageCounter + 1  // Increase page number

Call PdfWriteText(x,y,"Page " + Str(pageCounter)) // write page number

y = y + 30.0 // Set vertical position for table to continue

PdfTableSetPdf(hTbl) // Expand table to new pdf page

Else

Exit  // terminate loop

End If

Loop

End If // hTbl >= 0

Call PdfcloseFile // Finalize PDF

Call pdflaunch // Show it to the user

End If