You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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

    Name

    Description

    AltRowFillColor

    The background color for alternate table rows (Striped theme)

    AltRowTextColor

    The text color for alternate table rows (Striped theme)

    CellPadding

    Cell padding

    CellWidth

    Cell width

    ColumnCount

    The number of columns in the table

    ComponentClassName

    ComponentClassName is the name of the component's class. Inherited from Object (PRIM_OBJT)

    ComponentMembers

    ComponentMembers provides access to all the member components of this component Inherited from Object (PRIM_OBJT)

    ComponentPatternName

    ComponentPatternName is used to qualify the class of the component. Inherited from Object (PRIM_OBJT)

    ComponentTag

    Generic space allowing a value to be stored for the instance Inherited from Object (PRIM_OBJT)

    ComponentType

    ComponentType gives you access to the type information about the component Inherited from Object (PRIM_OBJT)

    ComponentTypeName

    ComponentTypeName is the fully qualified name of the component's class. Inherited from Object (PRIM_OBJT)

    FillColor

    The background color for table row

    FontName

    The font for text content in the table

    FontSize

    The size of the font (in points) for text content in the table

    FontStyle

    The style (variant) of the font for text content in the table

    HAlign

    The horizontal alignment of text in table cells

    HeadFillColor

    The background color for table column heads

    HeadFontName

    The font for text content in table column heads

    HeadFontSize

    The size of the font (in points) for text content in column heads

    HeadFontStyle

    The style (variant) of the font for text in table column heads

    HeadHAlign

    The horizontal alignment of text in table column heads

    HeadMinCellHeight

    The minimum height of a cell in column heads

    HeadTextColor

    The color for text content in table column heads

    HeadVAlign

    The vertical alignment of text in table column heads

    MarginBottom

    The bottom margin of a table cell

    MarginLeft

    The left margin of a table cell

    MarginRight

    The right margin of a table cell

    MarginTop

    The top margin of a table cell

    MinCellHeight

    The minimum height of a cell in the table body

    MinCellWidth

    The minimum width of a cell in the table body

    Name

    Name identifies the component Inherited from Object (PRIM_OBJT)

    Overflow

    The action to take when content overflows cell width

    Owner

    Owner owns this component Inherited from Object (PRIM_OBJT)

    PageBreak

    Whether to split tables onto multiple pages if table height is larger than page height

    Parent

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

    RowPageBreak

    Whether to split a row onto multiple pages if row height is larger than page height

    ShowFoot

    When to show the table footer

    ShowHead

    When to show the table head

    StartY

    Where the table should start to be printed (a margin top value for the first page only)

    TableLineColor

    Table line color

    TableLineWidth

    Table line width

    TableWidth

    Table width

    TextColor

    Text color for table body content

    Theme

    Table theme

    VAlign

    The vertical alignment of text in a table cell

    Events

    Name

    Description

    CreateInstance

    CreateInstance is signalled when an instance of a component is created [Inherited from PRIM_PDF.AutoTable (PRIM_PDF.AutoTable)

    DestroyInstance

    DestroyInstance is signalled when an instance of a component is about to be destroyed [Inherited from PRIM_PDF.AutoTable (PRIM_PDF.AutoTable)

    Methods

    Name

    Description

    AddColumn

    Adds a column to the table Column

    AddRow

    Adds a row to the table Row

    CreateColumn

    Creates an AutoTable column Result

    CreateRow

    Creates an AutoTable row Result

    Write

    Writes the AutoTable to the PDF document

    See also

    All Component Classes
    Technical Reference
  • No labels