How to access Excel document properties using WinForms XlsIO?
The Excel document properties can be accessed using the IBuiltInDocumentProperties interface. The code sample below illustrates how to access all the Excel document properties using XlsIO.
C#
IWorkbook workbook = application.Workbooks.Open(inputPath, ExcelOpenType.Automatic); // Accessing the BuiltInDocument properties. IBuiltInDocumentProperties builtInDocumentProperties = book.BuiltInDocumentProperties; string author = builtInDocumentProperties.Author; string applicationName = builtInDocumentProperties.ApplicationName; string comments = builtInDocumentProperties.Comments; string company = builtInDocumentProperties.Company; DateTime creationDate = builtInDocumentProperties.CreationDate; TimeSpan editTime = builtInDocumentProperties.EditTime; string keywords = builtInDocumentProperties.Keywords; string lastAuthor = builtInDocumentProperties.LastAuthor; DateTime lastPrinted = builtInDocumentProperties.LastPrinted; DateTime lastSaveDate = builtInDocumentProperties.LastSaveDate; bool linksDirty = builtInDocumentProperties.LinksDirty; string manager = builtInDocumentProperties.Manager; string presentationTarget = builtInDocumentProperties.PresentationTarget; string revisionNumber = builtInDocumentProperties.RevisionNumber; string subject = builtInDocumentProperties.Subject; string template = builtInDocumentProperties.Template; string title = builtInDocumentProperties.Title;
VB
'Step 1 : Instantiate the spreadsheet creation engine. Dim excelEngine As ExcelEngine = New ExcelEngine() 'Step 2 : Instantiate the excel application object. Dim application As IApplication = excelEngine.Excel Dim inputPath As String = GetFullTemplatePath("Sample.xlsx") Dim workbook As IWorkbook = application.Workbooks.Open(inputPath, ExcelOpenType.Automatic) 'The Accessing the BuiltInDocumentProperties. Dim builtInDocumentProperties As IBuiltInDocumentProperties = book.BuiltInDocumentProperties Dim author As String = builtInDocumentProperties.Author Dim applicationName As String = builtInDocumentProperties.ApplicationName Dim comments As String = builtInDocumentProperties.Comments Dim company As String = builtInDocumentProperties.Company Dim creationDate As DateTime = builtInDocumentProperties.CreationDate Dim editTime As TimeSpan = builtInDocumentProperties.EditTime Dim keywords As String = builtInDocumentProperties.Keywords Dim lastAuthor As String = builtInDocumentProperties.LastAuthor Dim lastPrinted As DateTime = builtInDocumentProperties.LastPrinted Dim lastSaveDate As DateTime = builtInDocumentProperties.LastSaveDate Dim linksDirty As Boolean = builtInDocumentProperties.LinksDirty Dim manager As String = builtInDocumentProperties.Manager Dim presentationTarget As String = builtInDocumentProperties.PresentationTarget Dim revisionNumber As String = builtInDocumentProperties.RevisionNumber Dim subject As String = builtInDocumentProperties.Subject Dim template As String = builtInDocumentProperties.Template Dim title As String = builtInDocumentProperties.Title
The sample illustrating this behavior can be downloaded here
Take a moment to peruse the documentation where you can find basic Excel document processing options along with the features like import and export data, chart, formulas, conditional formatting, data validation, tables, pivot tables and protect the Excel documents, and most importantly, the PDF, CSV and Image conversions with code examples.
Conclusion
I hope you enjoyed learning about how to access Excel document properties using WinForms XlsIO.
You can refer to our XIsIO’s feature tour page to learn about its other groundbreaking features. Explore our UG documentation and online demos to understand how to manipulate data in Excel documents.
If you are an existing user, you can access our latest components from the License and Downloads page. For new users, you can try our 30-day free trial to check out XlsIO and other Syncfusion® components.
If you have any queries or require clarification, please let us know in the comments below or contact us through our support forums, Support Tickets, or feedback portal. We are always happy to assist you!