geting name of CustomDocumentProperty

M

Medes

Hi,

I want to get the name of a custom property.

I know that you can get number of custom properties in a document by using
following code, but how can i get the name of them?

AllCustomProps = this.WordApplication.ActiveDocument.CustomDocumentProperties;

Type TypeOfAllCustomProps = AllCustomProps.GetType();

int NumberOfProperties =
Int32.Parse(TypeOfAllCustomProps.InvokeMember("Count",

BindingFlags.Default | BindingFlags.GetProperty,

null, AllCustomProps, new object[] { }).ToString());
 
T

Tony Jollans

You'll need to translate this to your own language but ...

CustomDocumentproperties(n).Name

should give the name of the nth custom property
 
C

Cindy M -WordMVP-

Reply posted in the VSTO forum.
want to get the name of a custom property.

I know that you can get number of custom properties in a document by using
following code, but how can i get the name of them?

AllCustomProps = this.WordApplication.ActiveDocument.CustomDocumentProperties;

Type TypeOfAllCustomProps = AllCustomProps.GetType();

int NumberOfProperties =
Int32.Parse(TypeOfAllCustomProps.InvokeMember("Count",

BindingFlags.Default | BindingFlags.GetProperty,

null, AllCustomProps, new object[] { }).ToString());

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 :)
 
C

Cindy M -WordMVP-

Hi Tony,
You'll need to translate this to your own language but ...

CustomDocumentproperties(n).Name

should give the name of the nth custom property
Medes problem is that he's working in C#, which means he
needs to use Late-Binding. Complicated, as you can see from
the code sample he posted. He probably knows he needs the
Name property, he just doesn't know how to use it with
InvokeMember...

Cindy Meister
 

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