Categories > OpenTBS with DOCX >

Open TBS docx table paging

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Paul F
Date: 2014-02-11
Time: 17:55

Open TBS docx table paging

I appreciate your time,  Here is my issue.
I have a docx  with a two row 6 col  definition.   In side I have TBS tags and also docx devel controls.
My goal was to have the table recreate for each record from mysql / php result.   That is working fine and well very quick.  But I could not see an easy way to indicate a "break" after x records ... In my case I wish to initiate a docx page break after every 4th record.... to have the display result look nice.   Now I could not see in the documentation any way to insert a parm to break so I tried to become creative.   
I put my table which contains "[lpac.student_id; block=tbs:table; p1=[lpac_break.break_group]]" and inserted this table inside another table with "[lpac_break.break_group; block=tbs:page]"  which contains the #number of paging indicators counts. So for every change in the page counter....  a new break will occur  and the table will filter the record array using that page break counter value.    Ok....  this all work very well no problems except when the record set increases  let us say 80 records    divided by 4 rec page   thus twenty page breaks and 4 table created for each page.   This becomes very very very slow during the merge process...  I looked into the tbs_class and narrowed the function to  "        // Search the block                                                       
        $LocR = $this->meth_Locator_FindBlockLst($Txt,$this->_CurrBlock,0,$SpePrm);

This is where the most time is taken.... apparently searching the blocks to be created and the record stream.

I apologize for being long winded but I wish to add all relevant information..... 

Any thoughts / help on how to speed this up....   Am I going down the wrong path  .......    can we created some type of parm in the system which can be passed to create/trigger a docx page break

Thank you all,

Paul
By: Paul F
Date: 2014-02-11
Time: 18:33

Re: Open TBS docx table paging

Fyi  I removed the outer table  where the block:tbs:page was located and just placed that tag on the same page as the main table....   The paging still works but not any faster.
By: Skrol29
Date: 2014-02-11
Time: 23:58

Re: Open TBS docx table paging

Hi Paul,

I can see an easy way for your problem, but I did not test it.

I've noticed that if you put a page break in a cell of a table (using the paragraph property "page break before"), then this will makes Ms Word to do a page break at this row.

So the idea is to use this with a TBS block which is multi-sections.
Get your block defined on the row of the table, copy this row several times in order to have 4 identical rows. Each row must have a "block=tbs:row" so that will make 4 sections for the TBS block.
In the last row, put a "page break before" in some paragraph.

This way, the table will have a page break every 4 rows. Maybe the table will display only 3 rows on the first part because the page break is before.
By: Paul F
Date: 2014-02-12
Time: 03:31

Re: Open TBS docx table paging

Thank you Skrol29....

I am confused however.. so if I have a word doc table with 3 rows and 4 columns   and this table should be replicated per record......but I need for tables per page....

I should put a  for table layouts on each page  with a page break before in the first row first column of the first table?  and put each record tag representing  a tbs:tr...

Also can you type the exact syntax I would put in a row that does the page break before..... I am overlooking any example...

I really appreciate your help....been racking my brain.

Thank you,

Paul
By: Skrol29
Date: 2014-02-12
Time: 10:24

Re: Open TBS docx table paging

Hi Paul,

I did not resealed that you want one table per record. My tip still works but I have to change it a bit.

First you have to know that :
1) In a docx, a table (tbs:table) take the same place as a paragraph (tbs:p).
2) In Ms Word, if you try to insert a second table just after the first one then Ms Word will merge the two tables into a single one. In order to place a table just after another in Ms Word, you first have to insert a paragraph after the first table, then add the second table, then delete the paragraph between the two table. This will keep the two tables.

Here is a schema of the template you can do :

-----------------------------------------
|Table 1              | Column | Column |
[bmt;block=tbs:table] |        |        |
-----------------------------------------
-----------------------------------------
|Table 2              | Column | Column |
[bmt;block=tbs:table] |        |        |
-----------------------------------------
-----------------------------------------
|Table 3              | Column | Column |
[bmt;block=tbs:table] |        |        |
-----------------------------------------
/// page break here defined by paragraph (*) ///
-----------------------------------------
|Table 4 (*)          | Column | Column |
[bmt;block=tbs:table] |        |        |
-----------------------------------------

Note that :
- They are 4 tables having the same TBS block name ("bmt"). This makes a single TBS block with 4 sections. Each section is a Ms Word table.
- Tables are one after the others. If you add a paragraph between them, then the paragraph will be deleted during the merge by TBS. This is because sections are defined over a single table. If you want to keep the paragraph, then include the paragraph in the TBS section with "block=tbs:table+tbs:p" for example.
- The last table has a page-break (*) in the first cell. For doing this, put the cursor on the first cell of the table, then choose the paragraph properties (ribbon "Home", then block "Paragraph", then click on the small arrow in the right bottom, then go to tab "Line and page break", then select "Page break before").

By: Paul F
Date: 2014-02-12
Time: 17:36

Re: Open TBS docx table paging

My oh my...... that worked perfectly.....  :)

Man thank you.....  I am so dog gone impressed with this piece of logic......

My hat is off to you guys...

I am sure I will have more questions as I look at the many things this logic can do..... so until next time.

Thanks again,

Paul