renderXCell (Excel)
This function returns a JSON object that describes how to render a cell and how to export it.
// example renderCell function
({ value, fieldObj, row }) => {
let text = value;
if( typeof value === "object" ){ // or use fieldObj.type ??
text = value?.label;
}
if( fieldObj.valueFormat ){
text = d3.format(fieldObj.valueFormat)(value); // something like that
}
return {
backgroundColor: "#ffffff",
color: "#404040",
text: text,
vAlign: "center",
hAlign: "center"
}
}
Cell Value Properties
| Property Name | Description | Example |
|---|---|---|
| value |
Note: how to do multi-line strings? Just \n's? What about different formatting withing string?
Number Properties
| Property Name | Description | Example |
|---|---|---|
| formatCategory | ||
| customFormat |
Alignment Properties
| Property Name | Description | Example |
|---|---|---|
| hAlign | {general, leftIndent, center, rightIndent, fill, justify, centerAcrossSelection, distributedIndent} | |
| vAlign | {top, center, bottom, justify, distributed} | |
| indent | integer | |
| wrapText | ||
| shrinkToFit | ||
| mergeCells??? | Maybe rowSpan, colSpan instead | |
| textDirection | ||
| orientation | (Excel) Rotate text diagonally or vertically |
Font Properties
| Property Name | Description | Example |
|---|---|---|
| fontFamily | ||
| fontStyle | {regular, italic, bold, boldItalic} | |
| fontSize | ||
| underline | {none, single, double, singleAccounting, doubleAccounting} | |
| color | ||
| normalFont | bool | |
| strikethrough | ||
| superscript | ||
| subscript |
Border Properties
| Property Name | Description | Example |
|---|---|---|
| border | (style, color, thickness) | |
| leftBorder | ||
| topBorder | ||
| rightBorder | ||
| bottomBorder |
Fill Properties
| Property Name | Description | Example |
|---|---|---|
| backgroundColor | ||
| fillEffects | ||
| patternColor | ||
| patternStyle |
Note about colors
Explain how to use template colors instead of just hex RGB.