简体   繁体   中英

OpenTBS / PHP - How can I create a multipage document(docx) in OpenTBS?

Scenario

I am trying to create more than one page in OpenTBS (.docx file) from a PHP array with each array element corresponding to a page of data.

Question

How can I insert new pages for every data element?

Any help would be appreciated.

PHP Code

    foreach($actionItems as $actionItem)
    {
                array_push($data, array(
                    'ActionItemID' => $actionItemID,
                    'ActionItemTitle' => $actionItemTitle,
                    'Assignor' => $assignorLastFirst,
                    'Criticality' => $criticality,
                    'Owner' => $ownerLastFirst,
                    'AltOwner' => $altOwnerLastFirst,
                    'AssignedDate' => $assignedDate,
                    'DueDate' => $originalDueDate,
                    'ECD' => $ecd,
                    'ClosureDate' => $closureDate,
                    'Team' => $team,
                    'Department' => $department,
                    'Source' => $source,
                    'Project_Phase' =>$projectPhase,
                    'ActionItemStatement' => $actionItemStatement,
                    'ClosureCriteria' => $closureCriteria,
                    'Notes' => $notes,
                    'ClosureStatement' => $closureStatement
                ));


        }

        $TBS->MergeBlock('a', $data);

Template Screenshot

页面模板

The solution is explained in the DOCX template of the OpenTBS demo provided in the OpenTBS package :

  1. Make sure that the first paragraph of the page has the property giving a page break before .
  2. Use a block defined with the alias tbs:page . This alias is given by OpenTBS and it helps to found the bounds of the page (or pages) according to the page-break defined in the paragraph properties

Example: [a.ActionItemID;block=tbs:page]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM