p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Microsoft Office > Other Office > Visual Studio Tools for Office
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Studio Tools for Office Be sure to specify which version you are working with.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio Tools for Office section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 16th, 2006, 04:52 AM
Authorized User
 
Join Date: Apr 2006
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default geting name of CustomDocumentProperties

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.CustomDocument Properties;

Type TypeOfAllCustomProps = AllCustomProps.GetType();

int NumberOfProperties = Int32.Parse(TypeOfAllCustomProps.InvokeMember("Cou nt",

BindingFlags.Default | BindingFlags.GetProperty,

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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old December 2nd, 2008, 06:36 AM
Registered User
Points: 4, Level: 1
Points: 4, Level: 1 Points: 4, Level: 1 Points: 4, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Can you please post a sample vb.net code which illustrates the way how we can access all properties from the file?
Thanks in aticipation.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old December 3rd, 2008, 08:43 AM
Friend of Wrox
Points: 1,449, Level: 15
Points: 1,449, Level: 15 Points: 1,449, Level: 15 Points: 1,449, Level: 15
Activity: 17%
Activity: 17% Activity: 17% Activity: 17%
 
Join Date: Sep 2005
Location: , , .
Posts: 420
Thanks: 0
Thanked 14 Times in 14 Posts
Default

Can you try like the following:

            Office.DocumentProperties oprop = (Office.DocumentProperties)ThisApplication.ActiveD ocument.CustomDocumentProperties;
            foreach (Office.DocumentProperty oprp in oprop)
            {
                MessageBox.Show( oprp.Name);
            }

Cheers
Shasur

C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old December 8th, 2008, 08:05 AM
Registered User
Points: 4, Level: 1
Points: 4, Level: 1 Points: 4, Level: 1 Points: 4, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the code, but the C# syntax was of less help to me.

What I am looking for is reading and resetting the document properties
like "Author" "Title" "Subject" "Company" etc. for specific office files.
Say for a file "SampleDocument.Doc".

I could not find in your code snippet where to pass the file name...sorry if I sound dumb...but I am fairly new to it.

Would appreciate if you share the references required too.

VB.net Please!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old December 12th, 2008, 09:18 PM
Friend of Wrox
Points: 1,449, Level: 15
Points: 1,449, Level: 15 Points: 1,449, Level: 15 Points: 1,449, Level: 15
Activity: 17%
Activity: 17% Activity: 17% Activity: 17%
 
Join Date: Sep 2005
Location: , , .
Posts: 420
Thanks: 0
Thanked 14 Times in 14 Posts
Default

Can you try using System.Reflection

The following thing worked for me

http://dotnetdud.blogspot.com/2008/1...s-of-word.html

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
geting the value from an Object JAdkins Classic ASP Basics 1 June 29th, 2007 11:59 AM
Problem in geting the @@Identity Value janamca_thanan Biztalk 0 December 17th, 2006 09:31 AM
deleting CustomDocumentProperties Medes Visual Studio Tools for Office 0 May 12th, 2006 05:16 PM
geting money type from sql msrnivas Classic ASP Components 1 July 19th, 2004 12:09 PM
Geting Index of a children tutul128 XML 2 May 27th, 2004 11:34 AM



All times are GMT -4. The time now is 12:27 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc