|
hi,
i dont how to code for export the datagrid contents to excel sheet bcoz on click of printer button in one user control it should get the data from datagrid which is in another user control but both user control is in same aspx page, i know to do in normal aspx page on click of a button but i have no idea how to do with different user control, can anyone help me, its urgent
|
|
|
|
|
|
|
Hi,
if you want non-GUI Excel C# / VB.NET component, I recommend that you try GemBox.Spreadsheet.
Here is an Excel C# sample how easy it is to import Excel to DataSet:
var ef = new ExcelFile();
foreach (DataTable dataTable in dataSet.Tables)
ef.Worksheets.Add(dataTable.TableName).InsertDataTable(dataTable, 0, 0, true);
ef.SaveXls(dataSet.DataSetName + ".xls");
|
|
|
|
|
thanks for this article ..what im working is to convert excel data into a dataset so that this dataset could somhow be given to the sql server reports
so my question is where do i find the dataset ? as soon as i click on export nothin seems to happen ... neeed guidance here please!
|
|
|
|
|
ok the exe u provided does the job well but when i made a new proj and added the source code as existin i could not see the exported dataset shown , sorry for that, but is there a away i can access this dataset programmatically??
|
|
|
|
|
Hi All,
I Created following code for Importing data from excel sheet which get data for excel sheet to dataset . But it consider the column datatype same as in Excel sheet column datatype , but i want to set all datatype as a varchar(string) . how can do it . Can any one help me
Dim cSheetName As String = Trim(txtSheetName.Text)
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & cFile & ";" & _
"Extended Properties=""Excel 8.0;"""
Dim myData As New OleDbDataAdapter("SELECT * FROM [" & cSheetName & "$]", strConn)
myData.TableMappings.Add("ExcelInfo", "ExcelInfo")
Try
myData.Fill(myDataSet)
Catch ex As Exception
end try
Thanks for Your time
|
|
|
|
|
is there any way i can upload updated code, i tweaked it so it can now also read csv and tab delimited files. great starting point though
|
|
|
|
|
Hi There,
I desperately require to have this functionality, can you be kind enough to post it anywhere please?
Peter
|
|
|
|
|
hi, This is Adeel., The code is absolutely perfect and it get the schema for most of the excel file, but there is one problem that it wont get OLEDB Schema if the Files o Excel version is 5.0. What I mean is that if i call:
===================================
GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "Table"}
===================================
This function wont return me anything. Hence I get an error while reading the old version. But if i reloads those file in MSExcel2000 and Save them again then this function works. So is there any good suggesstion, I have thousand of excel file in old version. Thanks in Advance... I hope you get my problem..
|
|
|
|
|
hi ,
If somebody know how to impoet Excel file data in c# application pls tell me.
Regards,
Jay
|
|
|
|
|
Use Microsoft.Office.Interop.Excel
looking for this namespace ... u'll find many helps
|
|
|
|
|
Actually i want to display some data online with my registered users by uploading excel datasheet.
with individual row and column.
if somebody know how to do this please reply.
|
|
|
|
|
You could also use ExcelLite Free .NET component (http://www.gemboxsoftware.com/ExcelLiteFree.htm). It is a free solution for reading, writing, modifying and converting XLS and CSV files. Free version is limited to 150 rows per worksheet, which should be enough for a 3-4 page table.
|
|
|
|
|
|
Can you tell me how can I set the dataset to Excel?
|
|
|
|
|
you can ask me!
tirin@sohu.com
|
|
|
|
|
your c# works great! i try to run the exe file and i was interest on the code. too bad i only purchase vb.net standard edition 2003. and i can read c# project file..
i need to develop a similar program. but in vb.net. do u can another version in vb.net?
regards
nkl
|
|
|
|
|
When a text column is exported to the dataset gets truncated to 255 chars max.
|
|
|
|
|
I found it to be a limitation of 8217 characters for one column, not 255. I think it is something to do with OLEDB because if I import the same spreadsheet into MS Access using the MS Acces file import feature, MS Access also truncates it to 8217 characters.
www.timelineforum.com
|
|
|
|
|
Hi,
if you have a string field in the excel sheet and there is a numeric contect in some of the entries, they will be loaded as null
is there a solution for this?
Thanks,
DaberElay.
|
|
|
|
|
FYI,
a small search i made through the microsoft's managed forums, retrieved that the "IMEX=1" extended property must be specified in the connection string in order for the ole to read these numeric column values as strings.
I'm sure many has stumped upon this as well.
cheers,
DaberElay
|
|
|
|
|
I have tried to implement IMEX=1 in connection string of OLE
sometimes it works
but if I used to have it, in excel sheet while importing it shows NULL values wherever the green pointer on the values showing in excel
plz light up on it, & if possible provide me some solution for it ASAP
regards
Vinay
Vinay Kamal
Software Engineer
Coral Telecom Ltd
C-28, Sec-7 Noida
|
|
|
|
|
Hi Vinay,
Those green pointers simply show that the excel treats this column as a certain data type, but believes that the actual cell value is of a different data type...
for a complete explenation of how things work see my comment in another article about excel here at codeproject:
search for my comments here
bon chance,
DaberElay
www.intlock.com
|
|
|
|
|
Dear bon
Thanks for your response. I already had studied your another article & processed that excel importing utility. But the NULL specification is remain same
I had put on IMEX = 1 in connection string but no difference. Is there anything serious in the excel sheet's fields' properties
Plz mention any other help for it
best regards
Vinay Kamal
Software Engineer
Coral Telecom Ltd
C-28, Sec-7 Noida
|
|
|
|