I’m currently working on a system that allows users to create documents based on templates with mergefields etc.
All these templates are wordml documents.
there is a seperate template for the header and footer that goes with every document. Both the header and the footer contain images.
My application uses a third party rich texteditor control which allows the user to edit the header, footer and body while making a document. At the end the three templates get merged into 1 big wordml file.
I’m then converting that file to pdf with aspose.words before saving it to the server.
However the images from the header and footer dissapear when i convert the combined wordml. All other text show up fine.
If I convert the header and footer seperate the images show up fine in my converted pdf.
The images also show if I open the combined xml in word.
I’m testing it with a simple block of code atm
Document doc1 = new Document(“C:\temp\templates\header.xml”);
Document doc2 = new Document(“C:\temp\templates\full.xml”);
header.pdf and header.xml contain images
full.xml contains images, full.pdf doesn’t.
This will mostlikely be a problem with the markup of the wordml
document that got returned by the control. However the fact that it
shows up fine in word would suggest that the markup is fine as it is.
Any idea from your side what might be causing that strange behavior?
If it would help i could upload a version of the unmerged and merged wordml files. I’ll have to filter some text out of these first before I post them tho, considering they contain customer information.
Thanks in advance
Thanks for your request. Could you please attach your input and output documents you are getting problem with? I will check them on my side and provide you more information.
I found out some extra information.
The problem seems to occur when we merge the three parts together.
If you open the output xml and save as… to a new xml document. the markup of the file suddenly changes aswell. The newly saved file converts perfectly.
I added two attachements.
Fail.xml is the file that doesn’t show the images after conversion.
Succes.xml is the file that does show the images after conversion.
Maybe you guys have an idea what i’m missing in the original output file (fail.xml) which causes my images to dissapear.
Thank you for additional information. If you try comparing your documents you will see the differences. Please see the attached screenshot. If I copy v:shape node from Success document to Fail document all works fine.
The images got in the wrong format when saving the file to wordml with the rich text box control.
Luckily could also save to other formats. When I saved it to RTF instead and converted that one to PDF with aspose it worked fine.
It is perfect, that you already found the reason of the problem. Please let me know in case of any issues; I will be glad to help you.