EasyXLS™ library allows you to set or to read Excel sheet properties like: sheet name, sheet tab color, sheet zoom, hidden sheet, protected sheet or selected sheet.
// Create an instance of the class that exports Excel files, having two sheets
ExcelDocument workbook = new ExcelDocument(2);
// Set the sheet names
workbook.easy_getSheetAt(0).setSheetName("First tab");
workbook.easy_getSheetAt(1).setSheetName("Second tab");
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Excel sheet name.xlsx");
' Create an instance of the class that exports Excel files, having two sheetsDim workbook As New ExcelDocument(2)
' Set the sheet names
workbook.easy_getSheetAt(0).setSheetName("First tab")
workbook.easy_getSheetAt(1).setSheetName("Second tab")
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\Excel sheet name.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 two sheets
workbook->easy_addWorksheet_2("First tab");
workbook->easy_addWorksheet_2("Second tab");
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\Excel sheet name.xlsx");
Click here to see Continuous Code ListingC++.NET// Create an instance of the class that exports Excel files, having two sheets
ExcelDocument ^workbook = gcnew ExcelDocument(2);
// Set the sheet names
workbook->easy_getSheetAt(0)->setSheetName("First tab");
workbook->easy_getSheetAt(1)->setSheetName("Second tab");
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\Excel sheet name.xlsx");
Click here to see Continuous Code Listing
// Create an instance of the class that exports Excel files, having two sheets
ExcelDocument workbook = new ExcelDocument(2);
// Set the sheet names
workbook.easy_getSheetAt(0).setSheetName("First tab");
workbook.easy_getSheetAt(1).setSheetName("Second tab");
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Excel sheet name.xlsx");
.NET:// Create an instance of the class that exports Excel files
$workbook = new COM("EasyXLS.ExcelDocument");
// Create two sheets
$workbook->easy_addWorksheet_2("First tab");
$workbook->easy_addWorksheet_2("Second tab");
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\Samples\Excel sheet name.xlsx");
Click here to see Continuous Code ListingJava:// Create an instance of the class that creates Excel files
$workbook = new java("EasyXLS.ExcelDocument");
// Create two sheets
$workbook->easy_addWorksheet("First tab");
$workbook->easy_addWorksheet("Second tab");
// Create Excel file
$workbook->easy_WriteXLSXFile("C:\Samples\Excel sheet name.xlsx");
Click here to see Continuous Code Listing
' Create an instance of the class that exports Excel filesset workbook = Server.CreateObject("EasyXLS.ExcelDocument")
' Create two sheets
workbook.easy_addWorksheet_2("First tab")
workbook.easy_addWorksheet_2("Second tab")
' Export Excel file
workbook.easy_WriteXLSXFile ("C:\Samples\Excel sheet name.xlsx")
' Create an instance of the class that exports Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Create two sheets
workbook.easy_addWorksheet_2("First tab")
workbook.easy_addWorksheet_2("Second tab")
' Export Excel file
workbook.easy_WriteXLSXFile ("C:\Samples\Excel sheet name.xlsx")
<!-- Create an instance of the class that exports Excel files --><cfobject type="java"class="EasyXLS.ExcelDocument"name="workbook"action="CREATE"><!-- Create two sheets --><cfset ret = workbook.easy_addWorksheet("First tab")><cfset ret = workbook.easy_addWorksheet("Second tab")><!-- Export Excel file --><cfset ret = workbook.easy_WriteXLSXFile("C:\Samples\Excel sheet name.xlsx")>
.NET:# Create an instance of the class that creates Excel files, having two sheets
workbook = ExcelDocument(2)
# Set the sheet names
workbook.easy_getSheetAt(0).setSheetName("First tab")
workbook.easy_getSheetAt(1).setSheetName("Second tab")
# Create the Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Excel sheet name.xlsx")
Click here to see Continuous Code ListingJava:# Create an instance of the class that creates Excel files, having two sheets
workbook = gateway.jvm.ExcelDocument(2)
# Set the sheet names
workbook.easy_getSheetAt(0).setSheetName("First tab")
workbook.easy_getSheetAt(1).setSheetName("Second tab")
# Create the Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Excel sheet name.xlsx")
Click here to see Continuous Code Listing
The screen shots provide an example of an exported Excel file that has two sheets ("First Tab" and" Second Tab").
Sheet name
EasyXLS provides methods for handling the sheet names of an Excel file. The sheet name cannot be blank and cannot exceed 31 characters.
The component also allows you to read Excel sheet names. The Excel file must be imported first and after that the names of the sheets are available through ExcelSheet.getSheetName method.
EasyXLS library allows you to hide an Excel sheet using ExcelSheet.setHidden method.
Protected sheet
EasyXLS library allows you to protect an Excel sheet in order to prevent unintended editing using ExcelSheet.setSheetProtected method. Also, an optional password can be set if the sheet is protected using ExcelSheet.setProtectionPassword method.
EasyXLS allows you to set a tab color for the Excel sheet using ExcelSheet.setTabColor method.
Select sheet
EasyXLS allows you to set the selected sheet for an Excel file using ExcelSheet.setSheetSelected. There can be more than one selected sheet, but only one sheet can be the current active sheet. The current active sheet can be set using ExcelDocument.setCurrentSheet method.
Sheet zoom
EasyXLS allows you to zoom in or out in an Excel sheet using ExcelSheet.setZoom method.