Word 2 PDF Error

Hi,

I am using Aspose.PDF version 3.2.2.0 and Aspose.Words version 4.0.2.0. I am getting the error:

Unknown sub element in Cell element. The element name is FloatingBox.

There is another post like this but it says to use the latest version to fix the problem. I have the latest versions of both products.

Code:

Dim DocPath As String

DocPath = "C:\new folder\"

Dim doc As Document = New Document(System.IO.Path.Combine(DocPath, "PHOTO ADDENDUM 1.doc"))

Dim stream As MemoryStream = New MemoryStream

doc.Save(stream, SaveFormat.AsposePdf)

'Seek to the beginning so it can be read by XmlDocument.

stream.Seek(0, SeekOrigin.Begin)

'Load the document into an XmlDocument

Dim xmlDoc As XmlDocument = New XmlDocument

xmlDoc.Load(stream)

'Load the XML document into Aspose.Pdf

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

pdf.IsImagesInXmlDeleteNeeded = True

pdf.BindXML(xmlDoc, Nothing) <--- ERROR ON THIS LINE

pdf.IsTruetypeFontMapCached = False

'Now produce the PDF file.

pdf.Save("c:\new folder\PHOTO ADDENDUM 1.pdf")

Please let me know what the problem is.

John Tracy

NRT Web Services

jtracy@nrtwebservices.com

The exception is thrown by Aspose.Pdf library. So we need to consult with Aspose.Pdf team first. I will transfer this thread to Aspose.Pdf forum and wait for their conclusion.

I found nested floating boxes in the xml which is not supported in Aspose.Pdf. Please avoid using it if you can modify the Word document.

We can modify the template that is used by our agents. Thanks for the reponse. I will try to modify the document to eliminate this, although I amcy not sure what a floating box is :).

Thanks,

John Tracy

Hi John,

If you don't know how to modify the document, maybe Vladimir can give you some advice.

I have attached an example that using nested tables which can be converted better.

Thanks for the response. The document you attached still throws an error. When I look at the xml I can see nested floating boxes still. Do you have a version that converted this to pdf? Or is there a way to use nested tables to make the pictures appear side by side? I am not sure how to do this.

Thanks.

I have tested the document before attaching it and no exception is found. I used nested table but not flosting box so there should not be nested floating box in the xml. Please check if there is some mistake in your test.

Please attach the Word document that with pictures side by side and we will try to modified it for you.

You are right. I have re-tested it, and it works fine. Thank-you. This will work great. I will try it when I get into work tomorrow and make sure. (It is still Sunday here :) ) Thanks so much for your support, you have been awesome!! I will make sure my management knows how well you at Aspose have been supporting us.

John Tracy

NRT Web Services

Hello. Well, my testing data wasn't all that great. Apparently one of the things the floating box did for us was that when we inserted a picture into it, it would resize it automatically. The way it is now, the table expands to the size of the picture. This will not work.

A couple of questions:

1. Will aspose.pdf ever support nested floating boxes?

2. Is there a way to fix the size of the picture that you know of without using the frame?

It is difficult to support nested floating boxes in short time. Do you mean how to fix the size of the picture in Word? If so you can set the image size to be fixed in Word.

Yes I mean fix the size of the image -- what happens is that the agents take digital photos of things and then insert them from file into the document. When this is done with the floating box, the picture is resized and the aspect ratio is maintained.

In the attached document (the one you helped me modify last week), the picture on the right is the correct size, because I inserted it as the right size. The picture on the left is too large for the template. I cannot figure out how to make the table accept this file w/o resizing the cell to be too large or just showing me the corner of the picture instead of maintaining the aspect ratio.

John

Dear John,

Please try uncheck the "aotomatically resize to fit content" checkbox in "Table Options" setting.