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

Free Support Forum - aspose.com

Throws 'Parameter is not valid' for certain docx files

Save function of aspose word component throws ArgumentException with message ‘parameter is not valid’ for certain docx files. Attached a sample document.

here is the code we are using to covert

Aspose.Words.Document aspose = new Aspose.Words.Document(“sample1.docx”);
aspose.Save(“sample1.tif”, Aspose.Words.SaveFormat.Tiff);
MessageBox.Show(“Document successfully converted.”);

Exception details as follows

System.ArgumentException: Parameter is not valid.
at System.Drawing.Graphics.MultiplyTransform(Matrix matrix, MatrixOrder order)
at x85732faf56f7825d.x3a15c7024016ce52.xb67059efb664b0fb(x0c06161ccb9341e4 xda5bf54deb817e37)
at x85732faf56f7825d.x3a15c7024016ce52.VisitCanvasStart(xb8e7e788f6d59708 canvas)
at x1c8faa688b1f0b0c.xb8e7e788f6d59708.Accept(xf51865b83a7a0b3b visitor)
at x1c8faa688b1f0b0c.xbaec545ec01f92ca.Accept(xf51865b83a7a0b3b visitor)
at x1c8faa688b1f0b0c.xb8e7e788f6d59708.Accept(xf51865b83a7a0b3b visitor)
at x1c8faa688b1f0b0c.xbaec545ec01f92ca.Accept(xf51865b83a7a0b3b visitor)
at x1c8faa688b1f0b0c.xb8e7e788f6d59708.Accept(xf51865b83a7a0b3b visitor)
at x1c8faa688b1f0b0c.xbaec545ec01f92ca.Accept(xf51865b83a7a0b3b visitor)
at x1c8faa688b1f0b0c.xb8e7e788f6d59708.Accept(xf51865b83a7a0b3b visitor)
at x1c8faa688b1f0b0c.xbaec545ec01f92ca.Accept(xf51865b83a7a0b3b visitor)
at x1c8faa688b1f0b0c.xb8e7e788f6d59708.Accept(xf51865b83a7a0b3b visitor)
at x1c8faa688b1f0b0c.xbaec545ec01f92ca.Accept(xf51865b83a7a0b3b visitor)
at x1c8faa688b1f0b0c.xc67adcdbca121a26.Accept(xf51865b83a7a0b3b visitor)
at x85732faf56f7825d.x3a15c7024016ce52.Render(x4fdf549af9de6b97 node, Graphics graphics)
at x4a820b097ff6c983.x0a376fc3a80043f7.xe406325e56f74b46(xc67adcdbca121a26 xbbe2f7d7c86e0379, Image xe058541ca798c059)
at x4a820b097ff6c983.x0a376fc3a80043f7.x6c547a819272949b(Int32 xbf13a47a02af0066)
at x4a820b097ff6c983.x0a376fc3a80043f7.x19700a3ae5522c70(Int32 xbf13a47a02af0066, Int32 x0375600be29bf902, Stream xcf18e5243f8d5fd3)
at x4a820b097ff6c983.x0a376fc3a80043f7.xcc0fd8f02c7cf74c(Stream xcf18e5243f8d5fd3, ImageSaveOptions xc27f01f21f67608c)
at x077e797660ceec8d.x39513200ff58c2e3.x8cac5adfe79bc025(x8556eed81191af11 x5ac1382edb7bf2c2)
at Aspose.Words.Document.xf381a641001e6830(Stream xcf18e5243f8d5fd3, String xafe2f3653ee64ebc, SaveOptions xc27f01f21f67608c)
at Aspose.Words.Document.Save(String fileName, SaveOptions saveOptions)
at Aspose.Words.Document.Save(String fileName, SaveFormat saveFormat)

Any help is appreciated. Thanks

Hello

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

Thanks for your request. 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 fixed.

It seems the reason of the problem is Horizontal line. As a workaround you can try removing this Horizontal line from the document:

Document doc = new Document("sample1.docx");

// Get Shape collection

Node[] nodeColl = doc.GetChildNodes(NodeType.Shape, true).ToArray();

foreach (Shape shape in nodeColl)

{

if (shape.IsHorizontalRule)

shape.Remove();

}

doc.Save("out.tiff");

Best regards,

Also, I use the latest version of Aspose.Words 9.2.0 for testing. You can download this version from here:

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

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

Best regards,

The issues you have found earlier (filed as 18476) have been fixed in this update.


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