TOExportTemplate

Description

TOExportTemplate is the main class of the OExport template engine.

Properties

NameTypeDescription
StatusTOExportTemplateStatus
  • etsLoading: Load the template into the Template property. Then call LoadTemplate.
  • etsProcessingDocument: Document-wide template tags are processed.
  • etsProcessingRows: Row template tags are processed.
  • etsSaving: Save the generated document. Use the Document property.
TemplateTOExport Load the template into this object.
You can use Template only when the Status is etsLoading (right after creating TOExportTemplate).
DocumentTOExport This object holds the generated document.
You can use Document only when the Status is etsSaving (after you call FinalizeDocument).
ProcessRowsTOExportTemplateProcessRowsList This object holds object with information about current row processing.
You can use ProcessRows only when the Status is etsProcessingRows (after you call StartProcessingRows).

Functions for processing document-wide tags

function ReplaceSqlValue(const aOldSqlValue, aNewSqlValue: OWideString; const aNewCellClass: TExportCellClass): Integer;
Replace an old cell tag (in SQL format) with a new value (also in SQL format) and transform the target cell into the aNewCellClass type. All cells with the aOldSqlValue tag will be replaced across all sheets!
You can use this function only when the Status is etsProcessingDocument.
Use the functions from the FormatSQL unit to convert numbers, dates etc. to SQL and vice versa!
function ReplaceFormula(const aOldSqlValue, aNewFormula: OWideString; const aNewCellClass: TExportCellClass): Integer;
Replace an old cell tag (in SQL format) with a new value (formula) and transform the target cell into the aNewCellClass type. All cells with the aOldSqlValue tag will be replaced across all sheets!
You can use this function only when the Status is etsProcessingDocument.
Use the functions from the FormatSQL unit to convert numbers, dates etc. to SQL and vice versa!
function FindCellsBySqlValue(const aOldSqlValue: OWideString; out aCells: TExportCellArray): Integer;
Find cells with the aOldSqlValue across all sheets and return them in an array. The result value is the array length.
The aCells array is emptied before finding cells.
You can use this function only when the Status is etsProcessingDocument.
function FindCellsBySqlValueContinue(const aOldSqlValue: OWideString; var aCells: TExportCellArray): Integer;
Find cells with the aOldSqlValue across all sheets and return them in an array. The result value is the array length.
The aCells array is not emptied before finding cells but the found cells are added to the aCells array.
You can use this function only when the Status is etsProcessingDocument.
function FindSingleCellBySqlValue(const aOldSqlValue: OWideString): TExportCell;
Find the first cell with the aOldSqlValue across all sheets and return it.
You can use this function only when the Status is etsProcessingDocument.

Functions for processing rows

procedure StartProcessingRows(const aOldSqlValues: Array of OWideString);
Start processing rows with tags specified in aOldSqlValues. You must specify all tags in aOldSqlValues that will be processed as a row!
This function call changes the status to etsProcessingRows.
procedure FinishProcessingRows;
Finish processing rows.
This function call changes the status to etsProcessingDocument.

Functions for initializing and finalizing the document

procedure LoadTemplate;
Call this method after you have loaded the template into the Template object.
This function call changes the status to etsProcessingDocument.
procedure FinalizeDocument;
Call this method after you have processed all template tags and want to save the generated document.
This function call changes the status to etsSaving.
After this call you will be able to access the generated document in the Document property.
Categories