How to access Excel document properties using WinForms XlsIO?
The Excel document properties can be accessed by IBuiltInDocumentProperties interface. The below code sample illustrates on how to access all the Excel document properties using XlsIO.
C#
IWorkbook workbook = application.Workbooks.Open(inputPath, ExcelOpenType.Automatic); //Accessing the BuiltInDocumnet 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
Conclusion
I hope you enjoyed learning about how to access Excel document properties using WinForms XlsIO.
You can refer to our WinForms XIsIO feature
tour page to know about its other groundbreaking
feature representation documentation
and how to quickly get started for configuration
specifications.
You can also explore our WinForms XIsIO example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!