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

Free Support Forum - aspose.com

Can I read the word file line by line?

I want to extract the word file’s content line by line.
It’s best that the table,image and the information of the file’s fonts and color also can be extracted.
I want to extract them and then write them to database.
Is it possible with Aspose.Words for .Net?
I can’t find any full sample for demonstrating this.
If it is possible,could you please give me a simple sample?
I have attached a word file for your test.
Many thanks and best wishes!

Thanks for your inquiry. Aspose.Words document represents content and formatting of a document, not its layout into lines and pages. But if you would like read table rows then you can use the following code.

NodeCollection rows = doc.GetChildNodes(NodeType.Row, true);
foreach (Row row in rows)
    // Do something with row.

You can extract images from document. See the following link.
I hope that this could help you.
Best regards.

Thanks very much for your reply.
If I just want to extract the doc file’s text content,is it possible?
Could you please give me a full sample in VB.net?
We are very urgent and have no more time to study it.
Thanks again!

If you would like to extract text from document only then you can try using the following code snippet.

Dim doc As Document = New Document("in.doc")
Dim content As String = doc.GetText()

I hope this could help you.
Best regards.