Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1810
need help in iggrid export to excel
posted

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

Parents Reply Children
No Data