On this page
A safe copy of an untrusted cell style, or null when it is invalid. The copy
is plain and bounded; the result is null when value is not a plain object
of known style fields or any field breaks its rule. The same rule guards
hyperlinks, table styles and pasted cells.
Declaration
function sanitizeCellStyle ( value : unknown ): CellStyle | null
Parameters
value : unknown required
A style from outside your code, such as parsed JSON.
Returns
A new style with only the known fields, or null when any field is invalid.
interface CellStyle {
bold?: boolean;
italic?: boolean;
underline?: boolean;
strikethrough?: boolean;
fontSize?: number;
fontFamily?: string;
color?: string;
backgroundColor?: string;
align?: CellAlign;
verticalAlign?: CellVerticalAlign;
numberFormat?: string;
wrap?: boolean;
border?: CellBorders;
} interface CellStyle {
bold ?: boolean ;
italic ?: boolean ;
underline ?: boolean ;
strikethrough ?: boolean ;
fontSize ?: number ;
fontFamily ?: string ;
color ?: string ;
backgroundColor ?: string ;
align ?: CellAlign ;
verticalAlign ?: CellVerticalAlign ;
numberFormat ?: string ;
wrap ?: boolean ;
border ?: CellBorders ;
} interface CellStyle {
bold ?: boolean ;
italic ?: boolean ;
underline ?: boolean ;
strikethrough ?: boolean ;
fontSize ?: number ;
fontFamily ?: string ;
color ?: string ;
backgroundColor ?: string ;
align ?: CellAlign ;
verticalAlign ?: CellVerticalAlign ;
numberFormat ?: string ;
wrap ?: boolean ;
border ?: CellBorders ;
} Serializable formatting applied to a cell or used as a column default. API reference On this page