TinyButStrong - the PHP Template Engine
Categories > OpenTBS with ODT >

block merge fails when merging into form controls

By: william
Date: 2010-08-30
Time: 13:12

block merge fails when merging into form controls

The next project is medical insurance billing.  Basically I need to generate an OCR readable form with approximately 150 fields that need to be carefully positioned.
It was suggested that I use form controls to position text fields, and this works fine.  When I do a merge without an explicit block start it merges and all is well.
However, when I add the
[s;block=begin]
--page break--
above the page with the text boxes and
[s;block=end]
below the text boxes, I get empty values. 
Before the merge the debug output shows
    <form:text form:name="Text Box 1" form:control-implementation="ooo:com.sun.star.form.component.TextField" form:id="control1" form:current-value="[s.name]" form:convert-empty-to-null="true">
to-null="true">
and after the merge it shows
     <form:text form:name="Text Box 1" form:control-implementation="ooo:com.sun.star.form.component.TextField" form:id="control1" form:current-value="" form:convert-empty-to-null="true">
The problem may be that the form controls are in a separate XML section before the rest of the document flow:
   <office:forms form:automatic-focus="false" form:apply-design-mode="true">
    <form:form form:name="Form" form:apply-filter="true" form:command-type="table" form:control-implementation="ooo:com.sun.star.form.component.Form" office:target-frame="" xlink:href="">
     <form:text form:name="Text Box 1" form:control-implementation="ooo:com.sun.star.form.component.TextField" form:id="control1" form:current-value="[s.name]" form:convert-empty-to-null="true">
      <form:properties>
       <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.TextField"/>
      </form:properties>
     </form:text>
     <form:textarea form:name="Text Box 2" form:control-implementation="ooo:com.sun.star.form.component.TextField" form:id="control2" form:current-value="[s.SDate]" form:convert-empty-to-null="true">
      <form:properties>
       <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.TextField"/>
       <form:property form:property-name="MultiLine" office:value-type="boolean" office:boolean-value="true"/>
      </form:properties>
     </form:textarea>
    </form:form>
   </office:forms>
and the block=begin is after that section.
However, If I remove the explicit block beginning and ending, it merges well.  But as I need to print multiple pages from the same form I need the explicit begin and end, I think.

I am just getting started on this and before I spend a lot more time I am open to other approaches and suggestions.  Of course, if anyone sees where I am making an error with this approach that would be wonderful.

My php is:
TBS = new clsTinyButStrong; // new instance of TBS
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); // load OpenTBS plugin
$TBS->LoadTemplate("./ins-stmt-test.odt");

  
$S = array();
$S[0] = array ('name'=>'John Smith', 'SDate'=>'8/1/2010');
$S[1] = array ('name'=>'Adam Smith', 'SDate'=>'8/1/2111');
$TBS->MergeBlock('s',  $S); 
$TBS->Show(OPENTBS_DEBUG_XML);
$file_name = "ins-stmt-test.odt";
$TBS->Show(OPENTBS_DOWNLOAD+TBS_EXIT, $file_name);

Many thanks in advance,

bill


By: Skrol29
Date: 2010-08-31
Time: 00:08

Re: block merge fails when merging into form controls

Can you send a template example that reproduce your problem?
By: william
Date: 2010-08-31
Time: 12:50

Re: block merge fails when merging into form controls

sent
By: Skrol29
Date: 2010-09-01
Time: 02:16

Re: block merge fails when merging into form controls

Ok, I've sent a solution and I will publish it here soon.
Admin mode