Created
October 23, 2023 06:56
-
-
Save fileformat-cells-gists/d9e4f31e6d24199737a4993931dde324 to your computer and use it in GitHub Desktop.
Get Document Properties to a Workbook in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string filePath = "/path/to/existing/spreadsheet.xlsx"; // Replace with the path to your file | |
// Open the existing workbook. | |
using (var workbook = new Workbook(filePath)) | |
{ | |
// Retrieve and display the document properties. | |
var properties = workbook.BuiltinDocumentProperties; | |
DisplayProperties(properties); | |
} | |
// Helper method to display document properties. | |
static void DisplayProperties(BuiltInDocumentProperties properties) | |
{ | |
Console.WriteLine($"Author: {properties.Author}"); | |
Console.WriteLine($"Title: {properties.Title}"); | |
Console.WriteLine($"Created Date: {properties.CreatedDate}"); | |
Console.WriteLine($"Modified By: {properties.ModifiedBy}"); | |
Console.WriteLine($"Modified Date: {properties.ModifiedDate}"); | |
Console.WriteLine($"Subject: {properties.Subject}"); | |
Console.WriteLine("================================="); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment