Specify alphabets for first column and last column in importWorkSheet.ExportDataTable
Hi,
I want to export data from the excel to datatable.
I am using
IWorksheet importWorkSheet = importWorkBook.Worksheets[0];
dtExcelImport = importWorkSheet.ExportDataTable(firstRow, firstColumn, firstRow, lastColumn, ExcelExportDataTableOptions.ComputedFormulaValues);
I want to specify the alphabets for the first column and last column(lets say from A - AA).
But importWorkSheet.ExportDataTable() takes int.
How can I do this..?
Thanks and Regards,
Prathima
SIGN IN To post a reply.
5 Replies
AD
Administrator
Syncfusion Team
November 29, 2005 06:23 AM UTC
Hi Prathima,
The Sheet.ExportDataTable() method takes the rows and columns as integers.
I herewith attach a Sample for your reference:
exportdatatable.zip
Please take a look and let me know if you have any questions.
Thanks for your interest with Syncfusion products.
Best Regards,
Seetha
>Hi,
>
>I want to export data from the excel to datatable.
>
>I am using
>IWorksheet importWorkSheet = importWorkBook.Worksheets[0];
>dtExcelImport = importWorkSheet.ExportDataTable(firstRow, firstColumn, firstRow, lastColumn, ExcelExportDataTableOptions.ComputedFormulaValues);
>
>I want to specify the alphabets for the first column and last column(lets say from A - AA).
>But importWorkSheet.ExportDataTable() takes int.
>How can I do this..?
>
>Thanks and Regards,
>Prathima
AD
Administrator
Syncfusion Team
November 29, 2005 06:33 AM UTC
Hi Prathima,
Sorry for the inconvenience caused.
Here is the correct link:
exportdatatable.zip
Best Regards,
Seetha
>Hi,
>
>I want to export data from the excel to datatable.
>
>I am using
>IWorksheet importWorkSheet = importWorkBook.Worksheets[0];
>dtExcelImport = importWorkSheet.ExportDataTable(firstRow, firstColumn, firstRow, lastColumn, ExcelExportDataTableOptions.ComputedFormulaValues);
>
>I want to specify the alphabets for the first column and last column(lets say from A - AA).
>But importWorkSheet.ExportDataTable() takes int.
>How can I do this..?
>
>Thanks and Regards,
>Prathima
PV
Prathima Venkobachar
November 29, 2005 12:31 PM UTC
Hi Seetha,
Thanks for the reply.
Example is understanding.
I have a requirement, where in I have to specify the - first row,first column, max rows , max column where in the users specify in alphabets first column and last column(i.e. from A - AA).
in your example, it takes only the first column["A"](if I understood correctly):
// Another way to specify
DataTable customersTable = sheet.ExportDataTable(sheet.Range["A"],ExcelExportDataTableOptions.ComputedFormulaValues);
How can I handle this type of situation.
Thanks,
Prathima
>Hi Prathima,
>
>Sorry for the inconvenience caused.
>
>Here is the correct link:
>
>exportdatatable.zip
>
>Best Regards,
>Seetha
>
>
>>Hi,
>>
>>I want to export data from the excel to datatable.
>>
>>I am using
>>IWorksheet importWorkSheet = importWorkBook.Worksheets[0];
>>dtExcelImport = importWorkSheet.ExportDataTable(firstRow, firstColumn, firstRow, lastColumn, ExcelExportDataTableOptions.ComputedFormulaValues);
>>
>>I want to specify the alphabets for the first column and last column(lets say from A - AA).
>>But importWorkSheet.ExportDataTable() takes int.
>>How can I do this..?
>>
>>Thanks and Regards,
>>Prathima
AD
Administrator
Syncfusion Team
November 30, 2005 05:59 AM UTC
Hi Prathima,
I herewith attach a workaround for your requirement:
datatable632689457583139522.zip
Please take a look and let me know if you have any questions.
Thanks for your interest with Syncfusion products.
Best Regards,
Seetha
>Hi Seetha,
>
>Thanks for the reply.
>Example is understanding.
>I have a requirement, where in I have to specify the - first row,first column, max rows , max column where in the users specify in alphabets first column and last column(i.e. from A - AA).
>
>in your example, it takes only the first column["A"](if I understood correctly):
>
>// Another way to specify
>DataTable customersTable = sheet.ExportDataTable(sheet.Range["A"],ExcelExportDataTableOptions.ComputedFormulaValues);
>
>How can I handle this type of situation.
>
>Thanks,
>Prathima
>
>
>
>>Hi Prathima,
>>
>>Sorry for the inconvenience caused.
>>
>>Here is the correct link:
>>
>>exportdatatable.zip
>>
>>Best Regards,
>>Seetha
>>
>>
>>>Hi,
>>>
>>>I want to export data from the excel to datatable.
>>>
>>>I am using
>>>IWorksheet importWorkSheet = importWorkBook.Worksheets[0];
>>>dtExcelImport = importWorkSheet.ExportDataTable(firstRow, firstColumn, firstRow, lastColumn, ExcelExportDataTableOptions.ComputedFormulaValues);
>>>
>>>I want to specify the alphabets for the first column and last column(lets say from A - AA).
>>>But importWorkSheet.ExportDataTable() takes int.
>>>How can I do this..?
>>>
>>>Thanks and Regards,
>>>Prathima
AD
Administrator
Syncfusion Team
November 30, 2005 12:26 PM UTC
Hi Prathima,
There is no direct way to do this but here is some code sample that might help
string addFrom = this.textBox1.Text + "1";
IRange rngFrom = sheet.Range[addFrom];
int startCol = rngFrom.Column;
string addTo = this.textBox2.Text + "1";
IRange rngTo = sheet.Range[addTo];
int endCol = rngTo.Column;
DataTable dt = sheet.ExportDataTable(1,startCol,sheet.UsedRange.End.Row,endCol,ExcelExportDataTableOptions.None);
this.dataGrid1.DataSource = dt;
Here is the modified sample
DataTable.zip
We will also add an overload to the ExportDataTable method that would take the column Alphabet.
Please let me know if you have any questions.
Thanks,
Stephen.
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
PV Prathima Venkobachar
- Nov 28, 2005 12:14 PM UTC
- Nov 30, 2005 12:26 PM UTC