Table From API Module

Types

A3DPDFTableStyleData

A3DPDFTableCellDescData

A3DPDFTableRowDescData

A3DPDFTableDescData

Functions

A3DStatus

A3DPDFTableCellDescCreate

A3DStatus

A3DPDFTableRowDescCreate

A3DStatus

A3DPDFTableCreateFromDesc

Detailed Description

group a3d_pdf_tablefromapi_module

Module to create tables on a PDF page, based on API definition.

This module describes the functions and structures that allow you to define tables on a PDF page, based on an API definition.

With HOOPS Publish API, a table is defined on three levels: the cell, the row, and the table. Obviously a table contains a set of rows, and a row contains a set of cells. Then the style applied can be defined at cell level, at row level, or at table level.

For this, use the function A3DPDFTableCellDescCreate to create cells. Use the function A3DPDFTableRowDescCreate to create a row, the cells included being specified with m_ppCells member. Finally use the function A3DPDFTableCreateFromDesc to create the table, the rows being included with m_ppRows member. Then, the table is positioned on the PDF page using the function A3DPDFPageInsertTable.

As an example, the following simple table ../_images/sampletable.png

is defined with HOOPS Publish API by creating three rows of three cells each. Two different styles are specified: one for the first row and one for second and third row.

The styles are defined with code such as

A3DPDFTableStyleData stylerow0;
A3D_INITIALIZE_DATA(A3DPDFTableStyleData, outStyle);
outStyle.m_iFontSize = fontSize;
outStyle.m_pcFontName = "Helvetica";
outStyle.m_eHorizAlignment = kA3DPDFTableAlignHCentered
outStyle.m_iRowHeight = 20;
outStyle.m_iColumnWidth = 70;
The cells are defined with code such as
std::vector<A3DPDFTableCellDesc*> aCells;
A3DPDFTableCellDesc* pTableCellDesc;
A3DPDFTableCellDescData sTableCellDescData;
A3D_INITIALIZE_DATA(A3DPDFTableCellDescData, sTableCellDescData);
sTableCellDescData.m_pcCellString = "Bob";
A3DPDFTableCellDescCreate(&sTableCellDescData, &pTableCellDesc);
aCells.push_back(pTableCellDesc);
The rows are defined with code such as
std::vector<A3DPDFTableRowDesc*> aRows;
A3DPDFTableRowDesc* pTableRowDesc;
A3DPDFTableRowDescData sTableRowDescData;
A3D_INITIALIZE_DATA(A3DPDFTableRowDescData, sTableRowDescData);
sTableRowDescData.m_ppCells = (A3DPDFTableCellDesc**)malloc(aCells.size() * sizeof(A3DPDFTableCellDesc**));
for (size_t i = 0; i < aCells.size(); i++)
    sTableRowDescData.m_ppCells[i] = aCells[i];
sTableRowDescData.m_pStyle = &stylerow0;
sTableRowDescData.m_iNumberOfCells = static_cast<A3DUns32>(aCells.size());
A3DPDFTableRowDescCreate(&sTableRowDescData, &pTableRowDesc);
aRows.push_back(pTableRowDesc);
then the table is defined with:
A3DPDFTableDescData sTableDescData;
A3D_INITIALIZE_DATA(A3DPDFTableDescData, sTableDescData);
sTableDescData.m_ppRows = (A3DPDFTableRowDesc**)malloc(aRows.size() * A3DUns32(sizeof(A3DPDFTableRowDesc*)));
sTableDescData.m_iNumberOfRows = static_cast<A3DUns32>(aRows.size());
for (size_t i = 0; i < aRows.size(); i++)
    sTableDescData.m_ppRows[i] = aRows[i];
A3DPDFTableCreateFromDesc(pDoc, &sTableDescData, &pTable);

Function Documentation

A3DStatus A3DPDFTableCellDescCreate(const A3DPDFTableCellDescData *pCellDescData, A3DPDFTableCellDesc **ppCellDesc)

Function to create a cell in a table on a PDF page, from an API definition.

Version

23.0

Parameters
  • pDoc[inout] The Document object to work with.

  • pCellDescData[in] The cell description.

  • ppCellDesc[out] The Table object created.

Return values

A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DPDFTableRowDescCreate(const A3DPDFTableRowDescData *pRowDescData, A3DPDFTableRowDesc **ppRowDesc)

Function to create a row in a table on a PDF page, from an API definition.

Version

23.0

Parameters
  • pDoc[inout] The Document object to work with.

  • pRowDescData[in] The row description.

  • ppRowDesc[out] The Table object created.

Return values

A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DPDFTableCreateFromDesc(A3DPDFDocument *pDoc, const A3DPDFTableDescData *pTableData, A3DPDFTable **ppTable)

Function to create a table on a PDF page, from an API definition.

The table object is primarily created with this function, and it should be positioned on the page with the function A3DPDFPageInsertTable.

Version

23.0

Warning

The initialization function A3DPDFInitializePDFLibAndResourceDirectory must be called before using this function.

Parameters
  • pDoc[inout] The Document object to work with.

  • pTableData[in] The table description.

  • ppTable[out] The Table object created.

Return values

A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code