RealGrid2 API
Interface
UserExportCell

UserExportCell

When exporting to Excel, specify additional content to be output in addition to the content output by the grid.

Signature:

export interface UserExportCell

Remarks

Be careful because errors may occur in the Excel file if you overwrite the area where the grid is output. row, col, and value must be specified.

Example

var userCells = [
  {row: 0, col: 0, value: "User input string"},
  {row: 1, col: 0, styleName: "userCellRed", value: "Apply style"},
  {row: 2, col: 0, mergeRow: 1, mergeCol: 3, styleName: "userCellRed", value: "Merge and apply style."},
  {row: 3, col: 0, value: "inline-style", styles: {background:"red", fontSize:"20px"}},
  {row: 4, col: 0, value: 12345, format: "#,##0.0_ ", styles: {textAlign:"right"}},
  {row: 4, col: 2, value: new Date(2022, 4, 16), format: "[$-F800]dddd, mmmm dd, yyyy", styles: {textAlign:"center"}},
]
gridView.exportGrid({"type": "excel", "target": "local", "yOffset": 5, "userCells": userCells});

Properties

PropertyTypeDescription
CellMemoCellMemo | StringOutputs a memo to a cell.
cellProtectPropsCellProtectProperties
colnumberCalculated starting from the column number to be output, 0.
formatstringEnter the format to be applied to the cell.
heightnumberSpecifies the height of the row.
heightsnumber[]If mergeRow exists, specify the height of each row.
imageUserCellImage | stringAdd an image to a cell. Images cannot be displayed larger than their cells (including merged ones).
mergeColnumberNumber of columns when merging
mergeRownumberNumber of rows when merging
rownumberIt is calculated from the line number to be output: 0.
styleNamestringclassName to be applied to the cell
stylesConfigObject | stringStyle to be applied to cell
valueanyWhat will be printed
widthnumberSpecifies the width of the column.
widthsnumber[]Specifies the width of each column if mergeCol is present.

Properties Desc

cellMemo

Prints a memo in a cell.

Type - CellMemo | string

Remarks:

You can set a message by entering it as a string.


cellProtectProps

Type - CellProtectProperties

Remarks:

lock


col

Calculated starting from the column number to be output, 0.

Type - number


format

Enter the format to be applied to the cell.

Type - string


height

Specifies the height of the row.

Type - number

Remarks:

When adding to an already output line, the height of the output line is maintained.


heights

If mergeRow exists, specify the height of each row.

Type - number[]

Remarks:

If not specified, height is applied.


image

Add an image to a cell. Images cannot be displayed larger than their cells (including merged ones).

Type - UserCellImage | string

Remarks:

When input as a string, the image is aligned in the center and output.


mergeCol

Number of columns when merging

Type - number


mergeRow

Number of rows when merging

Type - number


row

It is calculated starting from the line number to be output: 0.

Type - number


styleName

className to be applied to the cell

Type - string


styles

Style applied to the cell

Type - ConfigObject | string

Example:

var styles = {
 textAlign: "center",
 background: "green",
 color: "red"
}
 
var styles2 = "text-align:center;background:green;color:red"

value

What will be printed

Type - any

Remarks:

Enter values in the form of string, numbar, date, and boolean.


width

Specifies the width of the column.

Type - number

Remarks:

If the column already exists, the existing width is maintained.


widths

Specifies the width of each column if mergeCol exists.

Type - number[]

Remarks:

If not specified, width is applied.