Other API Samples

Live SpreadsheetGear API Samples

Workbook Miscellaneous Built-In and Custom Document Properties

Demonstrates setting a variety of Built-In Document Properties as well as creating Custom Properties.

// Create a new workbook
SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook();

// Set some of the Built-In Properties.
SpreadsheetGear.IBuiltinDocumentProperties builtInProps = 
        workbook.BuiltinDocumentProperties;
builtInProps.Author = "John Doe";
builtInProps.Subject = "My Subject";
builtInProps.Title = "My Title Document Property";
builtInProps.Category = "Spreadsheet Component Software";
builtInProps.Keywords = "Spreadsheet, Excel, .NET";
builtInProps.Comments = "This is a comment.";
builtInProps.ContentStatus = "This is the status";

// Create some Custom Properties
SpreadsheetGear.IDocumentProperties customProps = workbook.CustomDocumentProperties;
customProps.Add("My Text Prop", "My Text Value");
customProps.Add("My Date Prop", new System.DateTime(2000, 1, 1));
customProps.Add("My Boolean Prop", true);
customProps.Add("My Number Prop", 123.456);
Run This Sample
Download File

Download an Excel Open XML Workbook (*.xlsx) file with the results of this sample.