Skip to main content

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 NameDescriptionExample
value

Note: how to do multi-line strings? Just \n's? What about different formatting withing string?

Number Properties

Property NameDescriptionExample
formatCategory
customFormat

Alignment Properties

Property NameDescriptionExample
hAlign{general, leftIndent, center, rightIndent, fill, justify, centerAcrossSelection, distributedIndent}
vAlign{top, center, bottom, justify, distributed}
indentinteger
wrapText
shrinkToFit
mergeCells???Maybe rowSpan, colSpan instead
textDirection
orientation(Excel) Rotate text diagonally or vertically

Font Properties

Property NameDescriptionExample
fontFamily
fontStyle{regular, italic, bold, boldItalic}
fontSize
underline{none, single, double, singleAccounting, doubleAccounting}
color
normalFontbool
strikethrough
superscript
subscript

Border Properties

Property NameDescriptionExample
border(style, color, thickness)
leftBorder
topBorder
rightBorder
bottomBorder

Fill Properties

Property NameDescriptionExample
backgroundColor
fillEffects
patternColor
patternStyle

Note about colors

Explain how to use template colors instead of just hex RGB.