Free Support Forum - aspose.com

Convert from wordml to doc not working

Hi,

I an having a problem loading a file in wordml format and saving it as a word document using the aspose.words Document. The code below should load the document (attached as doc file.txt into the string finalOutput) and save it to a stream as a doc. The result is a word file that only has 1 page and it's empty which is wrong.

MemoryStream docStream = new MemoryStream();
MemoryStream wordMLStream = new MemoryStream(Encoding.UTF8.GetBytes(finalOutput));
Document wordDocument = new Document(wordMLStream, null, LoadFormat.WordML, null);
wordDocument.Save(docStream, SaveFormat.Doc);

Regards
David

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

Thanks for your inquiry. The file you had attached is not a wordml document. So you can open this document using Aspose.Words.

Best regards.

Hi,

I realise it's a text file but it is a valid wordML document as far as i know. Why do you think it isn't a valid file?

Cheers

David

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

Thanks for your inquiry. Just try to open it using MS Word. WordML documents always starts from the following tags:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<?mso-application progid="Word.Document"?>

<w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no" xml:space="preserve">

Your document starts with

<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">

Best regards.

This document DOES load correctly into word 2007. It uses the Office 2006 schema. the package is part of the way word versions beyond 2003 deal with embedded images etc.

The file is saved with the Word XML option in word 2007 rather than the compatibility Word 2003 XML format.

Can we confirm therefore that ASPOSE is compatible only with the WordML formats as of 2003

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

Thanks for your inquiry. Yes, you are right. Aspose.Words supports 2003 schema. Please see the following link for more information.

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/wordprocessingml-docx-xml.html

Best regards.

Hi,

I am not able to access the url. Can you please paste correct URL?

Thanks.

Hi

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

Thanks for your request. The latest version of Aspose.Words supports both Word 2003 and Word 2007 schema. You can download the latest version of Aspose.Words from here:

http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/category1188.aspx

Please see the following link for more information:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/wordprocessingml-docx-xml.html

Best regards.