Document fails to load

Hi Team,

The existing document fails to load. I get the below mentioned exception.

Document doc = new Document("D:\\fails.dot");
DocumentBuilder docBuilder = new DocumentBuilder(doc);

Thanks,
Kumar

Exception in thread "main" com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.
at com.aspose.words.FileFormatUtil.zzZ(Unknown Source)
at com.aspose.words.Document.zzY(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at tests.TestTable1512.main(TestTable1512.java:28)
Caused by: java.lang.IllegalArgumentException: The start and end nodes should have the same parent.
at com.aspose.words.CompositeNode.zzY(Unknown Source)

Hi Kumar,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-12951. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Tahir,

Thanks for raising the defect.
I want to know the scenario when this happens? Like what content in word document makes Aspose API to fail… this helps for any future such load failure…

Thanks,
Kumar

Hi Kumar,

Thanks for your inquiry. This issue is pending for analysis. Once our product team completes the analysis of this issue when will then be able to share the reason of this issue.

Please let us know if you have any more queries.

Tahir, Any update on this?

Hi Kumar,

Thanks for your patience. Your document contains glossary with building block with start and end entries that resides in a different sections. Aspose.Words does not support such building blocks in DOC binary format templates at the moment. We will update you via this forum thread once this issue is resolved.

Hi Tahir,

>>> Your document contains glossary with building block with start and end entries that resides in a different sections.
How can I see the glossary with building block in the document? I’m not aware of this in MS word…

Thanks,
Kumar

Hi Kumar,

Thanks for your inquiry. You can check building blocks from “Insert Tab->Quick Parts->Building Block Organizer” in MS Word 2013. Please check the attached image for detail.

Hi Tahir,

Thanks for sharing the details. However, I see such building blocks in new word document as well. What is different in fails.dot that it fails to load with Aspose API?

Thanks,
Kumar

Hi Kumar,

Thanks for your inquiry. As shared earlier, your document contains glossary with building block with start and end entries that resides in a different sections. Aspose.Words does not support such building blocks in DOC binary format templates at the moment.

For example, the building block with name “1” resides in two sections in your document template. It starts in a header section and it ends in a body section.

We have attached screenshot with an image that explains how to see this in MS Word GUI. In addition, it can be checked with the following VBA code:

Sub PrintBbSectionsCount()
    Dim bB As buildingBlock
    Documents.Add Template:="fails.dot", NewTemplate:=False, DocumentType:=wdNewBlankDocument, Visible:=False
    Set bB = ActiveDocument.AttachedTemplate.BuildingBlockTypes(wdTypeAutoText).Categories("General").BuildingBlocks("1")
    bB.Insert Documents(1).Range
    MsgBox Documents(1).Sections.Count
    Documents(1).Close(False)
End Sub

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

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