PRIM_PDF.AutoTable (PRIM_PDF.AutoTable)

PDF generator AutoTable feature

Ancestors - Object (PRIM_OBJT)

Details

PDF generator feature to facilitate creating preformatted tables in your PDF report

Example

Creating an AutoTable.
   Evtroutine Handling(#FindContacts.completed)
      Define_Com Class(#PRIM_PDF) Name(#pdf)
      Define_Com Class(#PRIM_PDF.AutoTable) Name(#Table) Reference(*DYNAMIC) Theme(Striped) Columncount(3)
      Define_Com Class(#PRIM_PDF.AutoTableColumn) Name(#LastNameCol) Reference(*DYNAMIC)
      Define_Com Class(#PRIM_PDF.AutoTableColumn) Name(#FirstNameCol) Reference(*DYNAMIC)
      Define_Com Class(#PRIM_PDF.AutoTableColumn) Name(#CellPhoneCol) Reference(*DYNAMIC)
      Define_Com Class(#PRIM_PDF.AutoTableRow) Name(#Row) Reference(*DYNAMIC)
 
      #pdf.start
      #pdf.setFont Font('Roboto') Style(Bold)
      #pdf.setFontSize Size(16)
      #pdf.text Text('My Contacts Report') Left(14) Top(10)
 
      * Create AutoTable
      #Table <= #pdf.CreateAutoTable
 
      * Table level properties
      #Table.StartY := 15
      #Table.Overflow := LineBreak
      #Table.HeadFontName := 'Helvetica'
      #Table.HeadHAlign := Left
      #Table.HeadVAlign := Middle
      #Table.HeadFontSize := 12
      #Table.HeadFontStyle := Bold
 
      * Define table columns
      #LastNameCol <= #Table.CreateColumn
      #LastNameCol.HeadCaption := 'Last name'
      #Table.AddColumn Column(#LastNameCol)
 
      #FirstNameCol <= #Table.CreateColumn
      #FirstNameCol.HeadCaption := 'First name'
      #Table.AddColumn Column(#FirstNameCol)
 
      #CellPhoneCol <= #Table.CreateColumn
      #CellPhoneCol.HeadCaption := 'Cell Phone'
      #CellPhoneCol.HeadHAlign := Center
      #CellPhoneCol.HAlign := Center
      #Table.AddColumn Column(#CellPhoneCol)
 
      * Add table data
      Selectlist Named(#xContactsList)
         #Row <= #Table.CreateRow
 
         #Row.addCell Value(#xContactLastName)
         #Row.addCell Value(#xContactFirstName)
         #Row.addCell Value(#xContactMobilePhone)
 
         #Table.AddRow Row(#Row)
      Endselect
 
      * Write the AutoTable
      #Table.Write
 
      * Save the PDF report
      #pdf.save Filename('MyContacts.pdf')
   Endroutine

Properties

NameDescription
AltRowFillColorThe background color for alternate table rows (Striped theme)
AltRowTextColorThe text color for alternate table rows (Striped theme)
CellPaddingCell padding
CellWidthCell width
ColumnCountThe number of columns in the table
ComponentClassNameComponentClassName is the name of the component's class. Inherited from Object (PRIM_OBJT)
ComponentMembersComponentMembers provides access to all the member components of this component Inherited from Object (PRIM_OBJT)
ComponentPatternNameComponentPatternName is used to qualify the class of the component. Inherited from Object (PRIM_OBJT)
ComponentTagGeneric space allowing a value to be stored for the instance Inherited from Object (PRIM_OBJT)
ComponentTypeComponentType gives you access to the type information about the component Inherited from Object (PRIM_OBJT)
ComponentTypeNameComponentTypeName is the fully qualified name of the component's class. Inherited from Object (PRIM_OBJT)
FillColorThe background color for table row
FontNameThe font for text content in the table
FontSizeThe size of the font (in points) for text content in the table
FontStyleThe style (variant) of the font for text content in the table
HAlignThe horizontal alignment of text in table cells
HeadFillColorThe background color for table column heads
HeadFontNameThe font for text content in table column heads
HeadFontSizeThe size of the font (in points) for text content in column heads
HeadFontStyleThe style (variant) of the font for text in table column heads
HeadHAlignThe horizontal alignment of text in table column heads
HeadMinCellHeightThe minimum height of a cell in column heads
HeadTextColorThe color for text content in table column heads
HeadVAlignThe vertical alignment of text in table column heads
MarginBottomThe bottom margin of a table cell
MarginLeftThe left margin of a table cell
MarginRightThe right margin of a table cell
MarginTopThe top margin of a table cell
MinCellHeightThe minimum height of a cell in the table body
MinCellWidthThe minimum width of a cell in the table body
NameName identifies the component Inherited from Object (PRIM_OBJT)
OverflowThe action to take when content overflows cell width
OwnerOwner owns this component Inherited from Object (PRIM_OBJT)
PageBreakWhether to split tables onto multiple pages if table height is larger than page height
ParentThe component instance to which this instance is attached. The visual container for a control or the collector of a set of child instances Inherited from Object (PRIM_OBJT)
RowPageBreakWhether to split a row onto multiple pages if row height is larger than page height
ShowFootWhen to show the table footer
ShowHeadWhen to show the table head
StartYWhere the table should start to be printed (a margin top value for the first page only)
TableLineColorTable line color
TableLineWidthTable line width
TableWidthTable width
TextColorText color for table body content
ThemeTable theme
VAlignThe vertical alignment of text in a table cell

Events

NameDescription
CreateInstanceCreateInstance is signalled when an instance of a component is created Inherited from PRIM_PDF.AutoTable (PRIM_PDF.AutoTable)
DestroyInstanceDestroyInstance is signalled when an instance of a component is about to be destroyed Inherited from PRIM_PDF.AutoTable (PRIM_PDF.AutoTable)

Methods

NameDescription
AddColumnAdds a column to the table
Column
AddRowAdds a row to the table
Row
CreateColumnCreates an AutoTable column
Result
CreateRowCreates an AutoTable row
Result
WriteWrites the AutoTable to the PDF document

See also

All Component Classes

Technical Reference

LANSA Version 15, April 2020