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

Free Support Forum - aspose.com

WordML does not contain wx:sub-section after conversion from DOCX using C#

Hi, when I open a doc file with Aspose.Words and save as WordML with the following code:


Document d = new Document(file.InputStream);
d.AcceptAllRevisions();
using (var ms = new MemoryStream())
{
d.Save(ms, SaveFormat.WordML);
}

The output XML is lacking wx:section and wx:sub-section and therefor have no structure. Is it possible to configure Aspose.Words to use the wx:section and wx:sub-section elements in the output XML?

Please note wx:section should be wx:sect and are indeed in my output XML but wx:sub-section elements are not present in the output. Is it possible to configure Aspose to use wx:sub-section elements?


Best regards
Edvin

Hi Edvin,

Thanks for your query. I like to share with your that the requested feature is not available in Aspose.Words. However, I have logged your request in our issue tracking system as new feature request. You will be notified via this forum thread once this feature is available.

Hi Edvin,


Thanks for your request. but i do not think these elements are required. That is why Aspose.Words does not output redundant elements. Could you please attach your test document, output and expected output here for testing? We will investigate the issue and provide you more information. Also, it would be great if you explain why you need these elements in output WML.

Best regards,

Hi Tahir Manzoor and Alexey Noskov, thank your for your quick replies. We have used the vx-sub-section elements to maintain structure when transforming WordML with xslt to other schemes/dtd (e.g. DocBook with sect1-sect5 or nested sections). You can use any word document for testing as long as it paragraphs use Level, save as WordML from word and you see the expected output of vx:sub-section for paragraphs with Level. This is a great way to maintain the structure of the document.


We use aspose.words to automate the process from doc -> WordML, e.g. we can accept regular doc files from users and the server can convert to WordML. We have rewritten the transform to still keep structure but the new XSL is not as clean as when using vx:sub-section.

Best regards
Edvin

Hi Edvin,

Thank you for additional information. As a temporary workaround, you can detect start and end of subsections by styles.

Best regards,

Yes, we rewrote our transform to do it that way instead and it is working, thank you for the suggestion.


Best regards
Edvin