Free Support Forum - aspose.com

Unable to save Word 2003 document

Hello,

We seem to be having some issues saving documents which we have loaded into Aspose. We are using Aspose.Words version 9.7.0.0.

We are loading a Word 2003 document. It loads fine into Word without any issues.

One additional piece of information, if I change the output format to docx, the error does not occur.

Unfortunately, converting 2003 format to 2007 format is not an option for our customers at this time.

I have attached a simple vb.net solution and a sample document. I have also attached the stack trace from the error which occurs.

Regards,

Edward

Hi

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

Thank you for reporting this problem to us. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.

It seems the reason of the problem is .EMF image. So please try using the following code to work this problem around:

Document doc = new Document("C:\\Temp\\Document.doc");

// Get all shapes in the document.

NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);

// Loop through all shapes.

foreach (Shape shape in shapes)

{

// If shape contains a vector image, convert it to raster image.

if (shape.HasImage && (shape.ImageData.ImageType == ImageType.Wmf || shape.ImageData.ImageType == ImageType.Emf))

{

using (MemoryStream vectorImageStream = new MemoryStream(shape.ImageData.ImageBytes))

using (Image image = Image.FromStream(vectorImageStream))

using (MemoryStream resterImageStream = new MemoryStream())

{

image.Save(resterImageStream, ImageFormat.Png);

shape.ImageData.SetImage(resterImageStream);

}

}

}

doc.Save("C:\\Temp\\out.doc");

Best regards,

The issues you have found earlier (filed as WORDSNET-4462) have been fixed in this .NET update and in this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.