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

Free Support Forum - aspose.com

NoSuchMethodError: com.aspose.words.Paragraph.<init>(Lcom/aspose/words/Document;)V

Hello Aspose Team,

I am trying to extract Html text from the doc and getting the exception below. Code i am using for this is

private String getClauseHTMLText(Paragraph clauseStart) throws Exception{

String htmlText = null;

Document tempDoc = new Document();

Paragraph tempPara = clauseStart;

ByteArrayOutputStream outStream = new ByteArrayOutputStream();

while(tempPara != null){

Node newNode = (Node)tempDoc.importNode(tempPara, true, ImportFormatMode.USE_DESTINATION_STYLES);

tempDoc.getLastSection().getBody().appendChild(newNode);

tempDoc.getLastSection().getBody().appendChild(new Paragraph(tempDoc));

tempPara = (Paragraph)tempPara.getNextSibling();

if(tempPara != null && tempPara.getListFormat() != null && tempPara.getListFormat().isListItem() && tempPara.getListFormat().getListLevelNumber() <= 1)

break;

}

tempDoc.save(outStream, SaveFormat.HTML);

htmlText = outStream.toString("UTF-8");

return htmlText;

}

Exception:

Caused by: java.lang.NoSuchMethodError: com.aspose.words.Paragraph.(Lcom/aspose/words/Document;)V
2010-07-28 17:35:03,969 ERROR [STDERR] at com.zycus.authoring.document.WordDocService.getClauseHTMLText(WordDocService.java:419)

Thanks!!

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I cannot reproduce the problem on my side. Your code works fine. I use the latest version of Aspose.Words for Java for testing. You can download it from here:

http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/category1378.aspx

Also, could you please attach your document here for testing? I will check it and provide you more information.

Best regards,

Thanks for your quick reply.

I am attaching the doc I am using for parsing.

Can you please give me your code so that it can me in implementation?

Thanks!

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. Your code works file with the attached document. Here is code I used for testing:

Document doc = new Document("C:\\Temp\\TestCheck2.doc");

for(Paragraph par : doc.getFirstSection().getBody().getParagraphs())

{

System.out.println(getClauseHTMLText(par));

}

I did not change anything in your implementation of getClauseHTMLText method.

Best regards,