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

Free Support Forum - aspose.com

Saving in WordML problem

Hi,

I am using Aspose.Words 5.2.1, .net version. I have attached a Wordml document which has a few headings and sub headings in it. it also has track changes turned on. When I open this document using aspose.words and subsequently save it back as wordml it seems to lose some of the formatting infromation surrounding the headings. If you open the aspose.words saved version in Word, it thinks that there are a bunch of formatting changes.

The problem seems to be that the following WordML for each Heading from the original doc (the one attached here)

<w:pPr>

<w:pStyle w:val="FirstLevelHeader"/>

<w:listPr>

<w:ilvl w:val="0"/>

<w:ilfo w:val="21"/>

<wx:t wx:val="1." wx:wTabBefore="0" wx:wTabAfter="180"/>

<wx:font wx:val="Arial"/>

<aml:annotation aml:id="0" aml:author="stuart" aml:createdate="2008-07-22T13:27:00Z" w:type="Word.Numbering" w:original="%1:1:0:."/>

</w:listPr>

<w:ind w:left="0" w:first-line="0"/>

<w:rPr>

<w:sz w:val="22"/>

<w:sz-cs w:val="22"/>

</w:rPr>

</w:pPr>

Is changed as per the following after saving as WordML via aspose.words:

<w:pPr>

<w:pStyle w:val="FirstLevelHeader"/>

<w:listPr>

<w:ilvl w:val="0"/>

<w:ilfo w:val="21"/>

<wx:t wx:val="1." wx:wTabBefore="0" wx:wTabAfter="0"/>

<wx:font wx:val="Arial"/>

<aml:annotation aml:id="0" aml:author="stuart" aml:createdate="2008-07-22T13:27:00Z" w:type="Word.Numbering" w:original="."/>

</w:listPr>

<w:ind w:left="0" w:first-line="0"/>

<w:rPr>

<w:sz w:val="22"/>

<w:sz-cs w:val="22"/>

</w:rPr>

</w:pPr>

As you can see, the wx:wTabAfter attribute of the wx:t element is now set to 0 and the w:original attribute of the aml:annotation element is set to the final character of the initial value. In this case the initial value was "%1:1:0:." and the aspose.Words saved value is only "."

These changes make Word display unwanted track changes markers. I need to be able to generate a "clean" document with headings, i.e. have aspose export the heading WordML verbatim instead of making these changes.

Thanks,

Stu

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Both documents (before processing using Aspose.Words and after) look the same in MS Word. The matter is that xml elements with “wx” prefix is not needed. These elements have a supplemental XML information added in 2003 that serves as "hints" for transformation of a Word document to HTML format; for example, font, color, border, and absolute positioning information.

After open/save the document using MS Word this information will be added to the document again.

Regarding “w:original” I should say that I got the same result before and after processing document using Aspose.Words.

Before:

<aml:annotation aml:id="0" aml:author="stuart" aml:createdate="2008-07-22T13:27:00Z" w:type="Word.Numbering" w:original="%1:1:0:." />

After:

<aml:annotation aml:id="0" aml:author="stuart" aml:createdate="2008-07-22T13:27:00Z" w:type="Word.Numbering" w:original="%1:1:0:." />

Also I can’t see any track changes markers in the output document. Could you please also attach your output document for reviewing?

Best regards.

Hi Alexey,

I have attached my output document which is saved with aspose.words 5.2.0. Take a look at the w:original value for each heading, it is only the last character of the initial value. Also, if you open this doc in Word you will see Word shows each heading as having a formatting change.

Thanks,

Stu

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. But it seems that the attached document is not output of Aspose.Words. Aspose.Words add the following comment in the output XML

And your document does not have this comment.

Please see the attached documents. These documents were generated by Aspose.Words 5.2.0 and 5.2.1 and both have no track changes markers.

Could you please show me your code?

Best regards.

Just wanted to mention this problem shows up on my end for both aspose.Words 5.2.0 and 5.2.1.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please provide me your code and take a look the documents attached in my previous post.

Best regards.

Hi Alexey,

I apologise, I am atcually saving as

Aspose.Words.SaveFormat.Doc. If you save the input file I provided as Doc you will see the track changes markings in Word.

I had then subsequently saved the doc in Word as xml to compare the two.

I did try saving as WordML using aspose and you're right, the w:original attributes are the same. My problem is that I need to return a backwards compatible .doc file, not a WordML file.

Thanks,

Stu

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I managed to reproduce this problem on my side. I created new issue #5583 in our defect database. We will notify you as soon as it is fixed.

As a workaround you can call AcceptAllRevisions before saving. Please see the following code example:

//Open document

Document doc = new Document(@"Test309\input.xml");

//Accept all revisions in the document

doc.AcceptAllRevisions();

//Save document

doc.Save(@"Test309\out.doc");

Hope this helps.

Best regards.

Hi Alexey,

Thanks for the help, I tried the workaround and it works. I also previously identfied a problem opening a file with asian fonts in it, which you identified as defect #5506. Can you give me any update on the status of that defect?

thanks,

Stu

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Issue #5506 is already fixed in current code base. Release will be published within 1-2 weeks. I will notify you.

Best regards.

The issues you have found earlier (filed as 5583 and 5506) have been fixed in this update. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />