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

Free Support Forum - aspose.com

IllegalStateException: Unexpected table container

Hi Guys,


I am getting an IllegalStateException when I try to convert the attached doc from docx to HTML.

Here is the stack trace:

[error] (run-main-0) java.lang.IllegalStateException: Unexpected table container.
java.lang.IllegalStateException: Unexpected table container.
at com.aspose.words.zzZ2L.zzL(Unknown Source)
at com.aspose.words.zzX.zzZ(Unknown Source)
at com.aspose.words.zzX.zzW(Unknown Source)
at com.aspose.words.zz5.zzU(Unknown Source)
at com.aspose.words.zzZ59.zzYQ(Unknown Source)
at com.aspose.words.zzBM.moveNext(Unknown Source)
at com.aspose.words.zzBS.zzZ(Unknown Source)
at com.aspose.words.zzBS.zzZ(Unknown Source)
at com.aspose.words.zzZRY.zzZ(Unknown Source)
at com.aspose.words.Document.updatePageLayout(Unknown Source)
at com.aspose.words.Document.zzXL(Unknown Source)
at com.aspose.words.Document.zzbX(Unknown Source)
at com.aspose.words.zzZY0.zzZ(Unknown Source)
at com.aspose.words.zz0Q.zzZZj(Unknown Source)
at com.aspose.words.zz0Q.zzZZs(Unknown Source)
at com.aspose.words.zz0Q.zzZZx(Unknown Source)
at com.aspose.words.zzZWQ.zzZ(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)

Here is the conversion code (in Scala):
val options = new HtmlSaveOptions(SaveFormat.HTML)
options.setImagesFolder(imageDir.getPath)
options.setUseAntiAliasing(true)
options.setUseHighQualityRendering(true)
// Prevent scaling of images.
options.setScaleImageToShapeSize(false)
// Ensure the file names for images are sanitized.
options.setImageSavingCallback(FilenameSanitizingSavingCallback)
// Ensure external images are still linked.
options.setExportOriginalUrlForLinkedImages(true)
// Ensure lists are exported as
    / and
    tags.
options.setExportListLabels(ExportListLabels.BY_HTML_TAGS)
for {
// Load the document.
asposeDoc <- Try(new AsposeDocument(file.getAbsolutePath))

// Convert to HTML.
_ <- Try(asposeDoc.save(htmlFile.getAbsolutePath, options))
}
yield {}
object FilenameSanitizingSavingCallback extends IImageSavingCallback {
/**
* Handle an image save callback. This will force the filename to be lowercase.
*
* @param imageSavingArgs Information about the image.
/
def imageSaving(imageSavingArgs: ImageSavingArgs): Unit = {
// Ensure file names are lowercase and do not contain invalid characters.
imageSavingArgs.setImageFileName(
imageSavingArgs.getImageFileName.toLowerCase.replaceAll("[^-a-z0-9_\/\.]", “”)
)
}
}
Hi Jeremy,

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-13165. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Thanks. Is there a timeline for a bug fix, or a possible workaround? Is there something specific in the document we can remove to fix this issue?

Hi Jeremy,

Thanks for your inquiry. We try our best to deal with every customer request in a timely fashion, we unfortunately cannot guarantee a delivery date to every customer issue. Our developers work on issues on a first come, first served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

Currently, your issue is pending for analysis and is in the queue. Once our product team completes the analysis of your issue, we will then be able to provide you an estimate. Please remove footnotes from the document using following code to fix this issue. Hope this helps you.

Document doc = new Document(MyDir + "broken_table.docx");

doc.getChildNodes(NodeType.FOOTNOTE, true).clear();

doc.save(MyDir + "Out.html");


Thanks for your patience and understanding.

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


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