I'm using Excel export with the Infragistics.Excel library. I'm trying to format the CellFormat.FormatString to display numbers in the sheet the way I want. For sample purposes I'm using the FormatString found in one of your examples
worksheet.Columns[index].CellFormat.FormatString = "\"$\"#,##0.00;[red](\"$\"#,##0.00)";
However this is not working. The cells are not formatted based on this value. In Excel I get an error "the number in this cell is formatted as text or preceded by an apostrophe". When I right-click the cell and see what the formatting is, the CORRECT formatting can be seen as selected. Any idea why Excel still doesn't follow the selected formatting?
Hello Imran,
Yes, it is not a silverlight sample. I created a console application to demonstrate FormatString and I used the following documentation link.
I am sorry I forgot to exclude those excel files from the project. I have excluded them now and the workbook that is saved (Test4.xls) will be saved in bin.
I have reattached the modified sample application.
Imran Javed Zia said: is it possible to get formated value from cell.Value after applying FormatString in runtime from the object instead of after exporting ,
Regarding your above request there is currently no way to get formatted value from the cell and I am going to log a feature request on this issue.
I will create a case for you and send the feature request number to the case.
Thank you,
Hi Asma,
I am sorry, but I cannot find provided sample as valid Infragistics.SilverLight Sample it seems a windows example furthermore it is missing excel files.
furthernmore, is it possible to get formated value from cell.Value after applying FormatString in runtime from the object instead of after exporting ,
Thanks
Yes, I also got it working. I was just setting the value in wrong type. I had the integer value set as string for the cell and that's why the formatting didn't work. Thanks for the help.
Hello,
I have created a sample by using the same format string that you have provided and I am not able to reproduce the issue you mentioned. Attached is the sample I have created and I have followed this link FormatString.
Please send me a sample which reproduces the issue.