Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

Adding custom document properties to word 2007

$
0
0

I am currently on .Net 4.5.1 . To create Custom document properties on word i used the dynamic keyword. as

dynamic cstmDocProp = mScribeShell.ScribeShell.ActiveWordDoc.CustomDocumentProperties;
string s = Convert.ToString(cstmDocProp[mConstants.g_sPROPERTY_DOCUMENT_INDEX].Value); 

On doing this i am getting an exception as: Value doesnt fall within the expected range of system.dynamic.

I also tried using :

Microsoft.Office.Core.DocumentProperties cstmDocProp = (Microsoft.Office.Core.DocumentProperties)mScribeShell.ScribeShell.ActiveWordDoc.CustomDocumentProperties;
but got the exception as:
Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Core.DocumentProperties'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{2DF8D04D-5BFA-101B-BDE5-00AA0044DE52}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). 

How do i resolve this ? or is there a different way i can access/create document properties both built-in & custom for word 2007 ?

Thanks/Saurav.



Suarav



Viewing all articles
Browse latest Browse all 5347

Trending Articles