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

Free Support Forum - aspose.com

Aspose generated DOCX doesn't open

Hello.


I created a DOCX with your library and it fails to open in Word 2010.
It says: “Unspecified Error. Location : Part : /word/document.xml, Line: 3, Column: 0”.

I have extracted “document.xml” but I can’t understand much of it…
I have the files attached.
Please let me know what’s going wrong.
If you describe me what’s wrong in the XML, I may figure out what I should do in code to fix this.
Unfotunatelly, I can’t share the code that produces this (it’s a huge project) and the error depends on specific data that I don’t have permission to share.
So, if you can help me understant what’s wrong with the XML it would be great.

Thanks,
Kostas.

From some testing I’ve done, it seems that the problem comes from a table.

Is there a posibility that a LARGE table generates this kind of problem?
When this DOCX is converted to PDF there isn’t any apparent problem to it…

Hi Kostas,


Thanks for your inquiry. The problem occurs because some of the Table Rows in your document have more than 63 Cells i.e. Cell count per Row must not exceed 63. To identify the problematic Tables, please try run the following code snippet:

Document doc = new
Document(@“C:\Temp\doc.docx”);

NodeCollection tables = doc.GetChildNodes(NodeType.Table, true);

foreach (Table table in tables)

{

foreach (Row row in table.Rows)

{

if (row.Cells.Count > 63)

{

table.Remove();

break;

}

}

}

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


I hope, this helps.

Best regards,

Hello.


Thanks. This has helped me a lot. :slight_smile:
I guess there isn’t such limit on the number of rows so I might turn the tables around (making the rows columns).

Best Regards,
Kostas

Hi Kostas,


Thanks for your feedback. Sure, there doesn’t seem to be any limit on the number of Rows a Table might have. Please let us know any time you have any further queries. We are always glad to help you.

Best regards,