We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Accessing Document Properties

Hi,

We have been evaluating the Essential DocIO tool and would like to use it to access information stored in Word Document Custom Property fields. Some support for this is clearly present through the use of the WordReader.CustomDocumentProperties collection, but I have been unable to find any documentation of this property''s use.

How would I go about accessing a custom document property called "MyField"? I have tried using reader.CustomDocumentProperties["MyField"], but this throws an exception.

Any help would be much appreciated.

Cheers,

Owen

3 Replies

AD Administrator Syncfusion Team September 4, 2006 07:10 PM UTC

Hi Owen,

Thank you for evaluating Essential DocIO.

I was not able to reproduce the problem. It was working fine for me. You can access the custom properties from document by enumerating through the document.CustomDocumentProperties property and access the custom properties one by one by its index value. Also you can access the custom properties by its name.

I have created a small sample for accessing the document properties from the document. Please take a look at it and let me know if it meets your need.

Here is the code snippet to accessing the custom properties from document.

[C#]

for (int i = 0; i < Document.CustomDocumentProperties.Count; i++ )
{
Cus_Properties.Add( document.CustomDocumentProperties[i].ToString());
}

Thanks,
Prabhu


Accessing_CusProperties.zip


OM Owen Morgan-Jones September 5, 2006 09:57 AM UTC

Hi Prabhu,

Thanks for your swift reply. I tried the code snippet above, but it did not compile, and gave these error messages:

1) The best overloaded method match for ''Syncfusion.DocIO.DLS.CustomDocumentProperties.this[string]'' has some invalid arguments

2) Argument ''1'': cannot convert from ''int'' to ''string''

These were both caused by the line in the body of the for-loop.

This is typical of the problem I am having. I can see in the debugger''s watch that the document properties are held within the CustomDocumentProperties property, but am unable to access them through code, either with an index integer or a the property name as a string.

Regards,

Owen


AD Administrator Syncfusion Team September 5, 2006 01:58 PM UTC

Hi Owen,

Sorry for the inconvenience caused.

This issue was identifided internally and we have been fixed it. The sample was working fine in our latest internal assemblies. Could you please create a Direct – Trac incident by mentioning the forum ID for reference and I will send you the preview version of latest internal assemblies for run this sample.

Thanks,
Prabhu

Loader.
Live Chat Icon For mobile
Up arrow icon