Free Support Forum - aspose.com

Unable to convert word 2003 document

What I'm trying to do is convert word 2003 document. During conversion
Save method throws an exception. Here is the code snippet:

Dim doc As Aspose.Word.Document

docContent.Position = 0

doc = New Aspose.Word.Document(docContent)

doc.Save(docContentXml, Aspose.Word.SaveFormat.FormatAsposePdf)

I've attached file that I'm trying to convert.

Thanks in advance for your help.

I'm using aspose.word version 2.2.7.0

Hi,

Thank you for considering Aspose.

Please try to download and install the latest version of Aspose.Word first.

With the latest version of Aspose.Word I’ve encountered the following error:

Method not found: Void System.Xml.Xsl.XslTransform.Transform(System.Xml.XPath.IXPathNavigable, System.Xml.Xsl.XsltArgumentList, System.IO.Stream, System.Xml.XmlResolver).

Any thoughts will be appreciated.

Since Aspose.Word currently does not use XML transformations, the problem should lie somewhere in Aspose.Pdf or in your code. Please check the stack trace.

I've downloaded the latest versions of Aspose.Word and Aspose.Pdf.
Here is the code snippet:

Dim license As Aspose.Word.License = New Aspose.Word.License()

license.SetLicense("Aspose.Custom.lic.xml")

Dim doc As Aspose.Word.Document

docContent.Position = 0

doc = New Aspose.Word.Document(docContent)

doc.Save(docContentXml, Aspose.Word.SaveFormat.FormatAsposePdf)

TransformXmlToPdf(docContentXml, outputPdf)

The first line throws exception: "File or assembly name System, or one of its dependencies, was not found." (see attached picture)

What am I doing wrong?

Thanks.

What version of .NET Framework are you using? If it’s 1.0, please install 1.1 or read this programmers guide topic to learn how to target Aspose.Word to .NET Framework 1.0:

http://www.aspose.com/wiki/default.aspx/Aspose.Word/SystemRequirements.html

Thanks for quick reply. I’m using framework version 1.0. I’ve done as you suggested - changed machine.config (unfortunately our program isn’t using application config file). Now pdf.BindXML(xml, Nothing) line (see snippet below) throws an exception: “Method not found: Void System.Xml.Xsl.XslTransform.Transform(System.Xml.XPath.IXPathNavigable, System.Xml.Xsl.XsltArgumentList, System.IO.Stream, System.Xml.XmlResolver).”


Dim lic As Aspose.Pdf.License = New Aspose.Pdf.License()

lic.SetLicense(“Aspose.Custom.lic.xml”)

Dim pdf As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf()

Dim xml As New System.Xml.XmlDocument()

inputXml.Position = 0

xml.Load(inputXml)

pdf.BindXML(xml, Nothing)

pdf.IsImagesInXmlDeleteNeeded = True

pdf.Save(outputPdf)

It seems to me that this is the same problem with framework 1.0. How can be this problem eliminated?

Thanks in advance.

Dear Amid,

Aspose.Pdf needs .Net framework 1.1. Please update to .Net framework 1.1. If you don’t want to update, I can provide you a special version that can be run in .Net framework 1.0.

Unfortunately I’m unable to update to framework 1.1, and I’ll appreciate if you can provide aspose dlls compatible with v1.0.

Thanks in advance.

Please try the attached dll.

I appreciate your help, thanks a lot.
With the dll you provided now code execution fails at line:

doc.Save(docContentXml, Aspose.Word.SaveFormat.FormatAsposePdf)

with InvalidOperationException: Stack empty.

Do you have any suggestions?

Thanks.


Hi,

So are you sure that if you use the attached dll, InvalidOperationException is thrown exactly on the line you specified? The point is that this line doesn’t involve Aspose.Pdf so throwing should not depend on what Aspose.Pdf.dll you use and if you use it at all…

Hi Dmitry,

We tested attached Aspose.Pdf.dll on two documents.
With next simple document Doc1.doc it’s work.
But for Doc2.doc isn’t work.
Raise Exception with message: Stack empty.

File Doc2.doc is attached.

Thanks in advance for your help.

Dear Amid,

I have tested the doc2.doc with the latest version of Aspose.Word and Aspose.Pdf and have not found this error.

Hi,
Please attach the new Aspose.Word.dll for FrameWork 1.0 and Office 2003.

Thanks in advance for your help.

There is no special Aspose.Word version for .NET Framework 1.0, and moreover for a particular version of MS Word. Please just download the latest version of Aspose.Word from our download page and target to .NET Framework 1.0 as described in that Wiki topic (see the link in one of above posts).

Thank you very much.
It’s works.