Using Infragistics4.Documents.Excel.v15.1 in my C# application to create an Excel report. Applying a format string to a column, and some of the numbers are displaying formatted, while others are not. Looking at the file in Excel, the cells that are not displaying with the desired format are showing the default cell format "General".
Code:
mExcelWB.Worksheets["Posting summary"].Columns[3].CellFormat.FormatString = "\"$\"##0.00000;[red](\"$\"##0.00000)"; mExcelWB.Worksheets["Posting summary"].Columns[5].CellFormat.FormatString = "\"$\"##,##0.00;[red](\"$\"##,##0.00)";
Output:
screen cap attached. Column "D" is the Columns[3] above and column "F" is the Columns[5]. Column "G" is unformatted copy of column "D", and "H" is an unformatted copy of "F".
It sort of looks like the format is only getting applied to numbers that have at least as many digits to the right of the decimal point as what is specified in the format string. However, column F is getting formatted for the fourth row, but not the third.
Any ideas? Am I doing something stupid and not seeing it?
Regards,
Bruce
Hi Bruce,
I am glad that you managed to resolve your issue. If you need further assistance on this matter or want me to investigate the issue you are having with xls format I will be glad to help.
Thanks,TeodorSoftware Developer
Workbook was in Excel97-2003 format (XLS). Changing to Excel2007 (XLSX) has resolved this issue for me.
Hello Teodor,
Your project works, but it's not exactly a match for what I'm doing. My program is a batch program, no UI, and it creates the workbook directly, adds the worksheets in code, etc. So we may be dealing with a difference that doing the format in the XamSpreadsheet grid in your sample is taking a different code path that formatting directly in the workbook/worksheet.
Hello Bruce,
Thank for your post. I have been looking into your issue and but unfortunately I am not able to reproduce it with the latest release of 15.1 version. Can you please review the sample that I have created for you and see whether it works on your environment or try to modify in such a way that I can reproduce it also?
Steps to reproduce:
1) Run the project2) Click Set Format3) Observe - the format in columns D and F is the same as the format in columns H and J(their format is applied directly from MS Excel)4) Click Save and Open5) Observe - The correct format is applied.
Sincerely, Teodor Software Developer Infragistics www.infragistics.com/support