none
Get Line count while creating a word document using openXML C# RRS feed

  • Question

  • Hello all,

    I am creating and exporting a word document using openxml in an asp.net application. The document contains some data fetched from DB.

    Now, I want the total line count through the C# code (which we can generally get from word count option in the document)

    Please some1 help...

    Thank you.

    Wednesday, November 21, 2012 11:34 AM

Answers

  • This cannot be done using the Open XML SDK. The line count is a dynamic value that depends on how Word lays out the document at any particular moment. Where lines break (and thus the count) can vary according to printer driver and other factors. There is no "real", guaranteed line-count that can be calculated when the document has not been opened in Word.


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, November 21, 2012 3:11 PM
    Moderator