Dec 11, 2011

Reading Summary Properties of Word Document

Part II
Read the Introduction about this article Part I
In this post, we can see what is the code for the reading the summary properties of the word document.
public static void GetDocumentSummaryProperties(string filename)
{
            DSOFile.OleDocumentPropertiesClass doc = new DSOFile.
            OleDocumentPropertiesClass();
            doc.Open(filename, false,

            DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess );

            //getting the properties of the document
            DSOFile.SummaryProperties summaryProp = doc.SummaryProperties;

            //reading and writng the summary properties to a file
            string author = summaryProp.Author;
            string comapanyName = summaryProp.Company;
            string managerName = summaryProp.Manager;
            StreamWriter sw = new StreamWriter(@"D:\FileRead.txt");
            sw.WriteLine(author);
            sw.WriteLine(comapanyName);
            sw.WriteLine(managerName);
            sw.Close();
}
That’s It. Enjoy Happy Coding!
Also, read how to Read the Custom Properties of Word Document Part III

0 comments:

Post a Comment

Dear Readers,

I LOVE to hear from you! Your feedback is always appreciated. I will try to reply to your query as soon as possible.

1. Make sure to click the "Notify me" check box at the right side to be notified of follow up comments and replies.
2. Please Do Not Spam - Spam comments will be deleted immediately upon review.