DocumentUpdateWordCount Method
Updates word count properties of the document.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.9
public void UpdateWordCount()

UpdateWordCount recalculates and updates Characters, Words and Paragraphs properties in the BuiltInDocumentProperties collection of the Document.

Note that UpdateWordCount does not update number of lines and pages properties. Use the UpdateWordCount overload and pass True value as a parameter to do that.

When you use an evaluation version, the evaluation watermark will also be included in the word count.

Shows how to update all list labels in a document.

Document doc = new Document(MyDir + "Document.doc");

// Some work should be done here that changes the document's content.

// Update the word, character and paragraph count of the document.

// Display the updated document properties.
Console.WriteLine("Characters: {0}", doc.BuiltInDocumentProperties.Characters);
Console.WriteLine("Words: {0}", doc.BuiltInDocumentProperties.Words);
Console.WriteLine("Paragraphs: {0}", doc.BuiltInDocumentProperties.Paragraphs);
See Also