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
60
Creating Excel file, formatting a column of numbers is inconsistent
posted

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

Parents Reply Children