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.
Unfortunately, activation email could not send to your email. Please try again.

Specific grids not mapped to original data types

Thread ID:

Created:

Updated:

Platform:

Replies:

129301 Mar 10,2017 06:59 AM Mar 13,2017 08:45 AM Windows Forms 1
loading
Tags: XlsIO
Ajay Shastry
Asked On March 10, 2017 06:59 AM

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

Sridhar Sukumar [Syncfusion]
Replied On March 13, 2017 08:45 AM

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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;