Bullet elements missing in text output

Dear Aspose Support Team,

I have tried to open attached document (TestDocument.docx) using aspose-words-15.5.0-jdk16 and save text content to output file (text.txt).

The source code is simple:

FileInputStream documentInputStream = new FileInputStream(pathToDocXFile);

Document wordDocument = new Document(documentInputStream);

documentInputStream.close();
String originalText = wordDocument.getText();

Files.write(new File("PATH_ON_LOCAL_DRIVE").toPath(), originalText.getBytes(StandardCharsets.UTF_8));

In the output file I see the next issues with content.

a) On the top of document there is a : HYPERLINK HYPERLINK : with special paragraphs within content
b) Missed bullets in output: 1. 2. 6.-13.

Could you please investigate these issues? Especially issues related to bullets because I can such kind of issues quite often.

Thanks,
Andrei

Hi Andrei,

Thanks for your inquiry. Please use following code example to save Word document to Txt file format. Moreover, please read features supported on saving document to text file format from here:
https://docs.aspose.com/words/java/save-a-document/

Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "TestDocument.docx");
TxtSaveOptions options = new TxtSaveOptions();
options.setSimplifyListLabels(true);
options.setPreserveTableLayout(true);
doc.save(MyDir + "Out2.txt", options);

Hello Tahir,

Thank you for the quick response. It works on the way proposed. But is it not a bug when getText() returns a different value from save method? For example I don’t want to text content at all (I know I can try to use ByteOutputStream) and first sensible method for me is getText…

Regards,
Andrei

Hi Andrei,

Thanks for your inquiry. Document.getText method returns the text of this node and of all its children. The returned string includes all control and special characters as described in ControlChar. If you want to get the text of document, you can also use Document.toString(SaveFormat.TEXT) method. Hope this helps you. Please let us know if you have any more queries.