The color scheme contains the color palette for text/background, accents of colors and hyperlink color. The font scheme contains the heading and body font. The effect scheme includes special effects that cannot be customized and are limited to predefined effects settings.
// Create an instance of the class that exports Excel files having three sheets
ExcelDocument workbook = new ExcelDocument(3);
// Set a predefined theme
workbook.setTheme(Theme.THEME_CIVIC);
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Theme.xlsx");
' Create an instance of the class that exports Excel files having three sheetsDim workbook As New ExcelDocument(3)
' Set a predefined theme
workbook.setTheme(Theme.THEME_CIVIC)
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\Theme.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);
// Set a predefined theme
workbook->setTheme_2(THEME_THEME_CIVIC);
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\Theme.xlsx");
C++.NET// Create an instance of the class that exports Excel files having three sheets
ExcelDocument ^workbook = gcnew ExcelDocument(3);
// Set a predefined theme
workbook->setTheme(Theme::THEME_CIVIC);
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\Theme.xlsx");
// Create an instance of the class that exports Excel files having three sheets
ExcelDocument workbook = new ExcelDocument(3);
// Set a predefined theme
workbook.setTheme(Theme.THEME_CIVIC);
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Theme.xlsx");
.NET:// Create an instance of the class that exports Excel files
$workbook = new COM("EasyXLS.ExcelDocument");
// Set a predefined theme
$workbook->setTheme_2($THEME_THEME_CIVIC);
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\\Samples\\Theme.xlsx");
Java:// Create an instance of the class that exports Excel files
$workbook = new java("EasyXLS.ExcelDocument");
// Set a predefined theme
$workbook->setTheme($THEME_THEME_CIVIC);
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\\Samples\\Theme.xlsx");
' Create an instance of the class that exports Excel filesSet workbook = Server.CreateObject("EasyXLS.ExcelDocument")
' Set a predefined theme
workbook.setTheme_2(THEME_THEME_CIVIC)
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\Theme.xlsx")
' Create an instance of the class that exports Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Set a predefined theme
workbook.setTheme_2(Theme.THEME_THEME_CIVIC)
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\Theme.xlsx")
' Create an instance of the class that exports Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Set a predefined theme
workbook.setTheme_2(THEME_CIVIC)
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\Theme.xlsx")
<!-- Create an instance of the class that exports Excel files --><cfobject type="java"class="EasyXLS.ExcelDocument"name="workbook"action="CREATE"><!-- Set a predefined theme --><cfset workbook.setTheme(Theme.THEME_CIVIC)><!-- Export Excel file --><cfset ret= workbook.easy_WriteXLSXFile("C:\Samples\Theme.xlsx")>
.NET:# Create an instance of the class that exports Excel files having three sheets
workbook = ExcelDocument(3)
# Set a predefined theme
workbook.setTheme(Theme.THEME_CIVIC)
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Theme.xlsx")
Java:# Create an instance of the class that exports Excel files having three sheets
workbook = gateway.jvm.ExcelDocument(3)
# Set a predefined theme
workbook.setTheme(gateway.jvm.Theme.THEME_CIVIC)
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Theme.xlsx")
Custom theme
The below source code sample shows how to apply a custom theme to the workbook, a theme with specific colors, fonts and effects defined.
// Create an instance of the class that exports Excel files having three sheets
ExcelDocument workbook = new ExcelDocument(3);
// Create a theme
ExcelTheme xlsTheme = new ExcelTheme();
// Define theme colors
ExcelColorScheme colorScheme = xlsTheme.getColorScheme();
colorScheme.setAccent1Color(Color.FromArgb(0x5B, 0x9B, 0xD5));
colorScheme.setAccent2Color(Color.FromArgb(0xED, 0x7D, 0x31));
colorScheme.setAccent3Color(Color.FromArgb(0xA5, 0xA5, 0xA5));
colorScheme.setAccent4Color(Color.FromArgb(0xFF, 0xC0, 0x00));
colorScheme.setAccent5Color(Color.FromArgb(0x44, 0x72, 0xC4));
colorScheme.setAccent6Color(Color.FromArgb(0x70, 0xAD, 0x47));
// Define fonts
ExcelFontScheme fontScheme = xlsTheme.getFontScheme();
fontScheme.setHeadingFont("Calibri Light");
fontScheme.setBodyFont("Calibri");
// Define effects
ExcelEffectScheme effectScheme = new ExcelEffectScheme();
effectScheme.InitAs(EasyXLS.Constants.Theme.THEME_EFFECTS_OFFICE);
xlsTheme.setEffectScheme(effectScheme);
// Set the custom theme to the workbook
workbook.setTheme(xlsTheme);
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Custom theme.xlsx");
' Create an instance of the class that exports Excel files having three sheetsDim workbook As New ExcelDocument(3)
' Create a themeDim xlsTheme As New ExcelTheme()
' Define theme colorsDim colorScheme = xlsTheme.getColorScheme()
colorScheme.setAccent1Color(Color.FromArgb(&H5B, &H9B, &HD5))
colorScheme.setAccent2Color(Color.FromArgb(&HED, &H7D, &H31))
colorScheme.setAccent3Color(Color.FromArgb(&HA5, &HA5, &HA5))
colorScheme.setAccent4Color(Color.FromArgb(&HFF, &HC0, &H0))
colorScheme.setAccent5Color(Color.FromArgb(&H44, &H72, &HC4))
colorScheme.setAccent6Color(Color.FromArgb(&H70, &HAD, &H47))
' Define fontsDim fontScheme = xlsTheme.getFontScheme()
fontScheme.setHeadingFont("Calibri Light")
fontScheme.setBodyFont("Calibri")
' Define effectsDim effectScheme = New ExcelEffectScheme()
effectScheme.InitAs(EasyXLS.Constants.Theme.THEME_EFFECTS_OFFICE)
xlsTheme.setEffectScheme(effectScheme)
' Set the custom theme to the workbook
workbook.setTheme(xlsTheme)
' Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Custom theme.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 a theme
EasyXLS::IExcelThemePtr xlsTheme;
CoCreateInstance(__uuidof(EasyXLS::ExcelTheme), NULL, CLSCTX_ALL,
__uuidof(EasyXLS::IExcelTheme), (void**)&xlsTheme);
// Define theme colors
EasyXLS::IExcelColorSchemePtr colorScheme = xlsTheme->getColorScheme();
colorScheme->setAccent1Color(0xffD59B5B);
colorScheme->setAccent2Color(0xff317DED);
colorScheme->setAccent3Color(0xffA5A5A5);
colorScheme->setAccent4Color(0xff00C0FF);
colorScheme->setAccent5Color(0xffC47244);
colorScheme->setAccent6Color(0xff47AD70);
// Define fonts
EasyXLS::IExcelFontSchemePtr fontScheme = xlsTheme->getFontScheme();
fontScheme->setHeadingFont("Calibri Light");
fontScheme->setBodyFont("Calibri");
// Define effects
EasyXLS::IExcelEffectSchemePtr effectScheme;
CoCreateInstance(__uuidof(EasyXLS::ExcelEffectScheme), NULL, CLSCTX_ALL,
__uuidof(EasyXLS::IExcelEffectScheme), (void**)&effectScheme);
effectScheme->InitAs(THEME_THEME_EFFECTS_OFFICE);
xlsTheme->setEffectScheme(effectScheme);
// Set the custom theme to the workbook
workbook->setTheme(xlsTheme);
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\Custom theme.xlsx");
C++.NET// Create an instance of the class that exports Excel files having three sheets
ExcelDocument ^workbook = gcnew ExcelDocument(3);
// Create a theme
ExcelTheme ^xlsTheme = gcnew ExcelTheme();
// Define theme colors
ExcelColorScheme^ colorScheme = xlsTheme->getColorScheme();
colorScheme->setAccent1Color(Color::FromArgb(0x5B, 0x9B, 0xD5));
colorScheme->setAccent2Color(Color::FromArgb(0xED, 0x7D, 0x31));
colorScheme->setAccent3Color(Color::FromArgb(0xA5, 0xA5, 0xA5));
colorScheme->setAccent4Color(Color::FromArgb(0xFF, 0xC0, 0x00));
colorScheme->setAccent5Color(Color::FromArgb(0x44, 0x72, 0xC4));
colorScheme->setAccent6Color(Color::FromArgb(0x70, 0xAD, 0x47));
// Define fonts
ExcelFontScheme ^fontScheme = xlsTheme->getFontScheme();
fontScheme->setHeadingFont("Calibri Light");
fontScheme->setBodyFont("Calibri");
// Define effects
ExcelEffectScheme ^effectScheme = gcnew ExcelEffectScheme();
effectScheme->InitAs(EasyXLS::Constants::Theme::THEME_EFFECTS_OFFICE);
xlsTheme->setEffectScheme(effectScheme);
// Set the custom theme to the workbook
workbook->setTheme(xlsTheme);
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\Custom theme.xlsx");
// Create an instance of the class that exports Excel files having three sheets
ExcelDocument workbook = new ExcelDocument(3);
// Create a theme
ExcelTheme xlsTheme = new ExcelTheme();
// Define theme colors
ExcelColorScheme colorScheme = xlsTheme.getColorScheme();
colorScheme.setAccent1Color(new Color(0x5B, 0x9B, 0xD5));
colorScheme.setAccent2Color(new Color(0xED, 0x7D, 0x31));
colorScheme.setAccent3Color(new Color(0xA5, 0xA5, 0xA5));
colorScheme.setAccent4Color(new Color(0xFF, 0xC0, 0x00));
colorScheme.setAccent5Color(new Color(0x44, 0x72, 0xC4));
colorScheme.setAccent6Color(new Color(0x70, 0xAD, 0x47));
// Define fonts
ExcelFontScheme fontScheme = xlsTheme.getFontScheme();
fontScheme.setHeadingFont("Calibri Light");
fontScheme.setBodyFont("Calibri");
// Define effects
ExcelEffectScheme effectScheme = new ExcelEffectScheme();
effectScheme.InitAs(EasyXLS.Constants.Theme.THEME_EFFECTS_OFFICE);
xlsTheme.setEffectScheme(effectScheme);
// Set the custom theme to the workbook
workbook.setTheme(xlsTheme);
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Custom theme.xlsx");
.NET:// Create an instance of the class that exports Excel files
$workbook = new COM("EasyXLS.ExcelDocument");
// Create a theme
$xlsTheme = new COM("EasyXLS.Themes.ExcelTheme");
// Define theme colors
$colorScheme = $xlsTheme->getColorScheme();
$colorScheme->setAccent1Color((int)0xD59B5B);
$colorScheme->setAccent2Color((int)0x317DED);
$colorScheme->setAccent3Color((int)0xA5A5A5);
$colorScheme->setAccent4Color((int)0x00C0FF);
$colorScheme->setAccent5Color((int)0xC47244);
$colorScheme->setAccent6Color((int)0x47AD70);
// Define fonts
$fontScheme = $xlsTheme->getFontScheme();
$fontScheme->setHeadingFont("Calibri Light");
$fontScheme->setBodyFont("Calibri");
// Define effects
$effectScheme = new COM("EasyXLS.Themes.ExcelEffectScheme");
$effectScheme->InitAs($THEME_THEME_EFFECTS_OFFICE);
$xlsTheme->setEffectScheme($effectScheme);
// Set the custom theme to the workbook
$workbook->setTheme($xlsTheme);
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\Samples\Custom theme.xlsx");
Java:// Create an instance of the class that exports Excel files
$workbook = new java("EasyXLS.ExcelDocument");
// Create a theme
$xlsTheme = new java("EasyXLS.Themes.ExcelTheme");
// Define theme colors
$colorScheme = $xlsTheme->getColorScheme();
$colorScheme->setAccent1Color(new java("java.awt.Color", 0x5B, 0x9B, 0xD5));
$colorScheme->setAccent2Color(new java("java.awt.Color", 0xED, 0x7D, 0x31));
$colorScheme->setAccent3Color(new java("java.awt.Color", 0xA5, 0xA5, 0xA5));
$colorScheme->setAccent4Color(new java("java.awt.Color", 0xFF, 0xC0, 0x00));
$colorScheme->setAccent5Color(new java("java.awt.Color", 0x44, 0x72, 0xC4));
$colorScheme->setAccent6Color(new java("java.awt.Color", 0x70, 0xAD, 0x47));
// Define fonts
$fontScheme = $xlsTheme->getFontScheme();
$fontScheme->setHeadingFont("Calibri Light");
$fontScheme->setBodyFont("Calibri");
// Define effects
$effectScheme = new java("EasyXLS.Themes.ExcelEffectScheme");
$effectScheme->InitAs($THEME_THEME_EFFECTS_OFFICE);
$xlsTheme->setEffectScheme($effectScheme);
// Set the custom theme to the workbook
$workbook->setTheme($xlsTheme);
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\Samples\Custom theme.xlsx");
' Create an instance of the class that exports Excel filesset workbook = Server.CreateObject("EasyXLS.ExcelDocument")
' Create a themeset xlsTheme = Server.CreateObject("EasyXLS.Themes.ExcelTheme")
' Define theme colorsset colorScheme = xlsTheme.getColorScheme()
colorScheme.setAccent1Color(&hffD59B5B)
colorScheme.setAccent2Color(&hff317DED)
colorScheme.setAccent3Color(&hffA5A5A5)
colorScheme.setAccent4Color(&hff00C0FF)
colorScheme.setAccent5Color(&hffC47244)
colorScheme.setAccent6Color(&hff47AD70)
' Define fontsset fontScheme = xlsTheme.getFontScheme()
fontScheme.setHeadingFont("Calibri Light")
fontScheme.setBodyFont("Calibri")
' Define effectsset effectScheme = Server.CreateObject("EasyXLS.Themes.ExcelEffectScheme")
effectScheme.InitAs(THEME_THEME_EFFECTS_OFFICE)
xlsTheme.setEffectScheme(effectScheme)
' Set the custom theme to the workbook
workbook.setTheme(xlsTheme)
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\Custom theme.xlsx")
' Create an instance of the class that exports Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Create a themeSet xlsTheme = CreateObject("EasyXLS.Themes.ExcelTheme")
' Define theme colorsSet colorScheme = xlsTheme.getColorScheme()
colorScheme.setAccent1Color (&HFFD59B5B)
colorScheme.setAccent2Color (&HFF317DED)
colorScheme.setAccent3Color (&HFFA5A5A5)
colorScheme.setAccent4Color (&HFF00C0FF)
colorScheme.setAccent5Color (&HFFC47244)
colorScheme.setAccent6Color (&HFF47AD70)
' Define fontsSet fontScheme = xlsTheme.getFontScheme()
fontScheme.setHeadingFont ("Calibri Light")
fontScheme.setBodyFont ("Calibri")
' Define effectsSet effectScheme = CreateObject("EasyXLS.Themes.ExcelEffectScheme")
effectScheme.InitAs (Theme.THEME_THEME_EFFECTS_OFFICE)
xlsTheme.setEffectScheme (effectScheme)
' Set the custom theme to the workbook
workbook.setTheme (xlsTheme)
' Export Excel file
workbook.easy_WriteXLSXFile ("C:\Samples\Custom theme.xlsx")
' Create an instance of the class that exports Excel filesSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Create a themeSet xlsTheme = CreateObject("EasyXLS.Themes.ExcelTheme")
' Define theme colorsSet colorScheme = xlsTheme.getColorScheme()
colorScheme.setAccent1Color(&hffD59B5B)
colorScheme.setAccent2Color(&hff317DED)
colorScheme.setAccent3Color(&hffA5A5A5)
colorScheme.setAccent4Color(&hff00C0FF)
colorScheme.setAccent5Color(&hffC47244)
colorScheme.setAccent6Color(&hff47AD70)
' Define fontsSet fontScheme = xlsTheme.getFontScheme()
fontScheme.setHeadingFont("Calibri Light")
fontScheme.setBodyFont("Calibri")
' Define effectsSet effectScheme = CreateObject("EasyXLS.Themes.ExcelEffectScheme")
effectScheme.InitAs(THEME_THEME_EFFECTS_OFFICE)
xlsTheme.setEffectScheme(effectScheme)
' Set the custom theme to the workbook
workbook.setTheme(xlsTheme)
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\Custom theme.xlsx")
<!-- Create an instance of the class that exports Excel files --><cfobject type="java"class="EasyXLS.ExcelDocument"name="workbook"action="CREATE"><!-- Create a theme --><cfobject type="java"class="EasyXLS.Themes.ExcelTheme"name="xlsTheme"action="CREATE"><!-- Define theme colors --><cfset colorScheme = xlsTheme.getColorScheme()><cfobject type="java"class="java.awt.Color"name="accent1"action="CREATE"><cfset Accent1.init(JavaCast("int", "91"),
JavaCast("int", "155"), JavaCast("int", "213"))><cfobject type="java"class="java.awt.Color"name="accent2"action="CREATE"><cfset accent2.init(JavaCast("int", "237"),
JavaCast("int", "125"), JavaCast("int", "49"))><cfobject type="java"class="java.awt.Color"name="accent3"action="CREATE"><cfset accent3.init(JavaCast("int", "165"),
JavaCast("int", "165"), JavaCast("int", "165"))><cfobject type="java"class="java.awt.Color"name="accent4"action="CREATE"><cfset accent4.init(JavaCast("int", "255"),
JavaCast("int", "192"), JavaCast("int", "0"))><cfobject type="java"class="java.awt.Color"name="accent5"action="CREATE"><cfset accent5.init(JavaCast("int", "68"),
JavaCast("int", "114"), JavaCast("int", "196"))><cfobject type="java"class="java.awt.Color"name="accent6"action="CREATE"><cfset accent6.init(JavaCast("int", "112"),
JavaCast("int", "173"), JavaCast("int", "71"))><cfset colorScheme.setAccent1Color(accent1)><cfset colorScheme.setAccent2Color(accent2)><cfset colorScheme.setAccent3Color(accent3)><cfset colorScheme.setAccent4Color(accent4)><cfset colorScheme.setAccent5Color(accent5)><cfset colorScheme.setAccent6Color(accent6)><!-- Define fonts --><cfset fontScheme = xlsTheme.getFontScheme()><cfset fontScheme.setHeadingFont("Calibri Light")><cfset fontScheme.setBodyFont("Arial")><!-- Define effects --><cfobject type="java"class="EasyXLS.Themes.ExcelEffectScheme"name="effectScheme"action="CREATE"><cfset effectScheme.InitAs(Theme.THEME_EFFECTS_OFFICE)><cfset xlsTheme.setEffectScheme(effectScheme)><!-- Set the custom theme to the workbook --><cfset workbook.setTheme(xlsTheme)><!-- Export Excel file --><cfset ret = workbook.easy_WriteXLSXFile("C:\Samples\Custom theme.xlsx")>
.NET:# Create an instance of the class that exports Excel files having three sheets
workbook = ExcelDocument(3)
# Create a theme
xlsTheme = ExcelTheme()
# Define theme colors
colorScheme = xlsTheme.getColorScheme()
colorScheme.setAccent1Color(Color.FromArgb(0x5B, 0x9B, 0xD5))
colorScheme.setAccent2Color(Color.FromArgb(0xED, 0x7D, 0x31))
colorScheme.setAccent3Color(Color.FromArgb(0xA5, 0xA5, 0xA5))
colorScheme.setAccent4Color(Color.FromArgb(0xFF, 0xC0, 0x00))
colorScheme.setAccent5Color(Color.FromArgb(0x44, 0x72, 0xC4))
colorScheme.setAccent6Color(Color.FromArgb(0x70, 0xAD, 0x47))
# Define fonts
fontScheme = xlsTheme.getFontScheme()
fontScheme.setHeadingFont("Calibri Light")
fontScheme.setBodyFont("Calibri")
# Define effects
effectScheme = ExcelEffectScheme()
effectScheme.InitAs(Theme.THEME_EFFECTS_OFFICE
xlsTheme.setEffectScheme(effectScheme)
# Set the custom theme to the workbook
workbook.setTheme(xlsTheme)
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Custom theme.xlsx")
Java:# Create an instance of the class that exports Excel files having three sheets
workbook = gateway.jvm.ExcelDocument(3)
# Create a theme
xlsTheme = gateway.jvm.ExcelTheme()
# Define theme colors
colorScheme = xlsTheme.getColorScheme()
colorScheme.setAccent1Color(gateway.jvm.Color(0x5B, 0x9B, 0xD5))
colorScheme.setAccent2Color(gateway.jvm.Color(0xED, 0x7D, 0x31))
colorScheme.setAccent3Color(gateway.jvm.Color(0xA5, 0xA5, 0xA5))
colorScheme.setAccent4Color(gateway.jvm.Color(0xFF, 0xC0, 0x00))
colorScheme.setAccent5Color(gateway.jvm.Color(0x44, 0x72, 0xC4))
colorScheme.setAccent6Color(gateway.jvm.Color(0x70, 0xAD, 0x47))
# Define fonts
fontScheme = xlsTheme.getFontScheme()
fontScheme.setHeadingFont("Calibri Light")
fontScheme.setBodyFont("Calibri")
# Define effects
effectScheme = gateway.jvm.ExcelEffectScheme()
effectScheme.InitAs(gateway.jvm.Theme.THEME_EFFECTS_OFFICE)
xlsTheme.setEffectScheme(effectScheme)
# Set the custom theme to the workbook
workbook.setTheme(xlsTheme)
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Custom theme.xlsx")
Theme color
A theme color can be used by various EasyXLS classes to set the color for different elements of Excel workbook like cell background, cell foreground, border color and others. The ThemeColor class stores only the index of the color in color palette that is defined in ExcelColorScheme class. The color scheme is based on a set of 12 colors. There are 10 basic colors that are altered darker or lighter and two colors for hyperlinks. So, the color palette is a matrix of colors with 10 basic colors as headings.
The below source code sample shows how to set a theme color as background on a cell.
// Create an instance of the class that exports Excel files having a sheet
ExcelDocument workbook = new ExcelDocument(1);
// Get the table of data for the sheet
ExcelTable xlsTable = ((ExcelWorksheet)workbook.easy_getSheetAt(0)).easy_getExcelTable();
// Set a theme color for cell
ExcelCell xlsCell = xlsTable.easy_getCell(0, 0);
xlsCell.setBackground(new ThemeColor(5, 3));
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Color theme.xlsx");
' Create an instance of the class that exports Excel files having a sheetDim workbook As New ExcelDocument(1)
' Get the table of data for the sheetDim xlsFirstTab As ExcelWorksheet = workbook.easy_getSheet("Sheet1")
Dim xlsTable = xlsFirstTab.easy_getExcelTable()
' Set a theme color for cellDim xlsCell = xlsTable.easy_getCell(0, 0)
xlsCell.setBackground(New ThemeColor(5, 3))
' Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Color theme.xlsx")
C++// Create an instance of the class that exports Excel files having a sheet
EasyXLS::IExcelDocumentPtr workbook;
hr = CoCreateInstance(__uuidof(EasyXLS::ExcelDocument),
NULL,
CLSCTX_ALL,
__uuidof(EasyXLS::IExcelDocument),
(void**) &workbook);
// Create a worksheet
workbook->easy_addWorksheet_2("Sheet1");
// Get the table of data for the sheet
EasyXLS::IExcelWorksheetPtr xlsFirstTab =
(EasyXLS::IExcelWorksheetPtr)workbook->easy_getSheet("Sheet1");
EasyXLS::IExcelTablePtr xlsTable = xlsFirstTab->easy_getExcelTable();
// Set a theme color for cell
EasyXLS::IExcelCellPtr xlsCell = xlsTable->easy_getCell(0, 0);
EasyXLS::IThemeColorPtr xlsColor;
CoCreateInstance(__uuidof(EasyXLS::ThemeColor), NULL, CLSCTX_ALL,
__uuidof(EasyXLS::IThemeColor), (void**)&xlsColor);
xlsColor->setColor(5, 3);
xlsCell->setBackground_2(xlsColor);
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\Color theme.xlsx");
C++.NET// Create an instance of the class that exports Excel files having a sheet
ExcelDocument ^workbook = gcnew ExcelDocument(1);
// Get the table of data for the sheet
ExcelWorksheet ^xlsFirstTab =
safe_cast<ExcelWorksheet^>(workbook->easy_getSheet("Sheet1"));
ExcelTable ^xlsTable = xlsFirstTab->easy_getExcelTable();
// Set a theme color for cell
ExcelCell ^xlsCell = xlsTable->easy_getCell(0, 0);
xlsCell->setBackground(gcnew ThemeColor(5, 3));
// Export Excel file
workbook->easy_WriteXLSXFile("C:\\Samples\\Color theme.xlsx");
// Create an instance of the class that exports Excel files having a sheet
ExcelDocument workbook = new ExcelDocument(1);
// Get the table of data for the sheet
ExcelTable xlsTable = ((ExcelWorksheet)workbook.easy_getSheetAt(0)).easy_getExcelTable();
// Set a theme color for cell
ExcelCell xlsCell = xlsTable.easy_getCell(0, 0);
xlsCell.setBackground(new ThemeColor(5, 3));
// Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Color theme.xlsx");
.NET:// Create an instance of the class that exports Excel files having a sheet
$workbook = new COM("EasyXLS.ExcelDocument");
// Create a worksheet
$workbook->easy_addWorksheet_2("Sheet1");
// Get the table of data for the sheet
$xlsTable = $workbook->easy_getSheet("Sheet1")->easy_getExcelTable();
// Set a theme color for cell
$xlsCell = $xlsTable->easy_getCell(0, 0);
$xlsColor = new COM("EasyXLS.Themes.ThemeColor");
$xlsColor->setColor(5, 3);
$xlsCell->setBackground_2($xlsColor);
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\Samples\Color theme.xlsx");
Java:// Create an instance of the class that exports Excel files having a sheet
$workbook = new java("EasyXLS.ExcelDocument");
// Create a worksheet
$workbook->easy_addWorksheet("Sheet1");
// Get the table of data for the sheet
$xlsTable = $workbook->easy_getSheet("Sheet1")->easy_getExcelTable();
// Set a theme color for cell
$xlsCell = $xlsTable->easy_getCell(0, 0);
$xlsColor = new java("EasyXLS.Themes.ThemeColor");
$xlsColor->setColor(5, 3);
$xlsCell->setBackground($xlsColor);
// Export Excel file
$workbook->easy_WriteXLSXFile("C:\Samples\Color theme.xlsx");
' Create an instance of the class that exports Excel files having a sheetset workbook = Server.CreateObject("EasyXLS.ExcelDocument")
' Create a worksheet
workbook.easy_addWorksheet_2("Sheet1")
' Get the table of data for the sheetset xlsTable = workbook.easy_getSheet("Sheet1").easy_getExcelTable()
' Set a theme color for cellset xlsCell = xlsTable.easy_getCell(0, 0)
set xlsColor = Server.CreateObject("EasyXLS.Themes.ThemeColor")
xlsColor.setColor 5, 3
xlsCell.setBackground_2(xlsColor)
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\Color theme.xlsx")
' Create an instance of the class that exports Excel files having a sheetSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Create a worksheet
workbook.easy_addWorksheet_2 ("Sheet1")
' Get the table of data for the sheetSet xlsTable = workbook.easy_getSheet("Sheet1").easy_getExcelTable()
' Set a theme color for cellSet xlsCell = xlsTable.easy_getCell(0, 0)
Set xlsColor = CreateObject("EasyXLS.Themes.ThemeColor")
xlsColor.setColor 5, 3
xlsCell.setBackground_2 (xlsColor)
' Export Excel file
workbook.easy_WriteXLSXFile ("C:\Samples\Color theme.xlsx")
' Create an instance of the class that exports Excel files having a sheetSet workbook = CreateObject("EasyXLS.ExcelDocument")
' Create a worksheet
workbook.easy_addWorksheet_2("Sheet1")
' Get the table of data for the sheetSet xlsTable = workbook.easy_getSheet("Sheet1").easy_getExcelTable()
' Set a theme color for cellSet xlsCell = xlsTable.easy_getCell(0, 0)
Set xlsColor = CreateObject("EasyXLS.Themes.ThemeColor")
xlsColor.setColor 5, 3
xlsCell.setBackground_2(xlsColor)
' Export Excel file
workbook.easy_WriteXLSXFile("C:\Samples\Color theme.xlsx")
<!-- Create an instance of the class that exports Excel files having a sheet --><cfobject type="java"class="EasyXLS.ExcelDocument"name="workbook"action="CREATE"><!-- Create a worksheet --><cfset ret = workbook.easy_addWorksheet("Sheet1")><!-- Get the table of data for the sheet --><cfset xlsTable = workbook.easy_getSheetAt(0).easy_getExcelTable()><!-- Set a theme color for cell --><cfset xlsCell = xlsTable.easy_getCell(0, 0)><cfobject type="java"class="EasyXLS.Themes.ThemeColor"name="xlsColor"action="CREATE"><cfset xlsColor.setColor(5, 3)><cfset xlsCell.setBackground(xlsColor)><!-- Export Excel file --><cfset ret = workbook.easy_WriteXLSXFile("C:\Samples\Color theme.xlsx")>
.NET:# Create an instance of the class that exports Excel files having a sheet
workbook = ExcelDocument(1)
# Get the table of data for the sheet
xlsTable = workbook.easy_getSheet("Sheet1").easy_getExcelTable()
# Set a theme color for cell
xlsCell = xlsTable.easy_getCell(0, 0);
xlsCell.setBackground(ThemeColor(5, 3))
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Color theme.xlsx")
Java:# Create an instance of the class that exports Excel files having a sheet
workbook = gateway.jvm.ExcelDocument(1)
# Get the table of data for the sheet
xlsTable = workbook.easy_getSheet("Sheet1").easy_getExcelTable()
# Set a theme color for cell
xlsCell = xlsTable.easy_getCell(0, 0);
xlsCell.setBackground(gateway.jvm.ThemeColor(5, 3))
# Export Excel file
workbook.easy_WriteXLSXFile("C:\\Samples\\Color theme.xlsx")