J
Jeffrey A. Voigt
I have the following word code in C#. After opening up a word document, I'm
trying to get all of the custom document properties, however the cast is not
working at all. Has anyone ran into this issue before?
Word.Document ExistingDocument;
object OpenFormat = Word.WdOpenFormat.wdOpenFormatAuto;
object oDocumentType = Word.WdDocumentType.wdTypeDocument;
object ExistingFile = txtFileLocation.Text;
try
{
ExistingDocument = oWord.Documents.Open(ref ExistingFile,ref
oMissing,ref oFalse,ref oFalse, ref oMissing,ref oMissing,ref oMissing,ref
oMissing,ref oMissing,ref OpenFormat,ref oMissing, ref oTrue,ref oFalse,ref
oMissing,ref oMissing);
}
catch(Exception ex)
{
//error retrieving the file
MessageBox.Show(ex.Message);
return;
}
try
{
//get the custom properties of the word document
Microsoft.Office.Core.DocumentProperties properties =
ExistingDocument.CustomDocumentProperties as
Microsoft.Office.Core.DocumentProperties;
}
Thanks,
- V
trying to get all of the custom document properties, however the cast is not
working at all. Has anyone ran into this issue before?
Word.Document ExistingDocument;
object OpenFormat = Word.WdOpenFormat.wdOpenFormatAuto;
object oDocumentType = Word.WdDocumentType.wdTypeDocument;
object ExistingFile = txtFileLocation.Text;
try
{
ExistingDocument = oWord.Documents.Open(ref ExistingFile,ref
oMissing,ref oFalse,ref oFalse, ref oMissing,ref oMissing,ref oMissing,ref
oMissing,ref oMissing,ref OpenFormat,ref oMissing, ref oTrue,ref oFalse,ref
oMissing,ref oMissing);
}
catch(Exception ex)
{
//error retrieving the file
MessageBox.Show(ex.Message);
return;
}
try
{
//get the custom properties of the word document
Microsoft.Office.Core.DocumentProperties properties =
ExistingDocument.CustomDocumentProperties as
Microsoft.Office.Core.DocumentProperties;
}
Thanks,
- V