CellsHelper
CellsHelper class
Provides helper functions.
class CellsHelper;
Methods
Method | Description |
---|---|
static getSignificantDigits() | Gets and sets the number of significant digits. The default value is 17. |
static setSignificantDigits(number) | Gets and sets the number of significant digits. The default value is 17. |
static getDPI() | Gets the DPI of the machine. |
static setDPI(number) | Gets the DPI of the machine. |
static getStartupPath() | Gets or sets the startup path, which is referred to by some external formula references. |
static setStartupPath(string) | Gets or sets the startup path, which is referred to by some external formula references. |
static getAltStartPath() | Gets or sets the alternate startup path, which is referred to by some external formula references. |
static setAltStartPath(string) | Gets or sets the alternate startup path, which is referred to by some external formula references. |
static getLibraryPath() | Gets or sets the library path which is referred to by some external formula references. |
static setLibraryPath(string) | Gets or sets the library path which is referred to by some external formula references. |
static isCloudPlatform() | Please set this property True when running on a cloud platform, such as: Azure, AWSLambda, etc, |
static setIsCloudPlatform(boolean) | Please set this property True when running on a cloud platform, such as: Azure, AWSLambda, etc, |
static getTextWidth(string, Font, number) | Get width of text in unit of points. |
static getVersion() | Get the release version. |
static cellNameToIndex(string) | Gets the cell row and column indexes according to its name. |
static cellIndexToName(number, number) | Gets cell name according to its row and column indexes. |
static columnIndexToName(number) | Gets column name according to column index. |
static columnNameToIndex(string) | Gets column index according to column name. |
static rowIndexToName(number) | Gets row name according to row index. |
static rowNameToIndex(string) | Gets row index according to row name. |
static getDateTimeFromDouble(number, boolean) | Convert the double value to the date time value. |
static getDoubleFromDateTime(Date, boolean) | Convert the date time to double value. |
static getUsedColors(Workbook) | Gets all used colors in the workbook. |
static mergeFiles(string[], string, string) | Merges some large xls files to a xls file. |
static createSafeSheetName(string) | Checks given sheet name and create a valid one when needed. If given sheet name conforms to the rules of excel sheet name, then return it. Otherwise string will be truncated if length exceeds the limit and invalid characters will be replaced with ’ ‘, then return the rebuilt string value. |
static needQuoteInFormula(string) | Indicates whether the name of the sheet should be enclosed in single quotes |
getSignificantDigits()
Gets and sets the number of significant digits. The default value is 17.
static getSignificantDigits() : number;
Remarks
Only could be 15 or 17 now.
setSignificantDigits(number)
Gets and sets the number of significant digits. The default value is 17.
static setSignificantDigits(value: number) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | number | The value to set. |
Remarks
Only could be 15 or 17 now.
getDPI()
Gets the DPI of the machine.
static getDPI() : number;
setDPI(number)
Gets the DPI of the machine.
static setDPI(value: number) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | number | The value to set. |
getStartupPath()
Gets or sets the startup path, which is referred to by some external formula references.
static getStartupPath() : string;
setStartupPath(string)
Gets or sets the startup path, which is referred to by some external formula references.
static setStartupPath(value: string) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | string | The value to set. |
getAltStartPath()
Gets or sets the alternate startup path, which is referred to by some external formula references.
static getAltStartPath() : string;
setAltStartPath(string)
Gets or sets the alternate startup path, which is referred to by some external formula references.
static setAltStartPath(value: string) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | string | The value to set. |
getLibraryPath()
Gets or sets the library path which is referred to by some external formula references.
static getLibraryPath() : string;
setLibraryPath(string)
Gets or sets the library path which is referred to by some external formula references.
static setLibraryPath(value: string) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | string | The value to set. |
isCloudPlatform()
Please set this property True when running on a cloud platform, such as: Azure, AWSLambda, etc,
static isCloudPlatform() : boolean;
setIsCloudPlatform(boolean)
Please set this property True when running on a cloud platform, such as: Azure, AWSLambda, etc,
static setIsCloudPlatform(value: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | The value to set. |
getTextWidth(string, Font, number)
Get width of text in unit of points.
static getTextWidth(text: string, font: Font, scaling: number) : number;
Parameters:
Parameter | Type | Description |
---|---|---|
text | string | The text. |
font | Font | The font of the text. |
scaling | number | The scaling of text. |
getVersion()
Get the release version.
static getVersion() : string;
Returns
The release version.
cellNameToIndex(string)
Gets the cell row and column indexes according to its name.
static cellNameToIndex(cellName: string) : number[];
Parameters:
Parameter | Type | Description |
---|---|---|
cellName | string | Name of cell |
Returns
[0] is the row index and [1] is the column index.
cellIndexToName(number, number)
Gets cell name according to its row and column indexes.
static cellIndexToName(row: number, column: number) : string;
Parameters:
Parameter | Type | Description |
---|---|---|
row | number | Row index. |
column | number | Column index. |
Returns
Name of cell.
columnIndexToName(number)
Gets column name according to column index.
static columnIndexToName(column: number) : string;
Parameters:
Parameter | Type | Description |
---|---|---|
column | number | Column index. |
Returns
Name of column.
columnNameToIndex(string)
Gets column index according to column name.
static columnNameToIndex(columnName: string) : number;
Parameters:
Parameter | Type | Description |
---|---|---|
columnName | string | Column name. |
Returns
Column index.
rowIndexToName(number)
Gets row name according to row index.
static rowIndexToName(row: number) : string;
Parameters:
Parameter | Type | Description |
---|---|---|
row | number | Row index. |
Returns
Name of row.
rowNameToIndex(string)
Gets row index according to row name.
static rowNameToIndex(rowName: string) : number;
Parameters:
Parameter | Type | Description |
---|---|---|
rowName | string | Row name. |
Returns
Row index.
getDateTimeFromDouble(number, boolean)
Convert the double value to the date time value.
static getDateTimeFromDouble(doubleValue: number, date1904: boolean) : Date;
Parameters:
Parameter | Type | Description |
---|---|---|
doubleValue | number | The double value. |
date1904 | boolean | Date 1904 system. |
getDoubleFromDateTime(Date, boolean)
Convert the date time to double value.
static getDoubleFromDateTime(dateTime: Date, date1904: boolean) : number;
Parameters:
Parameter | Type | Description |
---|---|---|
dateTime | Date | The date time. |
date1904 | boolean | Date 1904 system. |
getUsedColors(Workbook)
Gets all used colors in the workbook.
static getUsedColors(workbook: Workbook) : Color[];
Parameters:
Parameter | Type | Description |
---|---|---|
workbook | Workbook | The workbook object. |
Returns
The used colors.
mergeFiles(string[], string, string)
Merges some large xls files to a xls file.
static mergeFiles(files: string[], cachedFile: string, destFile: string) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
files | string[] | The files. |
cachedFile | string | The cached file. |
destFile | string | The dest file. |
Remarks
This method only supports merging data, style and formulas to the new file. The cached file is used to store some temporary data.
createSafeSheetName(string)
Checks given sheet name and create a valid one when needed. If given sheet name conforms to the rules of excel sheet name, then return it. Otherwise string will be truncated if length exceeds the limit and invalid characters will be replaced with ’ ‘, then return the rebuilt string value.
static createSafeSheetName(nameProposal: string) : string;
Parameters:
Parameter | Type | Description |
---|---|---|
nameProposal | string | sheet name to be used |
needQuoteInFormula(string)
Indicates whether the name of the sheet should be enclosed in single quotes
static needQuoteInFormula(sheetName: string) : boolean;
Parameters:
Parameter | Type | Description |
---|---|---|
sheetName | string | The name of the sheet |