Detecting style "normal"

A

Andrey Dzizenko

Hello!

Is there any opportunity in MS Word automation to detect if paragraph
style is "Normal"?
Without hardcoded range.get_Style().NameLocal.Contains("Normal")

Thank you in advance for any comments.

Best regards,
A. Dzizenko.
 
C

Cindy M.

Hi Andrey,
Is there any opportunity in MS Word automation to detect if paragraph
style is "Normal"?
Without hardcoded range.get_Style().NameLocal.Contains("Normal")
Use the wdBuiltinStyle enum instead of the string value (local name),
which is language independent. Normal would be wdStyleNormal

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
A

Andrey Dzizenko

Maybe I'm stupid =)
And how can I compare my current style and wdStyleNormal?

Best regards,
A. Dzizenko.
 
A

Andrey Dzizenko

I did it like that:

object _styleNormal = WdBuiltinStyle.wdStyleNormal;
string _styleNormalName = _document.Styles.get_Item(ref
_styleNormal).NameLocal;

And then compare currentStyle.NameLocal and _styleNormalName. Am I right?
 
C

Cindy M.

Hi Andrey,
I did it like that:

object styleNormal = WdBuiltinStyle.wdStyleNormal;
string styleNormalName = document.Styles.get Item(ref
styleNormal).NameLocal;

And then compare currentStyle.NameLocal and styleNormalName. Am I right?
Yes, that works :)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top