I want to detect line/paragraph breaks in a document, is it possible using Aspose.words(Java) to detect line/paragraph breaks and replace them?
PFA document for input.
======== Doc Content =============
This is 1st paragraph.
This is 2nd paragraph.
This is 3rd paragraph.
======= Expected Content ==========
This is 1st paragraph.~Line-Break~
This is 2nd paragraph.~Line-Break~
This is 3rd paragraph.~Line-Break~
Your documents contains the paragraph break. You can iterate over paragraphs nodes of document and get their text. Please check the following code example. Hope this helps you.
Document document = new Document(MyDir + "test_breaks.docx");
for (Paragraph paragraph : (Iterable<Paragraph>)document.getChildNodes(NodeType.PARAGRAPH, true))
{
System.out.println(paragraph.getText());
}
@tahir.manzoor thanks for quick response.
I tried the suggested code, actually I want to update an end of all paragraphs with ~line-break~.
But when I try to save the document into html format after updating the end of paragraph, the saved html file is not same as word document, bullet points are getting misplaced.
Looks like an issue, please take a look at it.
PFA input and output file.
Code -
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-19543. You will be notified via this forum thread once this issue is resolved.
Could you please share your expected output document here for our reference? We will then provide you code example accordingly. Thanks for your cooperation.