Articles in this section
Category / Section

Add custom properties to Excel document using XlsIO

2 mins read

Syncfusion Essential XlsIO is a .NET Excel library used to create, read, and edit Excel documents. Using this library, you can add custom properties in Excel document in C# and VB.NET.

Document properties, also known as metadata, are details about a file that describe or identify it. There are four types of document properties namely,

  1. Standard properties
  2. Automatically updated properties
  3. Custom properties
  4. Document library properties

Custom document properties can be selected from the list of names or can be defined on your own. You can select type of property as date, text, number or yes or no and assign a value. 

Steps to add custom properties in Excel document programmatically:

Step 1: Create a new C# console application project.

Create new empty console application in visual studio

Step 2: Install the Syncfusion.XlsIO.WinForms NuGet package as reference to your .NET Framework application from NuGet.Org.

Add XlsIO reference to the project

Step 3: Include the following namespace in the program.cs file.


using Syncfusion.XlsIO;



Imports Syncfusion.XlsIO


Step 4: Use the following code snippet to add custom properties in Excel file.


using (ExcelEngine excelEngine = new ExcelEngine())
  //Instantiate the excel application object
  IApplication application = excelEngine.Excel;
  //The workbook is opened
  IWorkbook workbook;
  //Creating a workbook 4 worksheets
  workbook = application.Workbooks.Create(4);
  #region CustomProperites
  //Add custom properties to workbook
  workbook.CustomDocumentProperties["Department"].Text = "XlsIO";
  workbook.CustomDocumentProperties["Module"].Text = "Shapes";
  workbook.CustomDocumentProperties["Status"].Text = "Completed";
  workbook.CustomDocumentProperties["Worksheets_Count"].Value = workbook.Worksheets.Count;
  //Save the workbook with added custom properties and close
  Stream stream = File.Create("Output.xlsx");



Using excelEngine As ExcelEngine = New ExcelEngine
   'Instantiate the excel application object
   Dim application As IApplication = excelEngine.Excel
   'The workbook is opened
   Dim workbook As IWorkbook
   'Creating a workbook 4 worksheets
   workbook = application.Workbooks.Create(4)
   'Add custom properties to workbook
   workbook.CustomDocumentProperties("Department").Text = "XlsIO"
   workbook.CustomDocumentProperties("Module").Text = "Shapes"
   workbook.CustomDocumentProperties("Status").Text = "Completed"
   workbook.CustomDocumentProperties("Worksheets_Count").Value = workbook.Worksheets.Count
   'Save the workbook with added custom properties and close
   Dim stream As Stream = File.Create("Outpur.xlsx")
End Using


A complete working example to add custom properties into Excel document can be downloaded from

By executing the program, you will get the output as follows.

Add custom document properties in Excel using XlsIO


Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer the link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.


Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Please sign in to leave a comment