locked
counting bold in word document RRS feed

  • General discussion

  • Hi Frnz,
     
            I Want to Count 'Bold' letters in a Word Document.I tried by using 'Range' property of   'Microsoft.office.Interop.Word' .
     

     
              the code i used with "Range" is  
                       
           For Test purpose i have taken only one single bold letter in my word document to avoid mess with "start" and "end" arguments of "Range".
                       
                          object start = 0;
                        //object end = WDocument.Content.Text.Length; ;
                        object end = 1;
                        for (int i = 0; i < 1 ;i++ )
                        {
                            Word.Range rng = WDocument.Range(ref start,ref end);
                            if (rng.Font.Name=="Bold")
                            {
                                boldcount += 1;
                            }
                        }
    But,It is not working.so plz advise me which property i have to use to calculate count of bold letters of Word document

    Please give the solution to count the bold letters of word document.


    Thanks in advance,

    Hari.A
    Thursday, August 6, 2009 4:51 AM