none
Selection of all instances of Word Style throughout the word document using C#. RRS feed

  • Question

  • Hi,

    I am working on one functionality in C# where i have to highlight all the instances of a particular style. Lets say, i have a style like "heading 1", so i would like to select all the available "heading 1" styles throughout the word document. It should work similar to the word option "Select all 3 instances", when we click on any style and do a right click. Please have a look at the image below.

      

    Please, let me know, if anyone has any questions.

    Thanks


    Shahab Abbasi

    Wednesday, August 1, 2012 12:34 PM

Answers

  • It's an interesting challenge.

    I think the way to do it would be to iterate over all the styles in the document (Word's Document object has a Styles property, which lists all the styles in the document). Then,  for each one, you could use locate the instances where it's used with a Find operation.

    Wednesday, August 1, 2012 6:15 PM

All replies

  • It's an interesting challenge.

    I think the way to do it would be to iterate over all the styles in the document (Word's Document object has a Styles property, which lists all the styles in the document). Then,  for each one, you could use locate the instances where it's used with a Find operation.

    Wednesday, August 1, 2012 6:15 PM
  • I also tried the same, but word is getting crashed.

    Shahab Abbasi

    Thursday, August 2, 2012 6:18 AM