We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert Word to XML

I have a Word template file that I have tried to save as PDF. A number of headings that have a white font have disappeared. Also, in the header section, the text has been right-aligned instead of left. What is wrong?
The code I used is:

oDoc = New Aspose.Words.Document("c:\temp\PT Plan Layout.dot")
Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream()
oDoc.Save(stream, Aspose.Words.SaveFormat.AsposePdf)
' Seek to the beginning so it can be read by XmlDocument.
stream.Seek(0, System.IO.SeekOrigin.Begin)
' Load the document into an XmlDocument
Dim xmlDoc As XmlDocument = New XmlDocument()
' Save the XML
' Load the XML document into Aspose.Pdf
Dim pdf As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf()
' Make sure the images that were saved by Aspose.Words into Windows temporary
' folder are automatically deleted by Aspose.Pdf when they are no longer needed.
pdf.IsImagesInXmlDeleteNeeded = True
pdf.BindXML(xmlDoc, Nothing)
' Now produce the PDF file.

I have attached the Word template file, the XML generated from it, and the resulting PDF.
We are using Aspose.PDF and Aspose.Words
I posted this in the Aspose.PDF forum. Thye used ASpose.Words v4.1.1.0 and that resolved the font color problem. However the alignment problem remains in the XML file.

Thank you for reporting the issue to us. I have logged it as #1477 in our defect database. We will try to get it fixed as soon as possible. As a workaround, you can use a table without borders to align the text and the picture in the header instead of paragraph alignment and custom tab stops.

It’s better to avoid formatting with tabs and spaces at all. There is an example how you can control document layout using tables with invisible borders.
Targeting this approach take into consideration the following:

  1. The table has hollow borders. They are not rendered or printed.
  2. Every element in complex design should be placed in own cell.

Please let us know if it is helpful for you.


I have logged the alignment problem as PDFNET-3986. Hope to fix it in one week.

Best regards.

Hi WhiteEagle
I am one of Aspose.PDF team,now I am charge of the issue,I think Klepus’ resolution can fix up the problem you face to,If you still have some questions about Aspose.PDF,please let me know.If you get some questions about Aspose.Word,please tell them in the Aspose.Word forum.


The bug has been fixed. Please try the attachment. Thanks for your patience.

Best regards.