We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Specific grids not mapped to original data types

Hello,

I have an issue with a downloaded excel file. The context is that the data that is filled in the excel file is taken from a database and populated and relevant calculations are done and then it is downloaded. The problem is that specific grids in the excel file which has to be in a number data type are being displayed as general data type. I was successful in setting those grids as a custom data type by inserting the following line of code.  

sheet.Range["B2:C4"].NumberFormat = "#,###,###";

But the problem is that the data is fetched directly from the database and the above line of code would not be feasible as a fix for this issue. So I was wondering whether SyncFusion has a dedicated method to format specific grid data types.

Any help would be greatly appreciated as this feature is important to us. Please do not hesitate to contact me if you need further clarifications.

Kind regards,

Ajay Shastry

1 Reply

SS Sridhar Sukumar Syncfusion Team March 13, 2017 12:45 PM UTC

Hi Ajay, 
 
Thank you for contacting Syncfusion support. 
 
By default, General number format is set to all cell data types (Blank, String, Number, Boolean, Error and Formula) and Microsoft Excel does not change the number format as Number if we set number to a cell. This is the default behavior of Microsoft Excel and XlsIO does the same.

If you want to show the cell with its format as Number, then set the default number format as shown below.
 

Code Example:
 
sheet["B2:C4"].NumberFormat = "0.00"; 
 
Please let us know if you have any concern. 
 
Regards, 
Sridhar S. 


Loader.
Up arrow icon