Spire.DataExport for .NET is a 100% pure data .NET library suit for exporting data into MS Word, Excel, RTF, Access, PDF, XPS, HTML, XML, Text, CSV, DBF, SYLK, SQL Script, DIF, Clipboard, etc.
Tue Jul 11, 2006 9:19 am
hi every body...
i am using asp.net with c# and used sql server as my connection in form load event.. and binded my data to datagrid..
and i want to export my datagrid value to xsl file and i gave it in button click event as like this
{
cellExport1.SaveToFile();
}
here i am unable to save my file to xsl.. and it is displaying an errror "THE FILE NAME CANNOT BE EMPTY"
PLS give me some suggestion regarding this problem...
-
kmdshuaib
-
- Posts: 3
- Joined: Tue Jul 11, 2006 9:02 am
- Location: Chennai
-
Tue Jul 11, 2006 1:35 pm
You need to set FileName property, Adding the following code:
cellExport1.FileName = "test.xls";
If you want to download excel result file.
cellExport1.SaveToHttpResponse("test.xls",Response);
-
DataExport
-
- Posts: 35
- Joined: Thu Jun 29, 2006 2:29 pm
Wed Jul 12, 2006 4:41 am
Dear Sir,
As u told i did giving the FileName and also to download the file i gave but i got the following error
"WorkSheet Sheet 1 with error: Data source (Command) property has not been initialized.. TextExport::SaveToStream,var:"
In the FormLoad event I have given the following code:
string connstring;
connstring ="server=192.168.1.200;DataBase=Northwind;uid=sa;pwd=;";
SqlConnection conn = new SqlConnection(connstring);
SqlDataAdapter da =new SqlDataAdapter("select * from shippers",conn);
DataSet ds =new DataSet();
da.Fill(ds);
DataGrid1.DataSource=ds;
DataGrid1.DataBind();
and in the button click event i gave....
cellExport1.FileName="test.xls";
cellExport1.SaveToHttpResponse("test.xls",Response);
Pls help me out sir i am getting the above error............
-
kmdshuaib
-
- Posts: 3
- Joined: Tue Jul 11, 2006 9:02 am
- Location: Chennai
-
Wed Jul 12, 2006 6:57 am
Add the following code to set export data source.
cellExport1.DataSource = Spire.DataExport.Common.ExportSource.DataTable;
cellExport1.DataTable = ds.Tabls[0];
-
DataExport
-
- Posts: 35
- Joined: Thu Jun 29, 2006 2:29 pm