EasyXLS™ library enables you to apply fonts for Excel cells, rows and columns. Font name and size, font color, style, underline and effects can be set for the Excel spreadsheet.
For better performances, the best option is to apply the font setting 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.setFont("Verdana");
// Apply the style to the cell
xlsCell.setStyle(xlsStyle);
' Create a style for the cellDim xlsStyle As New ExcelStyle()
xlsStyle.setFont("Verdana")
' 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->setFont("Verdana");
// Apply the style to the cell
xlsCell->setStyle(xlsStyle);
C++.NET// Create a style for the cell
ExcelStyle ^xlsStyle = gcnew ExcelStyle();
xlsStyle->setFont("Verdana");
// Apply the style to the cell
xlsCell->setStyle(xlsStyle);
// Create a style for the cell
ExcelStyle xlsStyle = new ExcelStyle();
xlsStyle.setFont("Verdana");
// Apply the style to the cell
xlsCell.setStyle(xlsStyle);
.NET:// Create a style for the cell
$xlsStyle = new COM("EasyXLS.ExcelStyle");
$xlsStyle->setFont("Verdana");
// Apply the style to the cell
$xlsCell->setStyle($xlsStyle);
Java:// Create a style for the cell
$xlsStyle = new java("EasyXLS.ExcelStyle");
$xlsStyle->setFont("Verdana");
// Apply the style to the cell
$xlsCell->setStyle($xlsStyle);
' Create a style for the cellset xlsStyle = Server.CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setFont("Verdana")
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
' Create a style for the cellSet xlsStyle = CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setFont("Verdana")
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
' Create a style for the cellset xlsStyle = CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setFont("Verdana")
' 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 ret = xlsStyle.setFont("Verdana")><!-- Apply the style to the cell --><cfset ret = xlsCell.setStyle(xlsStyle)>
.NET:# Create a style for the cell
xlsStyle = ExcelStyle()
xlsStyle.setFont("Verdana")
# Apply the style to the cell
xlsCell.setStyle(xlsStyle)
Java:# Create a style for the cell
xlsStyle = gateway.jvm.ExcelStyle()
xlsStyle.setFont("Verdana")
# Apply the style to the cell
xlsCell.setStyle(xlsStyle)
// Create a style for the cell
ExcelStyle xlsStyle = new ExcelStyle();
xlsStyle.setFontSize(10);
// Apply the style to the cell
xlsCell.setStyle(xlsStyle);
' Create a style for the cellDim xlsStyle As New ExcelStyle()
xlsStyle.setFontSize(10)
' 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->setFontSize(10);
// Apply the style to the cell
xlsCell->setStyle(xlsStyle);
C++.NET// Create a style for the cell
ExcelStyle ^xlsStyle = gcnew ExcelStyle();
xlsStyle->setFontSize(10);
// Apply the style to the cell
xlsCell->setStyle(xlsStyle);
// Create a style for the cell
ExcelStyle xlsStyle = new ExcelStyle();
xlsStyle.setFontSize(10);
// Apply the style to the cell
xlsCell.setStyle(xlsStyle);
.NET:// Create a style for the cell
$xlsStyle = new COM("EasyXLS.ExcelStyle");
$xlsStyle->setFontSize(10);
// Apply the style to the cell
$xlsCell->setStyle($xlsStyle);
Java:// Create a style for the cell
$xlsStyle = new java("EasyXLS.ExcelStyle");
$xlsStyle->setFontSize(10);
// Apply the style to the cell
$xlsCell->setStyle($xlsStyle);
' Create a style for the cellset xlsStyle = Server.CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setFontSize(10)
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
' Create a style for the cellSet xlsStyle = CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setFontSize(10)
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
' Create a style for the cellset xlsStyle = CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setFontSize(10)
' 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 ret = xlsStyle.setFontSize(10)><!-- Apply the style to the cell --><cfset ret = xlsCell.setStyle(xlsStyle)>
.NET:# Create a style for the cell
xlsStyle = ExcelStyle()
xlsStyle.setFontSize(10)
# Apply the style to the cell
xlsCell.setStyle(xlsStyle)
Java:# Create a style for the cell
xlsStyle = gateway.jvm.ExcelStyle()
xlsStyle.setFontSize(10)
# Apply the style to the cell
xlsCell.setStyle(xlsStyle)
// Create a style for the cell
ExcelStyle xlsStyle = new ExcelStyle();
xlsStyle.setForeground(Color.Red);
// Apply the style to the cell
xlsCell.setStyle(xlsStyle);
' Create a style for the cellDim xlsStyle As New ExcelStyle()
xlsStyle.setForeground(Color.Red)
' 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->setForeground(COLOR_RED);
// Apply the style to the cell
xlsCell->setStyle(xlsStyle);
C++.NET// Create a style for the cell
ExcelStyle ^xlsStyle = gcnew ExcelStyle();
xlsStyle->setForeground(Color::Red);
// Apply the style to the cell
xlsCell->setStyle(xlsStyle);
// Create a style for the cell
ExcelStyle xlsStyle = new ExcelStyle();
xlsStyle.setForeground(Color.RED);
// Apply the style to the cell
xlsCell.setStyle(xlsStyle);
.NET:// Create a style for the cell
$xlsStyle = new COM("EasyXLS.ExcelStyle");
$xlsStyle->setForeground((int)$COLOR_RED);
// Apply the style to the cell
$xlsCell->setStyle($xlsStyle);
Java:// Create a style for the cell
$xlsStyle = new java("EasyXLS.ExcelStyle");
$xlsStyle->setForeground(java("java.awt.Color")->RED);
// Apply the style to the cell
$xlsCell->setStyle($xlsStyle);
' Create a style for the cellset xlsStyle = Server.CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setForeground(CLng(COLOR_RED))
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
' Create a style for the cellSet xlsStyle = CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setForeground(CLng(Color.COLOR_RED))
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
' Create a style for the cellset xlsStyle = CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setForeground(CLng(RED))
' 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 ret = xlsStyle.setForeground(Color.red)><!-- Apply the style to the cell --><cfset ret = xlsCell.setStyle(xlsStyle)>
.NET:# Create a style for the cell
xlsStyle = ExcelStyle()
xlsStyle.setForeground(Color.Red)
# Apply the style to the cell
xlsCell.setStyle(xlsStyle)
Java:# Create a style for the cell
xlsStyle = gateway.jvm.ExcelStyle()
xlsStyle.setForeground(gateway.jvm.Color.RED)
# Apply the style to the cell
xlsCell.setStyle(xlsStyle)
// Create a style for the cell
ExcelStyle xlsStyle = new ExcelStyle();
xlsStyle.setBold(true);
xlsStyle.setItalic(true);
// Apply the style to the cell
xlsCell.setStyle(xlsStyle);
' Create a style for the cellDim xlsStyle As New ExcelStyle()
xlsStyle.setBold(true)
xlsStyle.setItalic(true)
' 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->setBold(true);
xlsStyle->setItalic(true);
// Apply the style to the cell
xlsCell->setStyle(xlsStyle);
C++.NET// Create a style for the cell
ExcelStyle ^xlsStyle = gcnew ExcelStyle();
xlsStyle->setBold(true);
xlsStyle->setItalic(true);
// Apply the style to the cell
xlsCell->setStyle(xlsStyle);
// Create a style for the cell
ExcelStyle xlsStyle = new ExcelStyle();
xlsStyle.setBold(true);
xlsStyle.setItalic(true);
// Apply the style to the cell
xlsCell.setStyle(xlsStyle);
.NET:// Create a style for the cell
$xlsStyle = new COM("EasyXLS.ExcelStyle");
$xlsStyle->setBold(true);
$xlsStyle->setItalic(true);
// Apply the style to the cell
$xlsCell->setStyle($xlsStyle);
Java:// Create a style for the cell
$xlsStyle = new java("EasyXLS.ExcelStyle");
$xlsStyle->setBold(true);
$xlsStyle->setItalic(true);
// Apply the style to the cell
$xlsCell->setStyle($xlsStyle);
' Create a style for the cellset xlsStyle = Server.CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setBold(true)
xlsStyle.setItalic(true)
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
' Create a style for the cellSet xlsStyle = CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setBold(true)
xlsStyle.setItalic(true)
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
' Create a style for the cellset xlsStyle = CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setBold(true)
xlsStyle.setItalic(true)
' 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 ret = xlsStyle.setBold(true)><cfset ret = xlsStyle.setItalic(true)><!-- Apply the style to the cell --><cfset ret = xlsCell.setStyle(xlsStyle)>
.NET:# Create a style for the cell
xlsStyle = ExcelStyle()
xlsStyle.setBold(True)
xlsStyle.setItalic(True)
# Apply the style to the cell
xlsCell.setStyle(xlsStyle)
Java:# Create a style for the cell
xlsStyle = gateway.jvm.ExcelStyle()
xlsStyle.setBold(True)
xlsStyle.setItalic(True)
# Apply the style to the cell
xlsCell.setStyle(xlsStyle)
// Create a style for the cell
ExcelStyle xlsStyle = new ExcelStyle();
xlsStyle.setUnderlineStyle(FontSettings.UNDERLINE_STYLE_SINGLE);
// Apply the style to the cell
xlsCell.setStyle(xlsStyle);
' Create a style for the cellDim xlsStyle As New ExcelStyle()
xlsStyle.setUnderlineStyle(FontSettings.UNDERLINE_STYLE_SINGLE)
' 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->setUnderlineStyle(FONTSETTINGS_UNDERLINE_STYLE_SINGLE);
// Apply the style to the cell
xlsCell->setStyle(xlsStyle);
C++.NET// Create a style for the cell
ExcelStyle ^xlsStyle = gcnew ExcelStyle();
xlsStyle->setUnderlineStyle(FontSettings::UNDERLINE_STYLE_SINGLE);
// Apply the style to the cell
xlsCell->setStyle(xlsStyle);
// Create a style for the cell
ExcelStyle xlsStyle = new ExcelStyle();
xlsStyle.setUnderlineStyle(FontSettings.UNDERLINE_STYLE_SINGLE);
// Apply the style to the cell
xlsCell.setStyle(xlsStyle);
.NET:// Create a style for the cell
$xlsStyle = new COM("EasyXLS.ExcelStyle");
$xlsStyle->setUnderlineStyle($FONTSETTINGS_UNDERLINE_STYLE_SINGLE);
// Apply the style to the cell
$xlsCell->setStyle($xlsStyle);
Java:// Create a style for the cell
$xlsStyle = new java("EasyXLS.ExcelStyle");
$xlsStyle->setUnderlineStyle($FONTSETTINGS_UNDERLINE_STYLE_SINGLE);
// Apply the style to the cell
$xlsCell->setStyle($xlsStyle);
' Create a style for the cellset xlsStyle = Server.CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setUnderlineStyle(FONTSETTINGS_UNDERLINE_STYLE_SINGLE)
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
' Create a style for the cellSet xlsStyle = CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setUnderlineStyle(FontSettings.FONTSETTINGS_UNDERLINE_STYLE_SINGLE)
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
' Create a style for the cellset xlsStyle = CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setUnderlineStyle(FONTSETTINGS_UNDERLINE_STYLE_SINGLE)
' 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 ret = xlsStyle.setUnderlineStyle(FontSettings.UNDERLINE_STYLE_SINGLE)><!-- Apply the style to the cell --><cfset ret = xlsCell.setStyle(xlsStyle)>
.NET:# Create a style for the cell
xlsStyle = ExcelStyle()
xlsStyle.setUnderlineStyle(FontSettings.UNDERLINE_STYLE_SINGLE)
# Apply the style to the cell
xlsCell.setStyle(xlsStyle)
Java:# Create a style for the cell
xlsStyle = gateway.jvm.ExcelStyle()
xlsStyle.setUnderlineStyle(gateway.jvm.FontSettings.UNDERLINE_STYLE_SINGLE)
# Apply the style to the cell
xlsCell.setStyle(xlsStyle)
// Create a style for the cell
ExcelStyle xlsStyle = new ExcelStyle();
xlsStyle.setStrikethrough(true);
// Apply the style to the cell
xlsCell.setStyle(xlsStyle);
' Create a style for the cellDim xlsStyle As New ExcelStyle()
xlsStyle.setStrikethrough(True)
' 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->setStrikethrough(true);
// Apply the style to the cell
xlsCell->setStyle(xlsStyle);
C++.NET// Create a style for the cell
ExcelStyle ^xlsStyle = gcnew ExcelStyle();
xlsStyle->setStrikethrough(true);
// Apply the style to the cell
xlsCell->setStyle(xlsStyle);
// Create a style for the cell
ExcelStyle xlsStyle = new ExcelStyle();
xlsStyle.setStrikethrough(true);
// Apply the style to the cell
xlsCell.setStyle(xlsStyle);
.NET:// Create a style for the cell
$xlsStyle = new COM("EasyXLS.ExcelStyle");
$xlsStyle->setStrikethrough(true);
// Apply the style to the cell
$xlsCell->setStyle($xlsStyle);
Java:// Create a style for the cell
$xlsStyle = new java("EasyXLS.ExcelStyle");
$xlsStyle->setStrikethrough(true);
// Apply the style to the cell
$xlsCell->setStyle($xlsStyle);
' Create a style for the cellset xlsStyle = Server.CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setStrikethrough(true)
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
' Create a style for the cellSet xlsStyle = CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setStrikethrough(True)
' Apply the style to the cell
xlsCell.setStyle(xlsStyle)
' Create a style for the cellset xlsStyle = CreateObject("EasyXLS.ExcelStyle")
xlsStyle.setStrikethrough(true)
' 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 ret = xlsStyle.setStrikethrough(true)><!-- Apply the style to the cell --><cfset ret = xlsCell.setStyle(xlsStyle)>
.NET:# Create a style for the cell
xlsStyle = ExcelStyle()
xlsStyle.setStrikethrough(True)
# Apply the style to the cell
xlsCell.setStyle(xlsStyle)
Java:# Create a style for the cell
xlsStyle = gateway.jvm.ExcelStyle()
xlsStyle.setStrikethrough(True)
# Apply the style to the cell
xlsCell.setStyle(xlsStyle)