How to determine if a Style uses a frame
-
Monday, July 18, 2011 6:48 PM
I am working on code that needs to know if a Style utilizes a Frame. I have found the following link, which indicates that checking for a height and width of -1 should do the trick:
http://www.shaunakelly.com/word/styles/frames-in-paragraph-styles.html
However, I have added a Frame to a Paragraph Style, and the properties are still returning -1.
Is there a better way from word the object model to know if a Style uses a Frame?
All Replies
-
Tuesday, July 19, 2011 11:45 AMModerator
Hi Dan
In a quick test, if the Style.Description contains the term "Position:" then it likely contains a frame. With the possible exception of a text box (which can be included when creating a style by example, but not over the menus) that's the only thing that would use Position: I think.
The other way would be to apply the style, check Range.Frames.count then "Undo" the action.
Cindy Meister, VSTO/Word MVP- Marked As Answer by Dan9298 Tuesday, July 19, 2011 12:26 PM
-
Tuesday, July 19, 2011 12:28 PM
Hello Cindy,
Thanks for the response. I believe your idea of checking for 'Position:' in the Style.Description will work for my needs.
Your answers to other users on this forum have helped me countless times.
-
Tuesday, July 19, 2011 12:52 PMModeratorGlad I could help, Dan :-)
Cindy Meister, VSTO/Word MVP

