EasyXLS™ library enables you to apply number formats, date and time formats, accounting formats, text formats or custom formats for values inside the spreadsheet cells. The format can be set per cell, per row and per column.
For better performances, the best option is to apply the format to the style of the cell, row or column by using ExcelStyle class. But the formatting can also be applied directly to the cell, row or column.
// Create a style for the cell
ExcelStyle xlsStyle = new ExcelStyle();
xlsStyle.setFormat("$0.00");
// Apply the style to the cell
xlsCell.setStyle(xlsStyle);
' Create a style for the cellDim xlsStyle As ExcelStyle = New ExcelStyle()
xlsStyle.setFormat("$0.00")
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
C++// Create a style for the cell
EasyXLS::IExcelStylePtr xlsStyle;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelStyle),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelStyle),
(void**) &xlsStyle);
xlsStyle->setFormat("$0.00");
// Apply the style to the cell
xlsCell->setStyle(xlsStyle);
C++.NET// Create a style for the cell
ExcelStyle ^xlsStyle = gcnew ExcelStyle();
xlsStyle->setFormat("$0.00");
// Apply the style to the cell
xlsCell->setStyle(xlsStyle);
// Create a style for the cell
ExcelStyle xlsStyle = new ExcelStyle();
xlsStyle.setFormat("$0.00");
// Apply the style to the cell
xlsCell.setStyle(xlsStyle);
.NET:// Create a style for the cell
$xlsStyle = new COM("EasyXLS.ExcelStyle");
$xlsStyle->setFormat("$0.00");
// Apply the style to the cell
$xlsCell->setStyle($xlsStyle);
Java:// Create a style for the cell
$xlsStyle = new java("EasyXLS.ExcelStyle");
$xlsStyle->setFormat("$0.00");
// Apply the style to the cell
$xlsCell->setStyle($xlsStyle);
' Create a style for the cellset xlsStyle = Server.CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setFormat("$0.00")
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
' Create a style for the cellSet xlsStyle = CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setFormat("$0.00")
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
' Create a style for the cellset xlsStyle = CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setFormat("$0.00")
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
<!-- Create a style for the cell --><cfobject type="java"class="EasyXLS.ExcelStyle"name="xlsStyle"action="CREATE"><cfset xlsStyle.setFormat("$0.00")><!-- Apply the style to the cell --><cfset xlsCell.setStyle(xlsStyle)>
.NET:# Create a style for the cell
xlsStyle = ExcelStyle()
xlsStyle.setFormat("$0.00")
# Apply the style to the cell
xlsCell.setStyle(xlsStyle)
Java:# Create a style for the cell
xlsStyle = gateway.jvm.ExcelStyle()
xlsStyle.setFormat("$0.00")
# Apply the style to the cell
xlsCell.setStyle(xlsStyle)
The number format includes 1000 separator, decimal separator, decimal places and the aspect for negative numbers. The 1000 separator must be always set as "," and decimal separator as ".". The regional settings from the machine are used when the Excel file is opened, and the separators set in Control Panel define the displayed separators on screen.
The below source code sample shows how to set number format for integer numbers, decimal numbers and negative numbers.
// Apply integer format
ExcelStyle xlsStyleInteger = new ExcelStyle();
xlsStyleInteger.setFormat(Format.FORMAT_INTEGER);
xlsCell.setStyle(xlsStyleInteger);
// Apply decimal format
ExcelStyle xlsStyleDecimals = new ExcelStyle();
xlsStyleDecimals.setFormat(Format.FORMAT_FLOAT_2DECIMALS);
xlsCell.setStyle(xlsStyleDecimals);
// Format with red color for negative numbers
ExcelStyle xlsStyleNegative = new ExcelStyle();
xlsStyleNegative.setFormat("0.00_);[Red](0.00)");
xlsCell.setStyle(xlsStyleNegative);
' Apply integer formatDim xlsStyleInteger As ExcelStyle = New ExcelStyle()
xlsStyleInteger.setFormat(Format.FORMAT_INTEGER)
xlsCell.setStyle(xlsStyleInteger)
' Apply decimal formatDim xlsStyleDecimals As ExcelStyle = New ExcelStyle()
xlsStyleDecimals.setFormat(Format.FORMAT_FLOAT_2DECIMALS)
xlsCell.setStyle(xlsStyleDecimals)
' Format with red color for negative numbersDim xlsStyleNegative As ExcelStyle = New ExcelStyle()
xlsStyleNegative.setFormat("0.00_);[Red](0.00)")
xlsCell.setStyle(xlsStyleNegative)
C++// Apply integer format
EasyXLS::IExcelStylePtr xlsStyleInteger;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelStyle),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelStyle),
(void**)&xlsStyleInteger);
xlsStyleInteger->setFormat(FORMAT_FORMAT_INTEGER);
xlsCell->setStyle(xlsStyleInteger);
// Apply decimal format
EasyXLS::IExcelStylePtr xlsStyleDecimals;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelStyle),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelStyle),
(void**)&xlsStyleDecimals);
xlsStyleDecimals->setFormat(FORMAT_FORMAT_FLOAT_2DECIMALS);
xlsCell->setStyle(xlsStyleDecimals);
// Format with red color for negative numbers
EasyXLS::IExcelStylePtr xlsStyleNegative;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelStyle),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelStyle),
(void**)&xlsStyleNegative);
xlsStyleNegative->setFormat("0.00_);[Red](0.00)");
xlsCell->setStyle(xlsStyleNegative);
C++.NET// Apply integer format
ExcelStyle ^xlsStyleInteger = gcnew ExcelStyle();
xlsStyleInteger->setFormat(Format::FORMAT_INTEGER);
xlsCell->setStyle(xlsStyleInteger);
// Apply decimal format
ExcelStyle ^xlsStyleDecimals = gcnew ExcelStyle();
xlsStyleDecimals->setFormat(Format::FORMAT_FLOAT_2DECIMALS);
xlsCell->setStyle(xlsStyleDecimals);
// Format with red color for negative numbers
ExcelStyle ^xlsStyleNegative = gcnew ExcelStyle();
xlsStyleNegative->setFormat("0.00_);[Red](0.00)");
xlsCell->setStyle(xlsStyleNegative);
// Apply integer format
ExcelStyle xlsStyleInteger = new ExcelStyle();
xlsStyleInteger.setFormat(Format.FORMAT_INTEGER);
xlsCell.setStyle(xlsStyleInteger);
// Apply decimal format
ExcelStyle xlsStyleDecimals = new ExcelStyle();
xlsStyleDecimals.setFormat(Format.FORMAT_FLOAT_2DECIMALS);
xlsCell.setStyle(xlsStyleDecimals);
// Format with red color for negative numbers
ExcelStyle xlsStyleNegative = new ExcelStyle();
xlsStyleNegative.setFormat("0.00_);[Red](0.00)");
xlsCell.setStyle(xlsStyleNegative);
.NET:// Apply integer format
$xlsStyleInteger = new COM("EasyXLS.ExcelStyle");
$xlsStyleInteger->setFormat($FORMAT_FORMAT_INTEGER);
$xlsCell->setStyle($xlsStyleInteger);
// Apply decimal format
$xlsStyleDecimals = new COM("EasyXLS.ExcelStyle");
$xlsStyleDecimals->setFormat($FORMAT_FORMAT_FLOAT_2DECIMALS);
$xlsCell->setStyle($xlsStyleDecimals);
// Format with red color for negative numbers
$xlsStyleNegative = new COM("EasyXLS.ExcelStyle");
$xlsStyleNegative->setFormat("0.00_);[Red](0.00)");
$xlsCell->setStyle($xlsStyleNegative);
Java:// Apply integer format
$xlsStyleInteger = new java("EasyXLS.ExcelStyle");
$xlsStyleInteger->setFormat($FORMAT_FORMAT_INTEGER);
$xlsCell->setStyle($xlsStyleInteger);
// Apply decimal format
$xlsStyleDecimals = new java("EasyXLS.ExcelStyle");
$xlsStyleDecimals->setFormat($FORMAT_FORMAT_FLOAT_2DECIMALS);
$xlsCell->setStyle($xlsStyleDecimals);
// Format with red color for negative numbers
$xlsStyleNegative = new java("EasyXLS.ExcelStyle");
$xlsStyleNegative->setFormat("0.00_);[Red](0.00)");
$xlsCell->setStyle($xlsStyleNegative);
' Apply integer formatset xlsStyleInteger = Server.CreateObject("EasyXLS.ExcelStyle")
xlsStyleInteger.setFormat(FORMAT_FORMAT_INTEGER)
xlsCell.setStyle(xlsStyleInteger)
' Apply decimal formatset xlsStyleDecimals = Server.CreateObject("EasyXLS.ExcelStyle")
xlsStyleDecimals.setFormat(FORMAT_FORMAT_FLOAT_2DECIMALS)
xlsCell.setStyle(xlsStyleDecimals)
' Format with red color for negative numbersset xlsStyleNegative = Server.CreateObject("EasyXLS.ExcelStyle")
xlsStyleNegative.setFormat("0.00_);[Red](0.00)")
xlsCell.setStyle(xlsStyleNegative)
' Apply integer formatSet xlsStyleInteger = CreateObject("EasyXLS.ExcelStyle")
xlsStyleInteger.setFormat(FORMAT_FORMAT_INTEGER)
xlsCell.setStyle(xlsStyleInteger)
' Apply decimal formatSet xlsStyleDecimals = CreateObject("EasyXLS.ExcelStyle")
xlsStyleDecimals.setFormat(FORMAT_FORMAT_FLOAT_2DECIMALS)
xlsCell.setStyle(xlsStyleDecimals)
' Format with red color for negative numbersSet xlsStyleNegative = CreateObject("EasyXLS.ExcelStyle")
xlsStyleNegative.setFormat("0.00_);[Red](0.00)")
xlsCell.setStyle(xlsStyleNegative)
' Apply integer formatset xlsStyleInteger = CreateObject("EasyXLS.ExcelStyle")
xlsStyleInteger.setFormat(FORMAT_FORMAT_INTEGER)
xlsCell.setStyle(xlsStyleInteger)
' Apply decimal formatset xlsStyleDecimals = CreateObject("EasyXLS.ExcelStyle")
xlsStyleDecimals.setFormat(FORMAT_FORMAT_FLOAT_2DECIMALS)
xlsCell.setStyle(xlsStyleDecimals)
' Format with red color for negative numbersset xlsStyleNegative = CreateObject("EasyXLS.ExcelStyle")
xlsStyleNegative.setFormat("0.00_);[Red](0.00)")
xlsCell.setStyle(xlsStyleNegative)
<!-- Apply integer format --><cfobject type="java"class="EasyXLS.ExcelStyle"name="xlsStyleInteger"action="CREATE"><cfset xlsStyleInteger.setFormat(Format.FORMAT_INTEGER)><cfset xlsCell.setStyle(xlsStyleInteger)><!-- Apply decimal format --><cfobject type="java"class="EasyXLS.ExcelStyle"name="xlsStyleDecimals"action="CREATE"><cfset xlsStyleDecimals.setFormat(Format.FORMAT_FLOAT_2DECIMALS)><cfset xlsCell.setStyle(xlsStyleDecimals)><!-- Format with red color for negative numbers --><cfobject type="java"class="EasyXLS.ExcelStyle"name="xlsStyleNegative"action="CREATE"><cfset xlsStyleNegative.setFormat("0.00_);[Red](0.00)")><cfset xlsCell.setStyle(xlsStyleNegative)>
.NET:# Apply integer format
xlsStyleInteger = ExcelStyle()
xlsStyleInteger.setFormat(Format.FORMAT_INTEGER)
xlsCell.setStyle(xlsStyleInteger)
# Apply decimal format
xlsStyleDecimals = ExcelStyle()
xlsStyleDecimals.setFormat(Format.FORMAT_FLOAT_2DECIMALS)
xlsCell.setStyle(xlsStyleDecimals)
# Format with red color for negative numbers
xlsStyleNegative = ExcelStyle()
xlsStyleNegative.setFormat("0.00_);[Red](0.00)")
xlsCell.setStyle(xlsStyleNegative)
Java:# Apply integer format
xlsStyleInteger = gateway.jvm.ExcelStyle()
xlsStyleInteger.setFormat(gateway.jvm.Format.FORMAT_INTEGER)
xlsCell.setStyle(xlsStyleInteger)
# Apply decimal format
xlsStyleDecimals = gateway.jvm.ExcelStyle()
xlsStyleDecimals.setFormat(gateway.jvm.Format.FORMAT_FLOAT_2DECIMALS)
xlsCell.setStyle(xlsStyleDecimals)
# Format with red color for negative numbers
xlsStyleNegative = gateway.jvm.ExcelStyle()
xlsStyleNegative.setFormat("0.00_);[Red](0.00)")
xlsCell.setStyle(xlsStyleNegative)
Currency format
The currency format includes 1000 separator, decimal separator, decimal places, currency symbol and the aspect for negative numbers. The 1000 separator must be always set as "," and decimal separator as ".". The regional settings from the machine are used when the Excel file is opened, and the separators set in Control Panel define the displayed separators on screen.
The below source code sample shows how to set the default currency format and a currency format for negative numbers.
// Apply currency format
ExcelStyle xlsStyleCurrency = new ExcelStyle();
xlsStyleCurrency.setFormat(Format.FORMAT_CURRENCY);
xlsCell.setStyle(xlsStyleCurrency);
// Format with red color for negative numbers
ExcelStyle xlsStyleNegative = new ExcelStyle();
xlsStyleNegative.setFormat("$#,##0.00_);[Red]($#,##0.00)");
xlsCell.setStyle(xlsStyleNegative);
' Apply currency formatDim xlsStyleCurrency As ExcelStyle = New ExcelStyle()
xlsStyleCurrency.setFormat(Format.FORMAT_CURRENCY)
xlsCell.setStyle(xlsStyleCurrency)
' Format with red color for negative numbersDim xlsStyleNegative As ExcelStyle = New ExcelStyle()
xlsStyleNegative.setFormat("$#,##0.00_);[Red]($#,##0.00)")
xlsCell.setStyle(xlsStyleNegative)
C++// Apply currency format
EasyXLS::IExcelStylePtr xlsStyleCurrency;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelStyle),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelStyle),
(void**)&xlsStyleCurrency);
xlsStyleCurrency->setFormat(FORMAT_FORMAT_CURRENCY);
xlsCell->setStyle(xlsStyleCurrency);
// Format with red color for negative numbers
EasyXLS::IExcelStylePtr xlsStyleNegative;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelStyle),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelStyle),
(void**)&xlsStyleNegative);
xlsStyleNegative->setFormat("$#,##0.00_);[Red]($#,##0.00)");
xlsCell->setStyle(xlsStyleNegative);
C++.NET// Apply currency format
ExcelStyle ^xlsStyleCurrency = gcnew ExcelStyle();
xlsStyleCurrency->setFormat(Format::FORMAT_CURRENCY);
xlsCell->setStyle(xlsStyleCurrency);
// Format with red color for negative numbers
ExcelStyle ^xlsStyleNegative = gcnew ExcelStyle();
xlsStyleNegative->setFormat("$#,##0.00_);[Red]($#,##0.00)");
xlsCell->setStyle(xlsStyleNegative);
// Apply currency format
ExcelStyle xlsStyleCurrency = new ExcelStyle();
xlsStyleCurrency.setFormat(Format.FORMAT_CURRENCY);
xlsCell.setStyle(xlsStyleCurrency);
// Format with red color for negative numbers
ExcelStyle xlsStyleNegative = new ExcelStyle();
xlsStyleNegative.setFormat("$#,##0.00_);[Red]($#,##0.00)");
xlsCell.setStyle(xlsStyleNegative);
.NET:// Apply currency format
$xlsStyleCurrency = new COM("EasyXLS.ExcelStyle");
$xlsStyleCurrency->setFormat($FORMAT_FORMAT_CURRENCY);
$xlsCell->setStyle($xlsStyleCurrency);
// Format with red color for negative numbers
$xlsStyleNegative = new COM("EasyXLS.ExcelStyle");
$xlsStyleNegative->setFormat("$#,##0.00_);[Red]($#,##0.00)");
$xlsCell->setStyle($xlsStyleNegative);
Java:// Apply currency format
$xlsStyleCurrency = new java("EasyXLS.ExcelStyle");
$xlsStyleCurrency->setFormat($FORMAT_FORMAT_CURRENCY);
$xlsCell->setStyle($xlsStyleCurrency);
// Format with red color for negative numbers
$xlsStyleNegative = new java("EasyXLS.ExcelStyle");
$xlsStyleNegative->setFormat("$#,##0.00_);[Red]($#,##0.00)");
$xlsCell->setStyle($xlsStyleNegative);
' Apply currency formatset xlsStyleCurrency = Server.CreateObject("EasyXLS.ExcelStyle")
xlsStyleCurrency.setFormat(FORMAT_FORMAT_CURRENCY)
xlsCell.setStyle(xlsStyleCurrency)
' Format with red color for negative numbersset xlsStyleNegative = Server.CreateObject("EasyXLS.ExcelStyle")
xlsStyleNegative.setFormat("$#,##0.00_);[Red]($#,##0.00)")
xlsCell.setStyle(xlsStyleNegative)
' Apply currency formatSet xlsStyleCurrency = CreateObject("EasyXLS.ExcelStyle")
xlsStyleCurrency.setFormat(FORMAT_FORMAT_CURRENCY)
xlsCell.setStyle(xlsStyleCurrency)
' Format with red color for negative numbersSet xlsStyleNegative = CreateObject("EasyXLS.ExcelStyle")
xlsStyleNegative.setFormat("$#,##0.00_);[Red]($#,##0.00)")
xlsCell.setStyle(xlsStyleNegative)
' Apply currency formatset xlsStyleCurrency = CreateObject("EasyXLS.ExcelStyle")
xlsStyleCurrency.setFormat(FORMAT_FORMAT_CURRENCY)
xlsCell.setStyle(xlsStyleCurrency)
' Format with red color for negative numbersset xlsStyleNegative = CreateObject("EasyXLS.ExcelStyle")
xlsStyleNegative.setFormat("$#,##0.00_);[Red]($#,##0.00)")
xlsCell.setStyle(xlsStyleNegative)
<!-- Apply currency format --><cfobject type="java"class="EasyXLS.ExcelStyle"name="xlsStyleCurrency"action="CREATE"><cfset xlsStyleCurrency.setFormat(Format.FORMAT_CURRENCY)><cfset xlsCell.setStyle(xlsStyleCurrency)><!-- Format with red color for negative numbers --><cfobject type="java"class="EasyXLS.ExcelStyle"name="xlsStyleNegative"action="CREATE"><cfset xlsStyleNegative.setFormat("$##,####0.00_);[Red]($##,####0.00)")><cfset xlsCell.setStyle(xlsStyleNegative)>
.NET:# Apply currency format
xlsStyleCurrency = ExcelStyle()
xlsStyleCurrency.setFormat(Format.FORMAT_CURRENCY)
xlsCell.setStyle(xlsStyleCurrency)
# Format with red color for negative numbers
xlsStyleNegative = ExcelStyle()
xlsStyleNegative.setFormat("$#,##0.00_);[Red]($#,##0.00)")
xlsCell.setStyle(xlsStyleNegative)
Java:# Apply currency format
xlsStyleCurrency = gateway.jvm.ExcelStyle()
xlsStyleCurrency.setFormat(gateway.jvm.Format.FORMAT_CURRENCY)
xlsCell.setStyle(xlsStyleCurrency)
# Format with red color for negative numbers
xlsStyleNegative = gateway.jvm.ExcelStyle()
xlsStyleNegative.setFormat("$#,##0.00_);[Red]($#,##0.00)")
xlsCell.setStyle(xlsStyleNegative)
Accounting format
The accounting format includes 1000 separator, decimal separator, decimal places, currency symbol and the aspect for negative numbers. The 1000 separator must be always set as "," and decimal separator as ".". The regional settings from the machine are used when the Excel file is opened, and the separators set in Control Panel define the displayed separators on screen.
The below source code sample shows how to set the default accounting format.
// Apply date format
ExcelStyle xlsStyleDate = new ExcelStyle();
xlsStyleDate.setFormat(Format.FORMAT_DATE);
xlsCell1.setStyle(xlsStyleDate);
// Apply date format with regional settings
ExcelStyle xlsStyleDateRegional = new ExcelStyle();
xlsStyleDateRegional.setFormat(Format.FORMAT_DATE_REGIONAL_SETTINGS);
xlsCell2.setStyle(xlsStyleDateRegional);
' Apply date formatDim xlsStyleDate As ExcelStyle = New ExcelStyle()
xlsStyleDate.setFormat(Format.FORMAT_DATE)
xlsCell1.setStyle(xlsStyleDate)
' Apply date format with regional settingsDim xlsStyleDateRegional As ExcelStyle = New ExcelStyle()
xlsStyleDateRegional.setFormat(Format.FORMAT_DATE_REGIONAL_SETTINGS)
xlsCell2.setStyle(xlsStyleDateRegional)
C++// Apply date format
EasyXLS::IExcelStylePtr xlsStyleDate;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelStyle),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelStyle),
(void**)&xlsStyleDate);
xlsStyleDate->setFormat(FORMAT_FORMAT_DATE);
xlsCell1->setStyle(xlsStyleDate);
// Apply date format with regional settings
EasyXLS::IExcelStylePtr xlsStyleDateRegional;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelStyle),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelStyle),
(void**)&xlsStyleDateRegional);
xlsStyleDateRegional->setFormat(FORMAT_FORMAT_DATE_REGIONAL_SETTINGS);
xlsCell2->setStyle(xlsStyleDateRegional);
C++.NET// Apply date format
ExcelStyle ^xlsStyleDate = gcnew ExcelStyle();
xlsStyleDate->setFormat(Format::FORMAT_DATE);
xlsCell1->setStyle(xlsStyleDate);
// Apply date format with regional settings
ExcelStyle ^xlsStyleDateRegional = gcnew ExcelStyle();
xlsStyleDateRegional->setFormat(FORMAT_DATE_REGIONAL_SETTINGS);
xlsCell2->setStyle(xlsStyleDateRegional);
// Apply date format
ExcelStyle xlsStyleDate = new ExcelStyle();
xlsStyleDate.setFormat(Format.FORMAT_DATE);
xlsCell1.setStyle(xlsStyleDate);
// Apply date format with regional settings
ExcelStyle xlsStyleDateRegional = new ExcelStyle();
xlsStyleDateRegional.setFormat(Format.FORMAT_DATE_REGIONAL_SETTINGS);
xlsCell2.setStyle(xlsStyleDateRegional);
.NET:// Apply date format
$xlsStyleDate = new COM("EasyXLS.ExcelStyle");
$xlsStyleDate->setFormat($FORMAT_FORMAT_DATE);
$xlsCell1->setStyle($xlsStyleDate);
// Apply date format with regional settings
$xlsStyleDateRegional = new COM("EasyXLS.ExcelStyle");
$xlsStyleDateRegional->setFormat($FORMAT_FORMAT_DATE_REGIONAL_SETTINGS);
$xlsCell2->setStyle($xlsStyleDateRegional);
Java:// Apply date format
$xlsStyleDate = new java("EasyXLS.ExcelStyle");
$xlsStyleDate->setFormat($FORMAT_FORMAT_DATE);
$xlsCell1->setStyle($xlsStyleDate);
// Apply date format with regional settings
$xlsStyleDateRegional = new java("EasyXLS.ExcelStyle");
$xlsStyleDateRegional->setFormat($FORMAT_FORMAT_DATE_REGIONAL_SETTINGS);
$xlsCell2->setStyle($xlsStyleDateRegional);
' Apply date formatset xlsStyleDate = Server.CreateObject("EasyXLS.ExcelStyle")
xlsStyleDate.setFormat(FORMAT_FORMAT_DATE)
xlsCell1.setStyle(xlsStyleDate)
' Apply date format with regional settingsset xlsStyleDateRegional = Server.CreateObject("EasyXLS.ExcelStyle")
xlsStyleDateRegional.setFormat(FORMAT_FORMAT_DATE_REGIONAL_SETTINGS)
xlsCell2.setStyle(xlsStyleDateRegional)
' Apply date formatSet xlsStyleDate = CreateObject("EasyXLS.ExcelStyle")
xlsStyleDate.setFormat(FORMAT_FORMAT_DATE)
xlsCell1.setStyle(xlsStyleDate)
' Apply date format with regional settingsSet xlsStyleDateRegional = CreateObject("EasyXLS.ExcelStyle")
xlsStyleDateRegional.setFormat(FORMAT_FORMAT_DATE_REGIONAL_SETTINGS)
xlsCell2.setStyle(xlsStyleDateRegional)
' Apply date formatset xlsStyleDate = CreateObject("EasyXLS.ExcelStyle")
xlsStyleDate.setFormat(FORMAT_FORMAT_DATE)
xlsCell1.setStyle(xlsStyleDate)
' Apply date format with regional settingsset xlsStyleDateRegional = CreateObject("EasyXLS.ExcelStyle")
xlsStyleDateRegional.setFormat(FORMAT_FORMAT_DATE_REGIONAL_SETTINGS)
xlsCell2.setStyle(xlsStyleDateRegional)
<!-- Apply date format --><cfobject type="java"class="EasyXLS.ExcelStyle"name="xlsStyleDate"action="CREATE"><cfset xlsStyleDate.setFormat(Format.FORMAT_DATE)><cfset xlsCell1.setStyle(xlsStyleDate)><!-- Apply date format with regional settings --><cfobject type="java"class="EasyXLS.ExcelStyle"name="xlsStyleDateRegional"action="CREATE"><cfset xlsStyleDateRegional.setFormat(Format.FORMAT_DATE_REGIONAL_SETTINGS)><cfset xlsCell2.setStyle(xlsStyleDateRegional)>
.NET:# Apply date format
xlsStyleDate = ExcelStyle()
xlsStyleDate.setFormat(Format.FORMAT_DATE)
xlsCell1.setStyle(xlsStyleDate)
# Apply date format with regional settings
xlsStyleDateRegional = ExcelStyle()
xlsStyleDateRegional.setFormat(Format.FORMAT_DATE_REGIONAL_SETTINGS)
xlsCell2.setStyle(xlsStyleDateRegional)
Java:# Apply date format
xlsStyleDate = gateway.jvm.ExcelStyle()
xlsStyleDate.setFormat(gateway.jvm.Format.FORMAT_DATE)
xlsCell1.setStyle(xlsStyleDate)
# Apply date format with regional settings
xlsStyleDateRegional = gateway.jvm.ExcelStyle()
xlsStyleDateRegional.setFormat(gateway.jvm.Format.FORMAT_DATE_REGIONAL_SETTINGS)
xlsCell2.setStyle(xlsStyleDateRegional)
Available for: Professional, Excel Writer, Excel Reader