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

Free Support Forum - aspose.com

How to export paragraph to text except footnote using Java

Dear Team,

My query is releated to java Apose word product.

while reading the paragraph the footnote content should be ignored if paragraph contains footnote.

Input paragraph : bold shows the footnote :
Indian government representatives publicly insisted that the PNE was modeled after the US Ploughshares program, Project Ploughshares was an experimental program launched by the United States in the 1960s to leverage the use of nuclear explosives in large civil engineering programs. The US Atomic Energy Commission also explored the idea of conducting PNEs in India to quell its quest for prestige and use nuclear excavation to resolve “some of its basic river problems.” However, the program was unsuccessful in the United States because of the negative environmental fallout and public opposition. It was finally terminated in 1977. For an overview of the program, see Scott Kaufman, Project Ploughshare: The Peaceful Use of Nuclear Explosives in Cold War America (Ithaca: Cornell University Press, 2013); also see, Perkovich, India’s Nuclear Bomb, p. 91.
which was an experimental attempt to leverage nuclear explosives in support of large engineering projects.

Expected output :

Indian government representatives publicly insisted that the PNE was modeled after the US Ploughshares program, which was an experimental attempt to leverage nuclear explosives in support of large engineering projects.

Kampani_Ch_3.zip (108.2 KB)

Reading paragraph code :
for (Paragraph para : (Iterable) doc.getChildNodes(NodeType.PARAGRAPH, true)) {
String paraTxt = para.toString(SaveFormat.TEXT);
System.out.println(paraTxt);
}

Thanks and regards,
Kesavaraman

@keshav07

Please use the following code example to get the desired output. Hope this helps you.

Document doc = new Document(MyDir + "Kampani_Ch_3.docx");
doc.getChildNodes(NodeType.FOOTNOTE, true).clear();
for (Paragraph para : (Iterable<Paragraph>) doc.getChildNodes(NodeType.PARAGRAPH, true)) {

    String paraTxt = para.toString(SaveFormat.TEXT);
    System.out.println(paraTxt);
}