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

Free Support Forum - aspose.com

HTML tags generates problems

Hello.


I have some problems on using Aspose Words, inserting some specific HTML elements vía DocumentBuilder:

Issues:

1.- When a HTML contains tags like: , Empty tags with no ID and name: When exporting to PDF or creating a Table of Contents the process hangs for a very long time (about 30 minutes )

2.- When using
  • , this is, empty
  • tags, the document builder raises a null pointer exception:

  • java.lang.NullPointerException
    at com.aspose.words.zzZWC.zzWF(Unknown Source)
    at com.aspose.words.zzZWC.zzZLp(Unknown Source)
    at com.aspose.words.zzZVV.zzT(Unknown Source)
    at com.aspose.words.zzZVV.zzZ(Unknown Source)
    at com.aspose.words.zzZVV.zzO(Unknown Source)
    at com.aspose.words.zzZVV.zzP(Unknown Source)
    at com.aspose.words.zzZVV.zzO(Unknown Source)
    at com.aspose.words.zzZVV.zzP(Unknown Source)
    at com.aspose.words.zzZVV.zzO(Unknown Source)
    at com.aspose.words.zzZVV.zzP(Unknown Source)
    at com.aspose.words.zzZVV.zzO(Unknown Source)
    at com.aspose.words.zzZVV.zzP(Unknown Source)
    at com.aspose.words.zzZVV.zzO(Unknown Source)
    at com.aspose.words.zzZVV.zzP(Unknown Source)
    at com.aspose.words.zzZVV.zzZ(Unknown Source)
    at com.aspose.words.DocumentBuilder.zzZ(Unknown Source)
    at com.aspose.words.DocumentBuilder.insertHtml(Unknown Source)

    We have isolated the problem to a block of HTML and executing the code:

    Document wordTest = new Document();
    DocumentBuilder docBuilder = new DocumentBuilder(wordTest);
    docBuilder.moveToDocumentEnd();
    String content = new String(Files.readAllBytes(Paths.get(“c:\temp\liproblem.html”))); //i attached this file to the post
    docBuilder.insertHtml(content); //This line of code raises the exception
    wordTest.save(“c:\temp\temp.docx”);


    We are currently deleting these problematic specific tags with regular expressions, is there any alternative or solutions, what other tags can cause exceptions in a possibly bad formed html ?

    Maybe we can try to add the node directly, not by using document builder, could this help ? what is the sample code for adding HTML node ?
    Hi Jose,

    Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for Java 16.2.0 and have not found the shared issue. Please use Aspose.Words for Java 16.2.0 and let us know if you have any more queries.

    Hello.


    Thank you so much for the answer, is this version available in the Aspose maven repository (http://maven.aspose.com/repository/repo/) ?

    Regards !
    Hi Jose,

    Thanks for your inquiry. The latest version of Aspose.Words for Java 16.2.0 is not available at Aspose maven repository at the moment. We will update the Aspose maven repository soon. We apologize for your inconvenience.

    Please download Aspose.Words for Java 16.2.0 from following link.
    Download Aspose.Words for Java 16.2.0