|
|
 |
| 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.
|
 |

May 16th, 2006, 04:52 AM
|
|
Authorized User
|
|
Join Date: Apr 2006
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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());
|

December 2nd, 2008, 06:36 AM
|
|
Registered User
|
|
Join Date: Dec 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

December 3rd, 2008, 08:43 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2005
Location: , , .
Posts: 420
Thanks: 0
Thanked 14 Times in 14 Posts
|
|
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)
|

December 8th, 2008, 08:05 AM
|
|
Registered User
|
|
Join Date: Dec 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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!
|

December 12th, 2008, 09:18 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2005
Location: , , .
Posts: 420
Thanks: 0
Thanked 14 Times in 14 Posts
|
|
Can you try using System.Reflection
The following thing worked for me
http://dotnetdud.blogspot.com/2008/1...s-of-word.html
Cheers
Shasur
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |