I’m looking into creating a solution which will count documents in a customized way - including headers & not counting blank lines. Is there an Aspose program which would work for this, or help us to create our own?
Note - the basic MS Word counts do not accomplish this for us, as they don’t have these options.
Hello
Thanks for your inquiry. Using the classes of the Aspose.Words DOM, you can get detailed programmatic access to any document elements. Please see the following link to learn more about Aspose.Words Document Object Model (DOM) and its relationships.
https://docs.aspose.com/words/net/aspose-words-document-object-model/
In additional, I think, in your case, you can use DocumentVisitor. Please follow the link to learn more:
https://reference.aspose.com/words/net/aspose.words/documentvisitor/
Hope this helps you.
Best regards,
Hi Melissa,
Furthermore I think string.IsNullOrEmpty(Node.ToTxt().Trim()); will come in very handy. Also the content of headers and footers can be repeated on many pages. You will want to find the page count and multiply the counts found in these places by the number of pages. You will most likely need to add a bit of logic for working out if the first page headers/odd even headers are being used.
Thanks,
Is there any functionality in Aspose, which would count all the characters in the document?
Hello
Thanks for your request. Using Aspose.Words you can achieve this. Please see the following simple code:
Document doc = new Document("C:\\Temp\\yourDoc.doc");
CalculateCount count = new CalculateCount();
doc.Accept(count);
Console.WriteLine(count.ChCount);
class CalculateCount: DocumentVisitor
{
public int ChCount;
public override VisitorAction VisitRun(Run run)
{
string ch = run.Text;
ChCount += ch.Length;
return VisitorAction.Continue;
}
}
Hope this helps.
Best regards,