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
No Data
Reply
  • 1530
    posted

    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 project
    2) Click Set Format
    3) 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 Open
    5) Observe - The correct format is applied.

     

    Sincerely,
    Teodor
    Software Developer
    Infragistics
    www.infragistics.com/support

    XamSpreadSheetFeatures_Format.zip
Children