Hi
actually what we are doing according to our client has business requirement that they want to see percentage value some times with two decimal value sometimes 3 sometimes and sometimes with n.
since infragistic has max/min decimal value 2 for percent format default. so that we are achieving this by column formatter, where we restrict the number to display as desired number of decimals while creating column and its working perfectly, but now we are trying to export excel data, the problem occurring that the percentage value while exporting coming as '2.33%' string and exporting on excel cell whose type is number due to that its exporting data on cell with error says string is stored in number cells.
for that solution what i am thinking the cells value which is going to export to convert into float and set that cells format to percent.
something like this...
cellExporting: function (sender, args) { var filteredColumn = $.grep(sender._columnsToExport, function (v) { return v.hidden == false && v.key == args.columnKey }); if (filteredColumn.length > 0) { var format = filteredColumn[0].format; if (format == 'currency') { args.xlRow.getCellFormat(args.columnIndex).formatString('$#,##0.00_);[Red]($#,##0.00)'); } if (typeof (args.cellValue) == "string" && args.cellValue.contains('%')) { args.cellValue=parseFloat(args.cellValue); args.xlRow.getCellFormat(args.columnIndex).formatString('0.00%'); } }},
but unfortunatly its not setting the parsed value to cellValue, How i can achieve this. or there any better solution we have.
looking for your response.
Thanks
can i get help on this please...
Hi,
Thank you for detailed description.
1) When exporting a column that uses a formatter then the exporter uses the same valure returned by the formatter function. IF you format it as string, then it Is expected to receive it as a string in the args.cellValue in the cellExporting event.
2) I do not see a way to display a number as percent with more than two signs after the decimal separator.
Considering 1) and 2) the approach you use may be the best option possible. However I can take a further look if you send me your formatter function so that I am sure how you modify it.