Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Visual Studio Tools for Office
|
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 Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 16th, 2006, 03:52 AM
Authorized User
 
Join Date: Apr 2006
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());


 
Old December 2nd, 2008, 06:36 AM
Registered User
 
Join Date: Dec 2008
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.

 
Old December 3rd, 2008, 08:43 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 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)
 
Old December 8th, 2008, 08:05 AM
Registered User
 
Join Date: Dec 2008
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!

 
Old December 12th, 2008, 09:18 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 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)





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.