-
createColumns(columnIndex, count)
-
Creates new columns and inserts them at the specified index within the sheet.
Parameters:
Name |
Type |
Description |
columnIndex |
Number
|
A zero-based index at which to start inserting the created columns. |
count |
Number
|
The number of columns to create. |
Returns:
-
Type
-
void
-
createRows(rowIndex, count)
-
Creates new rows with the start point at the specified index, and the count of rows to create.
Parameters:
Name |
Type |
Description |
rowIndex |
number
|
A zero-based index at which the new rows will be inserted. |
count |
number
|
The number of rows to create. |
Returns:
An array of
rows created.
-
Type
-
Array.<Core.SpreadsheetEditor.Row>
-
getCellAt(rowIndex, columnIndex)
-
Retrieves the cell at the specified row and column index within the sheet. If the cell does not exist, it will be created.
Parameters:
Name |
Type |
Description |
rowIndex |
|
A zero-based index of the row. |
columnIndex |
|
A zero-based index of the column. |
Returns:
The cell at the specified row and column index.
-
Type
-
Core.SpreadsheetEditor.Cell
-
getColumnWidthInPixel(columnIndex)
-
Retrieves the width of a specified column within the sheet.
Parameters:
Name |
Type |
Description |
columnIndex |
Number
|
A zero-based index of the column whose width is to be retrieved. |
Returns:
The width of the specified column in pixels.
-
Type
-
Number
-
getRowAt(rowIndex)
-
Retrieves the row at the specified index within the sheet.
Parameters:
Name |
Type |
Description |
rowIndex |
|
A zero-based index of the row to retrieve from the sheet. |
Returns:
The row at the specified index.
-
Type
-
Core.SpreadsheetEditor.Row
-
getRowHeightInPixel(rowIndex)
-
Retrieves the height of a specified row within the sheet.
Parameters:
Name |
Type |
Description |
rowIndex |
Number
|
A zero-based index of the row whose height is to be retrieved. |
Returns:
The height of the specified row in pixels.
-
Type
-
Number
-
removeColumns(columnIndex, count)
-
Removes a specific number of columns from a sheet, starting from a given index.
Parameters:
Name |
Type |
Description |
columnIndex |
Number
|
A zero-based index to start removing columns at. |
count |
Number
|
The number of columns to remove. |
Returns:
-
Type
-
void
-
removeRows(rowIndex, count)
-
Removes a specific number of rows from a sheet, starting from a given index.
Parameters:
Name |
Type |
Description |
rowIndex |
Number
|
A zero-based index to start removing rows at. |
count |
Number
|
The number of rows to remove. |
Returns:
-
Type
-
void
-
setCellRangeBorder(range, border)
-
Sets the border style for a specified border of the cell range.
Parameters:
Returns:
-
Type
-
void
Example
const { Core } = window.getInstance();
const CellRange = Core.SpreadsheetEditor.CellRange;
const workbook = Core.documentViewer.getDocument().getSpreadsheetEditorDocument().getWorkbook();
const sheet = workbook.getSheet('Invoice');
const cellBorder = {
type: 'Top',
style: 'Medium',
color: 'Red'
};
const range = new CellRange({ firstRow: 3, lastRow: 4, firstColumn: 5, lastColumn: 7 });
sheet.setCellRangeBorder(range, cellBorder);
-
setCellRangeStyle(range, style)
-
Applies a cell style to a specified range of cells within the sheet.
Parameters:
Example
const { Core } = window.getInstance();
const CellRange = Core.SpreadsheetEditor.CellRange;
const workbook = Core.documentViewer.getDocument().getSpreadsheetEditorDocument().getWorkbook();
const sheet = workbook.getSheet('Invoice');
const cellStyle = workbook.createCellStyle({
backgroundColor: 'red',
verticalAlignment: 1,
horizontalAlignment: 1,
wrapText: 2,
});
const range = new CellRange({ firstRow: 3, lastRow: 4, firstColumn: 5, lastColumn: 7 });
sheet.setCellRangeStyle(range, cellStyle);
-
setColumnWidthInPixel(columnIndex, width)
-
Adjusts the width of a specified column within the sheet, measured in pixels.
Parameters:
Name |
Type |
Description |
columnIndex |
Number
|
A zero-based index of the column. |
width |
Number
|
The new width, in pixels. |
-
setRowHeightInPixel(rowIndex, height)
-
Adjusts the height of a specified row within the sheet, measured in pixels.
Parameters:
Name |
Type |
Description |
rowIndex |
Number
|
A zero-based index of the row. |
height |
Number
|
The new height, in pixels. |
Returns:
-
Type
-
void