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

Free Support Forum - aspose.com

Getting text whilst retaining it's formatting

I was trying to retrieve formatted text from a document (in order to pass into another document, keeping it’s text formatting) using the following article:
I created the DocToTxtWriter Class and tried to copy formatted text using the code below.
Unfortunately the resulting text that is printed (docToTxtWriter.GetText) seems to be blank. The document definitely has text in it. Is there something else I have to do or am I missing something?
Many thanks,

public void ToText(String documentDir, String documentName) throws Exception
    // Open the document we want to convert.
    Document doc = openDocument(documentDir,documentName);
    // Create an object that inherits from the DocumentVisitor class.
    DocToTxtWriter docToTxtWriter = new DocToTxtWriter();


Thanks for your request. Actually, this code gets plain text from the document. But you mentioned that you need to insert formatted text.
I think the following articles could be more useful for you.
Best regards.

Thanks again Alexey,
very much appreciated.