- Home
- Forum
- ASP.NET MVC
- Formatting cells programmatically
Formatting cells programmatically
Dear Syncfusion team,
unfortunately I cannot find any help in the API doc about formatting cells to numeric format (3 decimal places needed) programmatically. It works in the 'Format Cells' dialogue (right click). How can I accomplish that?
Thanks in advance,
Robert
unfortunately I cannot find any help in the API doc about formatting cells to numeric format (3 decimal places needed) programmatically. It works in the 'Format Cells' dialogue (right click). How can I accomplish that?
Thanks in advance,
Robert
SIGN IN To post a reply.
3 Replies
SI
Silambarasan I
Syncfusion Team
October 10, 2017 07:12 AM UTC
Hi Robert,
Thank you for using Syncfusion products.
We have checked your query and your requirement “To apply Number format with 3 decimal places programmatically” has been achieved by using ‘decimalPlaces’ property in ‘XLFormat.format()’ client-side method in Spreadsheet. Please refer the following code example.
JSPlayground Sample: http://jsplayground.syncfusion.com/dwx3fyu1
|
$("#Spreadsheet").ejSpreadsheet({
//...
loadComplete: "onLoadComplete"
});
function onLoadComplete(args) {
if (!this.isImport) {
//Default Number format - (decimal places:2 & thousandseparator:true)
this.XLFormat.format({ "type": "number" }, "B1");
//Number format with 3 decimal places (by default thousandseparator:true)
this.XLFormat.format({ "type": "number", "decimalPlaces": 3 }, "B2");
//Number format with 0 decimal places and thousandseparator as false
this.XLFormat.format({ "type": "number", "decimalPlaces": 0, "thousandSeparator": false }, "B3");
this.XLFormat.format({ "type": "number", "decimalPlaces": 3, "thousandSeparator": false }, "B4");
//...
}
}
|
Could you please check the above sample and get back to us if you need further assistance? And, we will update the code example for applying number format with decimal places in online API document in any of our upcoming releases.
Number formatting Online Sample: http://js.syncfusion.com/demos/web/#!/bootstrap/spreadsheet/formatting/numberformatting
Regards,
Silambarasan
RG
Robert Glaser
October 24, 2017 11:51 AM UTC
Thank you very much! This is working! Unfortunately I could not find that in the API doc (https://help.syncfusion.com/api/js/ejspreadsheet).
SI
Silambarasan I
Syncfusion Team
October 25, 2017 05:00 AM UTC
Hi Robert,
Thanks for your update. We are happy to hear that your requirement has been achieved.
Also, we have updated and refreshed the code example for ‘XLFormat.format()’ client-side method in online API help documentation. Please refer the below link.
Regards,
Silambarasan
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
RG Robert Glaser
- Oct 9, 2017 06:31 PM UTC
- Oct 25, 2017 05:00 AM UTC