Page 1 of 1

Picture Binding

PostPosted: Tue Jul 09, 2013 2:04 am
by claborde
Thanks to the simple webapp sample, i'm now familiar with the binding of values (with condition and repetition) at runtime from any well built xml file to a word document with content controls.
But I can't find a way to achieve the simular thing to inject a picture in my template : regarding the forum threads, it's seems possible, but i can't find any sample.

I've tried to add a picture content control in my template using the developper ribbon, and bind it to a value in my input.xml (see attachment), value which is a 64bits encoded string of my picture.
But when i'm performing the binding with docx4j, the picture is not injected and I get a weird result (see at the bottom of result.docx).

My binding method look like this :

// Process conditionals and repeats
OpenDoPEHandler odh = new OpenDoPEHandler(_document);
odh.preprocess();

OpenDoPEIntegrity odi = new OpenDoPEIntegrity();
odi.process(_document);

// Apply the bindings
// Convert hyperlinks, using this style
BindingHandler.setHyperlinkStyle("Hyperlink");
BindingHandler.applyBindings(_document);

// Strip content controls: you MUST do this
// if you are processing hyperlinks
RemovalHandler rh = new RemovalHandler();
rh.removeSDTs(_document, Quantifier.ALL);


Thanks for your help !
CL

PS : I have created an equivalent post on stackoverflow (http://stackoverflow.com/questions/17531594/content-control-picture-binding) : if a working solution is found there, I will report it here.

EDIT : find a solution by using the good OpenDoPE add-in found at : http://www.opendope.org/downloads/authoring-friendly/setup.exe : thanks again Jason :)