Free Support Forum - aspose.com

Can ASPOSE.WORD count the character and line count of the word document being edited/saved

Folks,

We have a ASP.NET / SQL Server 2005 application with Aspose.word. At present we are using Aspose.word to edit/save the MS-Word files online.

We would also like to get the character and line count of the MS-word file being updated and saved. Then we can update SQL Server database with line count and character count of this MS-Word document file.

This will help our website users to see the line count and character count along with MS-word document. At present we have to do this work manualy for each Word file every time we edit and save it.

Thanks for your input and help.

Al

Hi

Thanks for your inquiry. You can get this information using BuiltInDocumentProperties.

doc.BuiltInDocumentProperties.Lines

doc.BuiltInDocumentProperties.Characters

But there is one problem. Aspose.Words document represents content and formatting of a document, not its layout into lines and pages. So if you edit content in the document then you can get not properly lines count.

Characters, Words and Paragraphs properties can be updated using UpdateWordCount method. For more information see the following link.

http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/aspose.words.properties.builtindocumentproperties.html

http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/aspose.words.document.updatewordcount.html

Best regards.