October 16th, 2012, 06:08 AM
Compare Paragraph Styles
I am writing a word document using C#. At some point, I have to see if a heading is already archived in word, so that I can skip writing it again. My problem is
1. I can not iterate through headings in a word document.
2. If I iterate through paragraph and try to compare if its heading is same Word.WdBuiltinStyle.wdStyleHeading1, it returns me an error that unboxing in this format is not possible.
Below is the code:
I do not want to do it with Syle.NameLocal because it differs on different machines depending on the word language.
object headingStyle = Microsoft.Office.Interop.Word.WdBuiltinStyle.wdStyleHeading1;
foreach (Word.Paragraph para in mTdbDoc.Paragraphs)
Word.WdBuiltinStyle style = (Word.WdBuiltinStyle)para.get_Style(); //Error here
Any hint will be helpful.
October 17th, 2012, 04:22 AM
Re: Compare Paragraph Styles
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.