Setting the cell type

Hi,

I'm working on a component to fill the fields of a table with arbitrary data. Data must be stored on the server exactly as entered in the cell.  The spreadsheet component seemed an ideal choice for this.

The problem I have is that the component converts the value entered in the cell to a number, if possible, truncating the leading zeros. The data is used as test data for other applications, so it is imperative that if there are leading zeros before a number, they are preserved.

Is it possible to set the data type of the cells to string?


1 Reply

SP Sangeetha Priya Murugan Syncfusion Team September 13, 2022 09:07 AM UTC


Hi Lenart,


Your reported requirement can be achievable in our spreadsheet, by setting the format as text using numberFormat method in beforeDataBound event. For your convenience we have prepared the sample based on our suggestion please find the link below.


Sample Link: https://stackblitz.com/edit/angular-lqzjzw?file=app.component.ts,app.component.html,data.ts


API Link: https://ej2.syncfusion.com/angular/documentation/api/spreadsheet/#numberformat


For more details, please refer the below KB link.


https://www.syncfusion.com/kb/13620/how-to-display-the-custom-datemm-dd-formatted-value-in-text-format


Could you please check the above details and get back to us, if you need any further assistance on this.


Regards,

Sangeetha M


Loader.
Up arrow icon