Page 1 of 1

FlexDoc

PostPosted: Tue Jan 26, 2010 9:44 pm
by fkfausa
Hi!
I'm wondering whether anyone have tried using docx4j combined with stuff from flexDoc (http://flexdoc.codeplex.com/)? Will any of the methods in the XMLUtils class handle the transformation done with the xslt defined in flexDoc?

Re: FlexDoc

PostPosted: Wed Jan 27, 2010 11:30 pm
by jason
Various people are using docx4j for document generation, but I'm not aware of anyone having ported flexdoc.

Having had a quick look at it, I think you could port it easily enough. That said, unless I needed an identical solution running on Java, I'd probably do some of it a little differently:

1. As the site mentions, there's the i4i patent issue. See http://blogs.technet.com/gray_knowlton/ ... -word.aspx for more on this.

2. I'd use sdt's (content controls) for what flexdoc calls If, ForEach, and ValueOf.

WordML has a natural mechansim for implementing value-of; this is reflected in docx4j (see http://dev.plutext.org/trac/docx4j/brow ... nding.java ).

If and ForEach can also be implemented using w:sdt/w:stdPr/w:tag; you need a convention for interpreting the w:tag.

Hope this helps .. Jason

Re: FlexDoc

PostPosted: Sat Jan 30, 2010 1:19 am
by fkfausa
Thanks Jason!

Any tips on how to go about doing "If and ForEach can also be implemented using w:sdt/w:stdPr/w:tag; you need a convention for interpreting the w:tag."? By using xslt in some form? Something else?

Regards

Re: FlexDoc

PostPosted: Sat Jan 30, 2010 9:26 am
by jason
For example, if a given sdt is to remain "if" foo is true, you put foo in the w:tag. (org.docx4j.model.sdt.QueryString is docx4j's convention for storing multiple values in w:tag)

When you are later processing the document and you hit the w:tag, you go to your XML file (which can be included in the docx for portability) to find out whether foo is true or not.

To process the document, you have to traverse it. You can do this with XSLT, or by traversing it at a JAXB level. The latter is done in several places in docx4j (in one of the samples, and in MainDocumentPart iirc).

I'd use XSLT plus suitable extension functions.

To get around the i4i issues, flexdoc might wish to migrate to this model. If so, there is a lot which could be shared between implementations.

In any case, if you'd like to contribute anything you do, that would be appreciated by a number of docx4j users, I'm sure.

cheers .. Jason