DOCUMENTS 5 - PortalScripting API
|
The XLSXWriter class allows creating files in the Excel 2007+ XLSX file format by use of the library Libxlsxwriter. More...
Public Member Functions | |
boolean | activateChartsheet (var chartsheet) |
Make a chartsheet the active, i.e., visible chartsheet. More... | |
boolean | activateWorksheet (var worksheet) |
Make a worksheet the active, i.e., visible worksheet. More... | |
XLSXChart | addChart (number type) |
Create a new chart to be added to a worksheet/chartsheet. More... | |
XLSXChartsheet | addChartsheet (String name="") |
Add a new chartsheet to the current Excel document. More... | |
XLSXWorksheet | addFormat (String name) |
Create a new format object to format cells in worksheets. More... | |
XLSXWorksheet | addWorksheet (String name="") |
Add a new worksheet to the current Excel document. More... | |
XLSXChartsheet | getChartsheetByName (String name) |
Get a chartsheet object from its name. More... | |
String | getFilePath () |
Get the file path of the created Excel file. More... | |
String | getLastError () |
Function to get the description of the last error that occurred. More... | |
XLSXWorksheet | getWorksheetByName (String name) |
Get a worksheet object from its name. More... | |
boolean | hideChartsheet (var chartsheet) |
Hide the given chartsheet. More... | |
boolean | hideWorksheet (var worksheet) |
Hide the given worksheet. More... | |
boolean | save () |
Write the Excel file to disk and free any memory allocated internally to the Excel file. More... | |
boolean | selectChartsheet (var chartsheet) |
Set a chartsheet tab as selected. More... | |
boolean | selectWorksheet (var worksheet) |
Set a worksheet tab as selected. More... | |
boolean | setProperties (String title, String subject, String author, String manager, String company, String category, String keywords, String comments, String status, String hyperlinkBase) |
Set the document properties. More... | |
XLSXWriter | XLSXWriter (String filename) |
Create a new XLSXWriter object with a given filename. More... | |
Public Attributes | |
String | version |
String value containing the version number of the used library Libxlsxwriter. More... | |
Predefined values for common colors | |
The colors are specified using a HTML style RGB integer value. For convenience a limited number of common colors are predefined as follows.
| |
number | COLOR_BLACK |
Black defined as 0x1000000 . | |
number | COLOR_BLUE |
Blue defined as 0x0000FF . | |
number | COLOR_BROWN |
Brown defined as 0x800000 . | |
number | COLOR_CYAN |
Cyan defined as 0x00FFFF . | |
number | COLOR_GRAY |
Gray defined as 0x808080 . | |
number | COLOR_GREEN |
Green defined as 0x008000 . | |
number | COLOR_LIME |
Lime defined as 0x00FF00 . | |
number | COLOR_MAGENTA |
Magenta defined as 0xFF00FF . | |
number | COLOR_NAVY |
Navy defined as 0x000080 . | |
number | COLOR_ORANGE |
Orange defined as 0xFF6600 . | |
number | COLOR_PINK |
Pink defined as 0xFF00FF . | |
number | COLOR_PURPLE |
Purple defined as 0x800080 . | |
number | COLOR_RED |
Red defined as 0xFF0000 . | |
number | COLOR_SILVER |
Silver defined as 0xC0C0C0 . | |
number | COLOR_WHITE |
White defined as 0xFFFFFF . | |
number | COLOR_YELLOW |
Yellow defined as 0xFFFF00 . | |
Cell border styles | |
The constants build an enumeration of the available values for cell border styles.
| |
number | BORDER_NONE |
No border. | |
number | BORDER_THIN |
Thin border style. | |
number | BORDER_MEDIUM |
Medium border style. | |
number | BORDER_DASHED |
Dashed border style. | |
number | BORDER_DOTTED |
Dotted border style. | |
number | BORDER_THICK |
Thick border style. | |
number | BORDER_DOUBLE |
Double border style. | |
number | BORDER_HAIR |
Hair border style. | |
number | BORDER_MEDIUM_DASHED |
Medium dashed border style. | |
number | BORDER_DASH_DOT |
Dash-dot border style. | |
number | BORDER_MEDIUM_DASH_DOT |
Medium dash-dot border style. | |
number | BORDER_DASH_DOT_DOT |
Dash-dot-dot border style. | |
number | BORDER_MEDIUM_DASH_DOT_DOT |
Medium dash-dot-dot border style. | |
number | BORDER_SLANT_DASH_DOT |
Slant dash-dot border style. | |
Text alignments | |
These constants build an enumeration of the available values for the horizontal and vertical text alignment within a cell.
| |
number | ALIGN_NONE |
No alignment. Cell will use Excel's default for the data type. | |
number | ALIGN_LEFT |
Left horizontal alignment. | |
number | ALIGN_CENTER |
Center horizontal alignment. | |
number | ALIGN_RIGHT |
Right horizontal alignment. | |
number | ALIGN_FILL |
Cell fill horizontal alignment. | |
number | ALIGN_JUSTIFY |
Justify horizontal alignment. | |
number | ALIGN_CENTER_ACROSS |
Center Across horizontal alignment. | |
number | ALIGN_DISTRIBUTED |
Distributed horizontal alignment. | |
number | ALIGN_VERTICAL_TOP |
Top vertical alignment. | |
number | ALIGN_VERTICAL_BOTTOM |
Bottom vertical alignment. | |
number | ALIGN_VERTICAL_CENTER |
Center vertical alignment. | |
number | ALIGN_VERTICAL_JUSTIFY |
Justify vertical alignment. | |
number | ALIGN_VERTICAL_DISTRIBUTED |
Distributed vertical alignment. | |
Background Patterns | |
These constants build an enumeration of the available fill patterns for the background of a cell.
| |
number | PATTERN_NONE |
Empty pattern. | |
number | PATTERN_SOLID |
Solid pattern. | |
number | PATTERN_MEDIUM_GRAY |
Medium gray pattern. | |
number | PATTERN_DARK_GRAY |
Dark gray pattern. | |
number | PATTERN_LIGHT_GRAY |
Light gray pattern. | |
number | PATTERN_DARK_HORIZONTAL |
Dark horizontal line pattern. | |
number | PATTERN_DARK_VERTICAL |
Dark vertical line pattern. | |
number | PATTERN_DARK_DOWN |
Dark diagonal stripe pattern. | |
number | PATTERN_DARK_UP |
Reverse dark diagonal stripe pattern. | |
number | PATTERN_DARK_GRID |
Dark grid pattern. | |
number | PATTERN_DARK_TRELLIS |
Dark trellis pattern. | |
number | PATTERN_LIGHT_HORIZONTAL |
Light horizontal Line pattern. | |
number | PATTERN_LIGHT_VERTICAL |
Light vertical line pattern. | |
number | PATTERN_LIGHT_DOWN |
Light diagonal stripe pattern. | |
number | PATTERN_LIGHT_UP |
Reverse light diagonal stripe pattern. | |
number | PATTERN_LIGHT_GRID |
Light grid pattern. | |
number | PATTERN_LIGHT_TRELLIS |
Light trellis pattern. | |
number | PATTERN_GRAY_125 |
12.5% gray pattern | |
number | PATTERN_GRAY_0625 |
6.25% gray pattern | |
Chart types | |
These constants build an enumeration of the available chart types.
| |
number | CHART_AREA |
Area chart. | |
number | CHART_AREA_STACKED |
Area chart - stacked. | |
number | CHART_AREA_STACKED_PERCENT |
Area chart - percentage stacked. | |
number | CHART_BAR |
Bar chart. | |
number | CHART_BAR_STACKED |
Bar chart - stacked. | |
number | CHART_BAR_STACKED_PERCENT |
Bar chart - percentage stacked. | |
number | CHART_COLUMN |
Column chart. | |
number | CHART_COLUMN_STACKED |
Column chart - stacked. | |
number | CHART_COLUMN_STACKED_PERCENT |
Column chart - percentage stacked. | |
number | CHART_DOUGHNUT |
Doughnut chart. | |
number | CHART_LINE |
Line chart. | |
number | CHART_PIE |
Pie chart. | |
number | CHART_SCATTER |
Scatter chart. | |
number | CHART_SCATTER_STRAIGHT |
Scatter chart - straight. | |
number | CHART_SCATTER_STRAIGHT_WITH_MARKERS |
Scatter chart - straight with markers. | |
number | CHART_SCATTER_SMOOTH |
Scatter chart - smooth. | |
number | CHART_SCATTER_SMOOTH_WITH_MARKERS |
Scatter chart - smooth with markers. | |
number | CHART_RADAR |
Radar chart. | |
number | CHART_RADAR_WITH_MARKERS |
Radar chart - with markers. | |
number | CHART_RADAR_FILLED |
Radar chart - filled. | |
The XLSXWriter class allows creating files in the Excel 2007+ XLSX file format by use of the library Libxlsxwriter.
An XLSXWriter object represents an entire Excel document. It can be used to write text, numbers, formulas and hyperlinks to multiple worksheets. It supports features such as:
XLSXWriter XLSXWriter::XLSXWriter | ( | String | filename | ) |
Create a new XLSXWriter object with a given filename.
filename | The name of the new Excel file to create. |
.xlsx
extension or Excel will generate a warning when opening the file. boolean XLSXWriter::activateChartsheet | ( | var | chartsheet | ) |
Make a chartsheet the active, i.e., visible chartsheet.
This function is used to specify which chartsheet is initially visible in a multi-sheet Excel document.
chartsheet | The chartsheet to be updated can be specified as follows:
|
true
if successful, false
in case of any error boolean XLSXWriter::activateWorksheet | ( | var | worksheet | ) |
Make a worksheet the active, i.e., visible worksheet.
This function is used to specify which worksheet is initially visible in a multi-sheet Excel document.
worksheet | The worksheet to be updated can be specified as follows:
|
true
if successful, false
in case of any error XLSXChart XLSXWriter::addChart | ( | number | type | ) |
Create a new chart to be added to a worksheet/chartsheet.
type | The type (from 'Chart types') of chart to be created. |
null
in case of any error. XLSXChartsheet XLSXWriter::addChartsheet | ( | String | name = "" | ) |
Add a new chartsheet to the current Excel document.
name | Optional chartsheet name. If it is empty the default Excel convention will be followed, i.e. Chart1, Chart2, etc. The chartsheet name must be a valid Excel chartsheet name, i.e. it must be less than 32 character and it cannot contain any of the characters: / \ [ ] : * ? In addition, you cannot use the same, case insensitive, sheetname for more than one worksheet, or chartsheet. |
null
in case of any error.XLSXWorksheet XLSXWriter::addFormat | ( | String | name | ) |
Create a new format object to format cells in worksheets.
name | Unique format name. |
null
in case of any error. XLSXWorksheet XLSXWriter::addWorksheet | ( | String | name = "" | ) |
Add a new worksheet to the current Excel document.
name | Optional worksheet name. If it is empty the default Excel convention will be followed, i.e. Sheet1, Sheet2, etc. The worksheet name must be a valid Excel worksheet name, i.e. it must be less than 32 character and it cannot contain any of the characters: / \ [ ] : * ? In addition, you cannot use the same, case insensitive, sheetname for more than one worksheet, or chartsheet. |
null
in case of any error. XLSXChartsheet XLSXWriter::getChartsheetByName | ( | String | name | ) |
Get a chartsheet object from its name.
name | Chartsheet name. |
null
in case of any error. String XLSXWriter::getFilePath | ( | ) |
Get the file path of the created Excel file.
String XLSXWriter::getLastError | ( | ) |
Function to get the description of the last error that occurred.
XLSXWorksheet XLSXWriter::getWorksheetByName | ( | String | name | ) |
Get a worksheet object from its name.
name | Worksheet name. |
null
in case of any error. boolean XLSXWriter::hideChartsheet | ( | var | chartsheet | ) |
Hide the given chartsheet.
chartsheet | The chartsheet to be updated can be specified as follows:
|
true
if successful, false
in case of any error boolean XLSXWriter::hideWorksheet | ( | var | worksheet | ) |
Hide the given worksheet.
worksheet | The worksheet to be updated can be specified as follows:
|
true
if successful, false
in case of any error boolean XLSXWriter::save | ( | ) |
Write the Excel file to disk and free any memory allocated internally to the Excel file.
true
if successful, false
in case of any error boolean XLSXWriter::selectChartsheet | ( | var | chartsheet | ) |
Set a chartsheet tab as selected.
This function is used to indicate that a chartsheet is selected in a multi-sheet Excel document.
chartsheet | The chartsheet to be updated can be specified as follows:
|
true
if successful, false
in case of any error boolean XLSXWriter::selectWorksheet | ( | var | worksheet | ) |
Set a worksheet tab as selected.
This function is used to indicate that a worksheet is selected in a multi-sheet Excel document.
worksheet | The worksheet to be updated can be specified as follows:
|
true
if successful, false
in case of any error boolean XLSXWriter::setProperties | ( | String | title, |
String | subject, | ||
String | author, | ||
String | manager, | ||
String | company, | ||
String | category, | ||
String | keywords, | ||
String | comments, | ||
String | status, | ||
String | hyperlinkBase | ||
) |
Set the document properties.
This function can be used to set the document properties of the current Excel document. These properties are visible in Excel (e.g. under File -> Information -> Properties
in Excel 2013) and are also available to external applications that read or index windows files.
title | Title of the Excel document. |
subject | Optional subject of the Excel document. |
author | Optional author of the Excel document. |
manager | Optional manager field of the Excel document. |
company | Optional company field of the Excel document. |
category | Optional category of the Excel document. |
keywords | Optional keywords of the Excel document. |
comments | Optional comment of the Excel document. |
status | Optional status of the Excel document. |
hyperlinkBase | Optional hyperlink base url of the Excel document. |
true
if successful, false
in case of any error String XLSXWriter::version |
String value containing the version number of the used library Libxlsxwriter.