- Home
- Forum
- ASP.NET Core - EJ 2
- Enable Datatypes on Columns and Cells
Enable Datatypes on Columns and Cells
I had requirement to enable predefined datatypes like Boolean(True,False), Real, Integer and String for particular columns and i also i have custom datatypes like Option list (ex: a,b,c )
So currently i am using syncfusion libraries to generate excel with some headers
Technical Things:
So currently i am using syncfusion libraries to generate excel with some headers
Technical Things:
I am using ExcelEngine class to generate workbook and i have multiple worksheet so i am creating worksheet as below
var worksheet = workbook.Worksheets.Create(dataTable.TableName);
var worksheet = workbook.Worksheets.Create(dataTable.TableName);
worksheet.ImportDataTable(dataTable, true, 1, 1);
Here dataTable is DataTable object which has few columns and rows.
For Example it has column names like (ID, DataBoolean, DataReal, DataInt,DataString, Datalist)
Here dataTable is DataTable object which has few columns and rows.
For Example it has column names like (ID, DataBoolean, DataReal, DataInt,DataString, Datalist)
now if i do the export i will have empty excel with all these column as headers in worksheet. when user tries to fill that sheet he can able to enter free text in all the cells because there is no DataValidation or Datatype was enable to all the columns.
So i need the example how we can enable the datatypes of each column so that user can enter valid values.
Please do let me know if you need more information
So i need the example how we can enable the datatypes of each column so that user can enter valid values.
Please do let me know if you need more information
currently i am trying this but performance is very slow
IDataValidation intvalidation = column.EntireColumn.DataValidation;
intvalidation.DataRange = worksheet.UsedRange;
intvalidation.AllowType = ExcelDataType.Integer;
you can reach out to me on [email protected] or call me on 9492300423
you can reach out to me on [email protected] or call me on 9492300423
SIGN IN To post a reply.
3 Replies
SK
Shamini Kiruba Sobers
Syncfusion Team
March 19, 2020 01:38 PM UTC
Hi Jatin,
Greetings from Syncfusion.
Please find the response for your queries from the below table.
|
Query |
Response |
|
So i need the example how we can enable the datatypes of each column so that user can enter valid values.
|
We have prepared a working sample with few data types (that are supported with data validation) to enable the datatypes of each column, which validates the user input in particular columns and restricts the invalid values. Please find the sample from the following link.
|
|
currently i am trying this but performance is very slow
IDataValidation intvalidation = column.EntireColumn.DataValidation;
intvalidation.DataRange = worksheet.UsedRange;
intvalidation.AllowType = ExcelDataType.Integer;
|
Kindly look into the following link and try the below code to improve performance.
IDataValidation intvalidation = column.EntireColumn.DataValidation;
intvalidation.BeginUpdate();
intvalidation.AllowType = ExcelDataType.Integer;
intvalidation.EndUpdate();
|
Kindly let us know if the provided solution helps.
Regards,
Shamini.
JG
Jatin Gundabathula
March 31, 2020 04:28 AM UTC
Thanks for information we can close this thread.
SK
Shamini Kiruba Sobers
Syncfusion Team
March 31, 2020 10:10 AM UTC
Hi Jatin,
Thanks for the update. We are glad that the provided information helped you.
Regards,
Shamini
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
JG Jatin Gundabathula
- Mar 18, 2020 03:31 PM UTC
- Mar 31, 2020 10:10 AM UTC