-
equals(cellStyle)
-
compares the CellStyle with another CellStyle to determine if they are equal.
Parameters:
Name |
Type |
Description |
cellStyle |
object
|
Destination object to compare with. |
Returns:
true if this object is equal to obj; otherwise, false.
-
Type
-
boolean
-
getCellBorder()
-
Retrieves the border style of a specific side of a cell within a sheet. Useful to access the styling details of cell borders, such as thickness and color.
Returns:
The border type of the cell.
-
Type
-
Core.SpreadsheetEditor.Types.BorderOptions
-
-
Retrieves the data formatting string applied to a cell's content within a sheet. Enables access to the format specification, which dictates how the cell's data is visually represented.
Returns:
A string representing the data format applied to the cell. This format string determines how the cell's content is displayed, such as number formats, date formats, or custom text formats.
-
Type
-
string
-
setCellBorder(border)
-
Sets the cell border style to a specified border with a customized type.
Parameters:
-
-
Applies a specific data format string to the cell content that allows for the customization of how numeric values, dates, and other data types are displayed within a cell.
Parameters:
Name |
Type |
Description |
format |
string
|
A string specifying the format to apply to the cell content. The format string determines how data types like numbers and dates are formatted. |
Example
WebViewer.Iframe(...)
.then(instance => {
const { documentViewer, SpreadsheetEditor } = instance.Core;
const SpreadsheetEditorEvents = SpreadsheetEditor.SpreadsheetEditorManager.Events;
const spreadsheetEditorManager = documentViewer.getSpreadsheetEditorManager();
spreadsheetEditorManager.addEventListener(SpreadsheetEditorEvents.SPREADSHEET_EDITOR_READY, async () => {
await spreadsheetEditorManager.setEditMode(SpreadsheetEditor.SpreadsheetEditorEditMode.EDITING);
const spreadsheetEditorDocument = documentViewer.getDocument().getSpreadsheetEditorDocument();
const workbook = spreadsheetEditorDocument.getWorkbook();
const cell = workbook
.getSheetAt(0)
.getRowAt(0)
.getCellAt(0);
const cellStyle = cell.getStyle();
cellStyle.setDataFormatString('General');
cell.setStyle(cellStyle);
// Other examples of cell styling:
// cellStyle.setDataFormatString('yyyy-MM-dd');
// cellStyle.setDataFormatString('yyyy-MM-dd HH:mm:ss');
// cellStyle.setDataFormatString('$#,##0.00');
// cellStyle.setDataFormatString('#,##0 "items"');
});
});