By: william
Date: 2010-07-03
Time: 18:38
|
creating a multi-page document, reusing the same templateMy next project is to write a php script to create patient statements. I need to merge the same template with different patient data, creating a multi-page document oo file.
I can easily figure out how to create one patient's statement, but can't figure out how to repeatedly merge different data with the same template file, with the results of each merge going into one file. All assistance gratefully appreciated. bill |
|
By: Skrol29
Date: 2010-07-04
Time: 23:28
|
Re: creating a multi-page document, reusing the same templateHi Bill,
I don't know how to merge several document into a unique one. Nevertheless, it is possible to have a template which is merged with a new page break for each record. The result is the same. The template which is given with the demo does it. |
|
By: william
Date: 2010-07-05
Time: 11:52
|
Re: creating a multi-page document, reusing the same templateThe demo has a single document with a page break in the middle, if memory serves.
I can't figure a way to use that because I have n pages and do not know how many statements will be prepared until the end of the merge. I suppose I could write out each statement as a separate file, but that gets really difficult to print them. Maybe it would be better to write the file out as a mail merge and then merge them. Can OpenTBS write a mail merge file ? bill |
|
By: william
Date: 2010-07-05
Time: 14:44
|
Re: creating a multi-page document, reusing the same templateIt is not so simple as I would wish.
I could write a .csv file, but lose all the formatting - I would really like an OpenTBS solution. |
|
By: william
Date: 2010-07-05
Time: 15:02
|
Re: creating a multi-page document, reusing the same templateIdea:
Please excuse my relative ignorance of TBS, but... As source is modified as soon as a merge is done, is it feasible that I could: read in the template (OO), merge the fields and blocks, read in the template again (using the "+" parameter for "charset"), merge the fields and blocks again... If you see not obvious reason why this will not work, I will play with it, but I would like your opinion before I spend the time. Many thanks, bill |
|
By: Skrol29
Date: 2010-07-06
Time: 19:05
|
Re: creating a multi-page document, reusing the same templateHi Bill,
Unfortunately you cannot merge several documents using the "+" as the charset argument. Each OpenOffice document begin with XML entities that are specifics to the type of document, and includes lot of parameters related to the doc (styles, ...). If you just concatenate the XML contents this will produce a wrong XML content. I don't see the difficulty about adapting the demo template for your patient statements. The idea of this technical is to have a block "b" which begins with a page break, and finish where you want with a TBS tag. The bloc can be then merged with your statements. There will be a new page break before each statement, and statements even have several pages if needed. |
|
By: william
Date: 2010-07-07
Time: 12:37
|
Re: creating a multi-page document, reusing the same templateThank you for redirecting me, I will play with the demo and see what I can do.
|
|
By: william
Date: 2010-07-07
Time: 12:55
|
Re: creating a multi-page document, reusing the same templateThe demo takes one array and puts one row on each of several pages. Very clever.
Is it possible to have, on each page: several fields block a with multiple rows (a variable number) block b with multiple rows block c with multiple rows block d with multiple rows several more fields bill |
|
By: Skrol29
Date: 2010-07-07
Time: 15:59
|
Re: creating a multi-page document, reusing the same templateHi,
You can merge a main block, one row per page, and each row can contains itself several subsets of row to be merged. This is called sub-block in TBS. There is an example of sub-blocks in the example page. |
|
By: william
Date: 2010-07-07
Time: 16:54
|
Re: creating a multi-page document, reusing the same templateThanks, back to the documentation.
bill |
|
By: william
Date: 2010-08-04
Time: 12:38
|
Re: creating a multi-page document, reusing the same templateAlmost there: Thanks !
I have the subblocks part working well now (form the SubBlocks thread) but when I combine the example from "demo" for multi-page merge with the subblocks I get only the outer merge done: e.g: template
If I do not have the asb;block... statements in the template the subblocks merge fine, but on the same page. Any thoughts/suggestions ? Thanks in advance. bill |
|
By: william
Date: 2010-08-04
Time: 12:39
|
Re: creating a multi-page document, reusing the same templateIn my example I left out the --table end--, but it is there.
|
|
By: Skrol29
Date: 2010-08-04
Time: 13:40
|
Re: creating a multi-page document, reusing the same templateHi,
Use OpenTBS last version 1.3.2, there is a new debug mode which is very useful to check your template. Try it to see the source of the merged document, near by the sub blocks that are not merged. You'll probably discover that the code of the subblock is split by formating tags. |
|
By: william
Date: 2010-08-04
Time: 14:51
|
Re: creating a multi-page document, reusing the same templateHere is the debug output for the first table/subtable. You might see something that I am missing: (the text "fixed data) is a string in the templatejust before the table begins)
and the inner table does not: remains [asb_sub1.dos; block=table:table-row] bill |
|
By: Skrol29
Date: 2010-08-04
Time: 15:34
|
Re: creating a multi-page document, reusing the same templateStrange, indeed,
I assume you've got no error message. What is your TBS version ? It is given at the top of the debug information. |
|
By: william
Date: 2010-08-05
Time: 14:52
|
Re: creating a multi-page document, reusing the same template* OpenTBS version: 1.3.1
* TinyButStrong version: 3.5.0 * PHP version: 5.2.10-2ubuntu6.4 * Opened archive: ./test.odt * Deleted files in the archive: none * Added files in the archive: none * Modified files in the archive: - content.xml BTW: the open TBS version on the server says it is 1.3.2 not 1.3.1 ?? bill |
|
By: william
Date: 2010-08-05
Time: 15:02
|
Re: creating a multi-page document, reusing the same templateLet me figure out why I am getting 1.3.1 instead of 1.3.2 and 3.5.0 instead of 3.5.3 before we go any further. I have the right classes in my "classes" directory on the server, but must have another copy somewhere in the path.
bill |
|
By: william
Date: 2010-08-05
Time: 15:18
|
Re: creating a multi-page document, reusing the same templateI found the old copy (tbs for php4 !) tucked away in a obscure directory. I now am using 1.3.2 and 3.5.3 and still have the same problem.
bill |
|
By: william
Date: 2010-08-05
Time: 15:20
|
Re: creating a multi-page document, reusing the same templatedisregard - still shows as 1.3.1 - more searching.
bill |
|
By: william
Date: 2010-08-05
Time: 15:26
|
Re: creating a multi-page document, reusing the same templateI am flumoxed.
I changed the include_once to explicitly use tbs_plugin_opentbs-1-3-2.php and renamed the file to that so I am sure I am getting that file, but it still shows 1.3.1 in the debug header. |
|
By: william
Date: 2010-08-05
Time: 15:27
|
Re: creating a multi-page document, reusing the same templatehere is the top of the class file:
bill |
|
By: Skrol29
Date: 2010-08-05
Time: 19:17
|
Re: creating a multi-page document, reusing the same templateHi Bill,
Sorry for this stupid bug, OpenTBS version 1.3.2 is saying version 1.3.1! There is now a new version available, it is 1.3.3. It fixes only this bug. We can see now that your sub-block definition is not split, and TBS should process it because this feature is available since TBS version 3.5.0. Can you now run the same debug mode, but without calling the MergeBlock('asb') ? It will help to see what is the inner definition of the main block. |
|
By: william
Date: 2010-08-06
Time: 16:25
|
Re: creating a multi-page document, reusing the same template
|
|
By: Skrol29
Date: 2010-08-09
Time: 00:11
|
Re: creating a multi-page document, reusing the same templateHi Bill,
Sorry the 1.3.3 version was not available as I said, it would be available now. Whatever, this would not change the result. Could you send to me a small sample that would reproduce the problem you have? With just a small PHP array as data to merge. This will help me to debug the behavior you've got. |
|
By: william
Date: 2010-08-09
Time: 12:15
|
Re: creating a multi-page document, reusing the same templatesent to your skrol29f...m address.
I will off-net for 2-3 weeks and will check back then. bill |
|
By: Skrol29
Date: 2010-08-09
Time: 16:58
|
Re: creating a multi-page document, reusing the same templateHi bill,
I've found the problem in your ODT template. In fact, you've defined the "asb" block twice. the first time is when there is [asb;block=begin]. The block takes its properties here, and there is no sub1, sub2 or sub3 parameters. In this first definition, you've defined [asb.name;block=table:table-row;;sub1=services...]. But this time all block parameters are ignored, because it has previously been defined. So you just have to move parameters sub1, sub2, sub3 from this TBS tag to the first one. |
|
By: william
Date: 2010-08-13
Time: 12:42
|
Re: Re: creating a multi-page document, reusing the same templatethank you very much. I can now type one finger, but can't get to the debug computer for a couple of more days.
|
|
By: william
Date: 2010-08-15
Time: 17:13
|
Re: creating a multi-page document, reusing the same templateworks like a charm.
I appreciate your time and effort more than I can say. Would you like me to clean it up, document it and submit it as a complex demo as a small payback for all your great work ? bill |
|
By: william
Date: 2010-08-15
Time: 20:44
|
Re: creating a multi-page document, reusing the same templateworks like a charm.
I appreciate your time and effort more than I can say. Would you like me to clean it up, document it and submit it as a complex demo as a small payback for all your great work ? bill |