I have two questions.
1. I've successfully bound set of images in template (http://www.docx4java.org/forums/docx-java-f6/databinding-repeats-no-corresponded-xpath-t1215.html.
The image set contains images with different original size.
When I attempt to set image size during template loading, after binding I get images with different percentage of original size. For example, the first image may be 107% of original size, but the second is 99%, etc. Both of them are in limits of document margins.
I apply changes in template before binding by using TraversalUtil and implementing Callback interface. Inside the apply(Object) method I'm setting the Anchor's effectExtent and extent properties to zero. So I try to set image size to get 100%.
- Code: Select all
if (object instanceof Anchor) {
Anchor anchor = (Anchor) object;
anchor.getEffectExtent().setB(0L);
anchor.getEffectExtent().setT(0L);
anchor.getEffectExtent().setL(0L);
anchor.getEffectExtent().setR(0L);
anchor.getExtent().setCx(0L);
anchor.getExtent().setCy(0L);
}
How can I achieve size of every image to be exactly 100% if original size? May be, there is a way to do some postprocessing of multiplied image containers and their properties after fiiling the template? But when I tried to do that with help of TraversUtil, I've got an exception...
2. Second question: I have to set border to image. But after filling the template the images doesn't have boards as I prepare them in template before. Should I do this "by hand" in my code, for example, in TraversalUtil or some different way?
regards,
Anton