const addFormatter=(cell)=>{
function CustomNumberFormat() {
}
CustomNumberFormat.prototype = new GC.Spread.Formatter.FormatterBase();
CustomNumberFormat.prototype.format = function (value, formattedData) {
if(value){
let array = value.split(' ')
let number = array[array.length-1].toString()
let money = number.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g,'$&,')
value = value.replace(number,money)
}
return value
};
CustomNumberFormat.prototype.parse = function (str) {
return new GC.Spread.Formatter.GeneralFormatter().parse(str);
};
cell.formatter(new CustomNumberFormat())
} |