Section srcSection=document.getSection();
for (Node srcNodeFinal : srcSection.getBody()){
DocumentParagraph documentParagraph = new DocumentParagraph();
if (srcNodeFinal.getNodeType() == NodeType.PARAGRAPH)
{
documentParagraph.setParagraph(((Paragraph) srcNodeFinal));
documentParagraph.setIsListItem(((Paragraph) srcNodeFinal).isListItem());
documentParagraph.setListLevelNumber(((Paragraph) srcNodeFinal).getListFormat().getListLevelNumber());
documentParagraph.setText(srcNodeFinal.getText());
documentParagraph.setHTMLText(getHtemString);
return documentParagraph;
}
}
Hi @tahir.manzoor,
I wand to do same as above for StructuredDocumentTag.
I have used the code given below:
else if(srcNodeFinal.getNodeType() == NodeType.STRUCTURED_DOCUMENT_TAG)
{
StructuredDocumentTag sdt = (StructuredDocumentTag)srcNodeFinal;
Run run = new Run(parsedDocument);
run.setText(sdt .getText());
Paragraph para = new Paragraph(parsedDocument);
para.appendChild(run);
documentParagraph.setParagraph(para);
documentParagraph.setIsListItem(true);
documentParagraph.setListLevelNumber(sdt.getLevel());
documentParagraph.setText(sdt .getText());
documentParagraph.setHTMLText(getHtemString);
return documentParagraph;
}
The above else if part of code is not working for me as expected. we want same behavior as paragraph when we are using StructuredDocumentTag. I have attached image for my input data.
Capture.PNG (10.9 KB)