Page 1 of 1

Binding extension for repeats

PostPosted: Thu Aug 05, 2010 8:39 am
by dawns
I'm very new to WordprocessingML. I have started running various samples and am now stuck on trying to substitute my data into a row in a table (having the document display my custom content in new rows in the table).

I'm trying to follow your sample (ContentControlBindingExtensions) however, when I open the final output from this method (*_bound.docx) file, instead of seeing 3 rows with the content populated in my table, I see three empty rows. The repeat binding seems to be working (there are 3 rows being created), however, it's not updating the content controls in the cells as I'd expect. Running the same code against the sample docs works and I see 3 rows (populated with cell data) in the invoice_bound.xml.

Any help would be greatly appreciated!!

Re: Binding extension for repeats

PostPosted: Thu Aug 05, 2010 9:17 pm
by jason
To clarify, you are saying that with your docx, you can:

Code: Select all
      // Process conditionals and repeats
      CustomXmlDataStoragePart.preprocess(wordMLPackage);


but when you do:

Code: Select all
      // Apply the bindings
      CustomXmlDataStoragePart.applyBindings(wordMLPackage.getMainDocumentPart());


you don't see the expected data in your docx?

If you open the docx resulting from the preprocess step in Word, does Word populate the rows for you?

Feel free to post your input docx file here, and I'll take a look.

.. Jason

Re: Binding extension for repeats

PostPosted: Tue Aug 10, 2010 1:49 am
by dawns
My apologies on my tardy response... I was waiting for an email notification of a reply.
I ran the ContentControlBindingExtensions example and with the following modifications:
String inputfilepath = "C:\\delegates.docx";
String save_preprocessed = "C:\\delegates_preprocessed.docx";
String save_bound = "C:\\delegates_bound.docx";


I've attached the three output docs. (The preprocessed shows the three rows as expected, with the original description I put into the Content Control, which is basically the tag name. The _bound document shows the same three rows, but this time, with no content.)

I've renamed all the .docx to .zip so that I can attach them.

THANKS!!!

Re: Binding extension for repeats

PostPosted: Tue Aug 10, 2010 2:00 am
by dawns
The log from running the sample.

Re: Binding extension for repeats

PostPosted: Tue Aug 10, 2010 3:05 am
by jason

Re: Binding extension for repeats

PostPosted: Tue Aug 10, 2010 4:42 am
by dawns
Brilliant, that worked. Thanks