EasyXLS™ library provides methods for handling the file properties of an Excel document.
There are two kinds of properties that can be defined, preset document properties and custom document properties.
The preset document properties includes title, subject, categories, comments, author, company, manager, keywords, revision number and others.
By using custom document properties feature you can define your own document properties. You can assign a text, date, or numeric value to custom file properties, and you can also assign them the values "Yes" or "No."
EasyXLS allows you to export the document properties for an Excel file. It also allows you to read the document properties of an Excel file.
// Create an instance of the class that exports Excel files
ExcelDocument workbook = new ExcelDocument(1);
// Set the 'Subject' document property
workbook.getSummaryInformation().setSubject("This is the subject");
// Set the 'Manager' document property
workbook.getDocumentSummaryInformation().setManager("This is the manager");
// Set a custom document property
workbook.getDocumentSummaryInformation().setCustomProperty(
"PropertyName", FileProperty.VT_NUMBER, "4");
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Excel document properties.xlsx");
' Create an instance of the class that exports Excel filesDim workbook As New ExcelDocument(1)
' Set the 'Subject' document property
workbook.getSummaryInformation().setSubject("This is the subject")
' Set the 'Manager' document property
workbook.getDocumentSummaryInformation().setManager("This is the manager")
' Set a custom document property
workbook.getDocumentSummaryInformation().setCustomProperty( _
"PropertyName", FileProperty.VT_NUMBER, "4")
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\Excel document properties.xlsx")
C++// Create an instance of the class that exports Excel files
EasyXLS::IExcelDocumentPtr workbook;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelDocument),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelDocument),
(void**) &workbook) ;
// Create the worksheet
workbook->easy_addWorksheet_2("Sheet1");
// Set the 'Subject' document property
workbook->getSummaryInformation()->setSubject("This is the subject");
// Set the 'Manager' document property
workbook->getDocumentSummaryInformation()->setManager("This is the manager");
// Set a custom document property
workbook->getDocumentSummaryInformation()->setCustomProperty(
"PropertyName", FILEPROPERTY_VT_NUMBER, "4");
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\Excel document properties.xlsx");
Click here to see Continuous Code ListingC++.NET// Create an instance of the class that exports Excel files
ExcelDocument ^workbook = gcnew ExcelDocument(1);
// Set the 'Subject' document property
workbook->getSummaryInformation()->setSubject("This is the subject");
// Set the 'Manager' document property
workbook->getDocumentSummaryInformation()->setManager("This is the manager");
// Set a custom document property
workbook->getDocumentSummaryInformation()->setCustomProperty(
"PropertyName", FileProperty::VT_NUMBER, "4");
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\Excel document properties.xlsx");
Click here to see Continuous Code Listing
// Create an instance of the class that exports Excel files
ExcelDocument workbook = new ExcelDocument(1);
// Set the 'Subject' document property
workbook.getSummaryInformation().setSubject("This is the subject");
// Set the 'Manager' document property
workbook.getDocumentSummaryInformation().setManager("This is the manager");
// Set a custom document property
workbook.getDocumentSummaryInformation().setCustomProperty(
"PropertyName", FileProperty.VT_NUMBER, "4");
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Excel document properties.xlsx");
.NET:// Create an instance of the class that exports Excel files
$workbook = new COM("EasyXLS.ExcelDocument");
// Create the worksheet
$workbook->easy_addWorksheet_2("Sheet1");
// Set the 'Subject' document property
$workbook->getSummaryInformation()->setSubject("This is the subject");
// Set the 'Manager' document property
$workbook->getDocumentSummaryInformation()->setManager("This is the manager");
// Set a custom document property
$workbook->getDocumentSummaryInformation()->setCustomProperty(
"PropertyName", $VT_NUMBER, "4");
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\Samples\Excel document properties.xlsx");
Click here to see Continuous Code ListingJava:// Create an instance of the class that exports Excel files
$workbook = new java("EasyXLS.ExcelDocument");
// Create a worksheet
$workbook->easy_addWorksheet("Sheet1");
// Set the 'Subject' document property
$workbook->getSummaryInformation()->setSubject("This is the subject");
// Set the 'Manager' document property
$workbook->getDocumentSummaryInformation()->setManager("This is the manager");
// Set a custom document property
$workbook->getDocumentSummaryInformation()->setCustomProperty("PropertyName",
$VT_NUMBER, "4");
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\Samples\Excel document properties.xlsx");
Click here to see Continuous Code Listing
' Create an instance of the class that exports Excel filesSet workbook = Server.CreateObject("EasyXLS.ExcelDocument")
' Create the worksheet
workbook.easy_addWorksheet_2("Sheet1")
' Set the 'Subject' document property
workbook.getSummaryInformation().setSubject("This is the subject")
' Set the 'Manager' document property
workbook.getDocumentSummaryInformation().setManager("This is the manager")
' Set a custom document property
workbook.getDocumentSummaryInformation().setCustomProperty _
"PropertyName", VT_NUMBER, "4"' Export Excel file
workbook.easy_WriteXLSXFile ("C:\Samples\Excel document properties.xlsx")
' Create an instance of the class that exports Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Create the worksheet
workbook.easy_addWorksheet_2("Sheet1")
' Set the 'Subject' document property
workbook.getSummaryInformation().setSubject("This is the subject")
' Set the 'Manager' document property
workbook.getDocumentSummaryInformation().setManager("This is the manager")
' Set a custom document property
workbook.getDocumentSummaryInformation().setCustomProperty _
"PropertyName", VT_NUMBER, "4"' Export Excel file
workbook.easy_WriteXLSXFile ("C:\Samples\Excel document properties.xlsx")
' Create an instance of the class that exports Excel filesset workbook = CreateObject("EasyXLS.ExcelDocument")
' Create the worksheet
workbook.easy_addWorksheet_2("Sheet1")
' Set the 'Subject' document property
workbook.getSummaryInformation().setSubject("This is the subject")
' Set the 'Manager' document property
workbook.getDocumentSummaryInformation().setManager("This is the manager")
' Set a custom document property
workbook.getDocumentSummaryInformation().setCustomProperty _
"PropertyName", VT_NUMBER, "4"' Export Excel file
workbook.easy_WriteXLSXFile ("C:\Samples\Excel document properties.xlsx")
<!-- Create an instance of the class that exports Excel files --><cfobject type="java"class="EasyXLS.ExcelDocument"name="workbook"action="CREATE"><!-- Create the worksheet --><cfset ret = workbook.easy_addWorksheet("Sheet1")><!-- Set the 'Subject' document property --><cfset workbook.getSummaryInformation().setSubject("This is the subject")><!-- Set the 'Manager' document property --><cfset workbook.getDocumentSummaryInformation().setManager("This is the manager")><!-- Set a custom document property --><cfset workbook.getDocumentSummaryInformation().setCustomProperty(
"PropertyName", FileProperty.VT_NUMBER, "4")><!-- Export Excel file --><cfset ret = workbook.easy_WriteXLSXFile("C:\Samples\Excel document properties.xlsx")>
.NET:# Create an instance of the class that exports Excel files
workbook = ExcelDocument(1)
# Set the 'Subject' document property
workbook.getSummaryInformation().setSubject("This is the subject")
# Set the 'Manager' document property
workbook.getDocumentSummaryInformation().setManager("This is the manager")
# Set a custom document property
workbook.getDocumentSummaryInformation().setCustomProperty("PropertyName", FileProperty.VT_NUMBER, "4")
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Excel document properties.xlsx")
Click here to see Continuous Code ListingJava:# Create an instance of the class that exports Excel files
workbook = gateway.jvm.ExcelDocument(1)
# Set the 'Subject' document property
workbook.getSummaryInformation().setSubject("This is the subject")
# Set the 'Manager' document property
workbook.getDocumentSummaryInformation().setManager("This is the manager")
# Set a custom document property
workbook.getDocumentSummaryInformation().setCustomProperty("PropertyName",
gateway.jvm.FileProperty.VT_NUMBER, "4")
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Excel document properties.xlsx")
Click here to see Continuous Code Listing
The screen shots provide an example of an Excel file that has some document properties.
// Create an instance of the class that imports Excel files
ExcelDocument workbook = new ExcelDocument();
// Import Excel file
workbook.easy_LoadXLSXFile("C:\\Samples\\Excel.xlsx");
// Get the 'Author' document propertyString author = workbook.getSummaryInformation().getAuthor();
Console.WriteLine("The 'Author' property is: " + author);
// Get the 'Company' document propertyString company = workbook.getDocumentSummaryInformation().getCompanyName();
Console.WriteLine("The 'Company' property is: " + company);
// Get a custom document propertyString customProperty =
workbook.getDocumentSummaryInformation().getCustomProperty("PropertyName");
Console.WriteLine("The custom property is: " + customProperty);
' Create an instance of the class that imports Excel filesDim workbook As New ExcelDocument()
' Import Excel file
workbook.easy_LoadXLSXFile("C:\\Samples\\Excel.xlsx")
' Get the 'Author' document propertyDim author = workbook.getSummaryInformation().getAuthor()
Console.WriteLine("The 'Author' property is: " + author)
' Get the 'Company' document propertyDim company = workbook.getDocumentSummaryInformation().getCompanyName()
Console.WriteLine("The 'Company' property is: " + company)
' Get a custom document propertyDim customProperty =
workbook.getDocumentSummaryInformation().getCustomProperty("PropertyName")
Console.WriteLine("The custom property is: " + customProperty)
C++// Create an instance of the class that imports Excel files
EasyXLS::IExcelDocumentPtr workbook;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelDocument),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelDocument),
(void**) &workbook) ;
// Import Excel file
workbook->easy_LoadXLSXFile("C:\\Samples\\Excel.xlsx");
// Get the 'Author' document property
_bstr_t author = workbook->getSummaryInformation()->getAuthor();
printf("\nThe 'Author' property is: " + author);
// Get the 'Company' document property
_bstr_t company = workbook->getDocumentSummaryInformation()->getCompanyName();
printf("\nThe 'Company' property is: " + company);
// Get a custom document property
_bstr_t customProperty =
workbook->getDocumentSummaryInformation()->getCustomProperty("PropertyName");
printf("\nThe custom property is: " + customProperty);
C++.NET// Create an instance of the class that imports Excel files
ExcelDocument ^workbook = gcnew ExcelDocument();
// Import Excel file
workbook->easy_LoadXLSXFile("C:\\Samples\\Excel.xlsx");
// Get the 'Author' document propertyString ^author = workbook->getSummaryInformation()->getAuthor();
Console::WriteLine("The 'Author' property is: " + author);
// Get the 'Company' document propertyString ^company = workbook->getDocumentSummaryInformation()->getCompanyName();
Console::WriteLine("The 'Company' property is: " + company);
// Get a custom document propertyString ^customProperty =
workbook->getDocumentSummaryInformation()->getCustomProperty("PropertyName");
Console::WriteLine("The custom property is: " + customProperty);
// Create an instance of the class that imports Excel files
ExcelDocument workbook = new ExcelDocument();
// Import Excel file
workbook.easy_LoadXLSXFile("C:\\Samples\\Excel.xlsx");
// Get the 'Author' document propertyString author = workbook.getSummaryInformation().getAuthor();
Console.WriteLine("The 'Author' property is: " + author);
// Get the 'Company' document propertyString company = workbook.getDocumentSummaryInformation().getCompanyName();
Console.WriteLine("The 'Company' property is: " + company);
// Get a custom document propertyString customProperty =
workbook.getDocumentSummaryInformation().getCustomProperty("PropertyName");
Console.WriteLine("The custom property is: " + customProperty);
.NET:// Create an instance of the class that imports Excel files
$workbook = new COM("EasyXLS.ExcelDocument");
// Import Excel file
$workbook->easy_LoadXLSXFile("C:\Samples\Excel.xlsx");
// Get the 'Author' document property
$author = $workbook->getSummaryInformation()->getAuthor();
echo"The 'Author' property is: " . $author;
// Get the 'Company' document property
$company = $workbook->getDocumentSummaryInformation()->getCompanyName();
echo"</br>The 'Company' property is: " . $company;
// Get a custom document property
$customProperty =
$workbook->getDocumentSummaryInformation()->getCustomProperty("PropertyName");
echo"</br>The custom property is: " . $customProperty;
Java:// Create an instance of the class that imports Excel files
$workbook = new java("EasyXLS.ExcelDocument");
// Import Excel file
$workbook->easy_LoadXLSXFile("C:\Samples\Excel.xlsx");
// Get the 'Author' document property
$author = $workbook->getSummaryInformation()->getAuthor();
echo"The 'Author' property is: " . $author;
// Get the 'Company' document property
$company = $workbook->getDocumentSummaryInformation()->getCompanyName();
echo"</br>The 'Company' property is: " . $company;
// Get a custom document property
$customProperty =
$workbook->getDocumentSummaryInformation()->getCustomProperty("PropertyName");
echo"</br>The custom property is: " . $customProperty;
' Create an instance of the class that imports Excel filesset workbook = Server.CreateObject("EasyXLS.ExcelDocument")
' Import Excel file
workbook.easy_LoadXLSXFile("C:\Samples\Excel.xlsx")
' Get the 'Author' document property
author = workbook.getSummaryInformation().getAuthor()
response.write("The 'Author' property is: " + author)
' Get the 'Company' document property
company = workbook.getDocumentSummaryInformation().getCompanyName()
response.write("<br>The 'Company' property is: " + company)
' Get a custom document property
customProperty = _
workbook.getDocumentSummaryInformation().getCustomProperty("PropertyName")
response.write("<br>The custom property is: " + customProperty)
' Create an instance of the class that imports Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import Excel file
workbook.easy_LoadXLSXFile ("C:\Samples\Excel.xlsx")
' Get the 'Author' document property
author = workbook.getSummaryInformation().getAuthor()
Me.Label1.Caption = Me.Label1.Caption & vbCrLf & "The 'Author' property is: " & author
' Get the 'Company' document property
company = workbook.getDocumentSummaryInformation().getCompanyName()
Me.Label1.Caption = Me.Label1.Caption & vbCrLf & "The 'Company' property is: " & company
' Get a custom document property
customProperty = _
workbook.getDocumentSummaryInformation().getCustomProperty("PropertyName")
Me.Label1.Caption = Me.Label1.Caption & vbCrLf & "The custom property is: " & customProperty
' Create an instance of the class that imports Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Import Excel file
workbook.easy_LoadXLSXFile("C:\\Samples\\Excel.xlsx")
' Get the 'Author' document property
author = workbook.getSummaryInformation().getAuthor()
WScript.StdOut.Write("The 'Author' property is: " + author)
' Get the 'Company' document property
company = workbook.getDocumentSummaryInformation().getCompanyName()
WScript.StdOut.Write(vbcrlf & "The 'Company' property is: " + company)
' Get a custom document property
customProperty = _
workbook.getDocumentSummaryInformation().getCustomProperty("PropertyName")
WScript.StdOut.Write(vbcrlf & "The custom property is: " + customProperty)
<!-- Create an instance of the class that imports Excel files --><cfobject type="java"class="EasyXLS.ExcelDocument"name="workbook"action="CREATE"><!-- Import Excel file --><cfset ret = workbook.easy_LoadXLSXFile("C:\\Samples\\Excel.xlsx")><!-- Get the 'Author' document property --><cfset author = workbook.getSummaryInformation().getAuthor()><cfoutput>
The 'Author' property is: #author#
</cfoutput><!-- Get the 'Company' document property --><cfset company = workbook.getDocumentSummaryInformation().getCompanyName()><cfoutput>
<br />The 'Company' property is: #company#
</cfoutput><!-- Get a custom document property --><cfset customProperty =
workbook.getDocumentSummaryInformation().getCustomProperty("PropertyName")><cfoutput>
<br />The custom property is: #customProperty#
</cfoutput>
.NET:# Create an instance of the class that imports Excel files
workbook = ExcelDocument()
# Import Excel file
workbook.easy_LoadXLSXFile("C:\\Samples\\Excel.xlsx")
# Get the 'Author' document property
author = workbook.getSummaryInformation().getAuthor()
print("The 'Author' property is: " + author)
# Get the 'Company' document property
company = workbook.getDocumentSummaryInformation().getCompanyName()
print("The 'Company' property is: " + company)
# Get a custom document property
customProperty = \
workbook.getDocumentSummaryInformation().getCustomProperty("PropertyName")
print("The custom property is: " + customProperty)
Java:# Create an instance of the class that imports Excel files
workbook = gateway.jvm.ExcelDocument()
# Import Excel file
workbook.easy_LoadXLSXFile("C:\\Samples\\Excel.xlsx")
# Get the 'Author' document property
author = workbook.getSummaryInformation().getAuthor()
print("The 'Author' property is: " + author)
# Get the 'Company' document property
company = workbook.getDocumentSummaryInformation().getCompanyName()
print("The 'Company' property is: " + company)
# Get a custom document property
customProperty = \
workbook.getDocumentSummaryInformation().getCustomProperty("PropertyName")
print("The custom property is: " + customProperty)