Export To Excel W/ Extra Lines?
Jan 27, 2010
It's been a while since I've posted here, but I do have a vexing question. I have an export to Excel that is working just fine with the exception that I have one blank line at the top of my export and one blank line at the bottom of my export. All paging and sorting are turned off at this point, so I'm really not sure where these empty lines are coming from. They appear above the header row and below the last row of data, almost like there's an invisible line that gets created after the data makes it to Excel.
View 6 Replies
Similar Messages:
Mar 4, 2010
I have a GridView that I want to export to Excel. When I use the sample code I find online, it exports the content to Excel just fine, but for some reason it also clears out all grid lines outside of my exported table.
For your average excel user this is easy enough to fix, but I need this solution to work for everyone.
So then is there a way to export the data in a GridView into an Excel Workbook so that it looks like it was just typed into Excel? I've pasted the code I am using below, assume that a GridView called toPrint exists and has accurate data.
Response.Clear();
Response.AddHeader("content-disposition", "attachment; filename=" + name + "_Registration_Forms.xls");
Response.Charset = "";
Response.ContentType = "application/vnd.ms-excel";
Page.EnableViewState = false;
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
toPrint.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
EDIT: Found one partial solution. If I export as a comma-delimited list and set the header to be a CSV file, it opens fine and all grid lines (even those outside of the exported data) are showing. The only problem with this of course is having to strip out every comma and newline character from my values before exporting them.
View 1 Replies
Dec 4, 2010
When i export crystal report (table formtatted) to excel (using in web app) and see the output than i dont get column and row lines i mean My data comes in table format but without column and row lines. Can anyone pl guide me on this? What should i do to get proper format like present in crystal report.
View 1 Replies
Mar 10, 2014
Is there any way to solve (by coding) if there comes extra columns in excel sheet at the time of downloading.
if (repDS.Tables[0].Rows.Count > 0)
{
Rpt.Load(Server.MapPath(ReportPath));
Rpt.SetDataSource(repDS);
pnlReport.Height = 500;
CrystalReportViewer1.ReportSource = Rpt;
CrystalReportViewer1.DataBind();
}
View 1 Replies
Jul 24, 2010
i have in grid view that grid view have very long string. when i export grid view export in excel it that string shows in single line
View 1 Replies
Apr 27, 2010
I have a web form that contains a GridView, which impliments Search in Grid with a TextBox and Button control in the footer. This works as I have it now. I have also implimented a Export to Excel function. The Export to Excel works by itself if the Search in Grid function is not included in the footer.The Export to Excel function errors when trying to render the Grid for the export. Is there a better way to incorporate both functions and accomplish the same thing? Am I missing something simple?
[Code]...
View 21 Replies
Jun 10, 2010
How can I export data from a Gridview to excel and once exported the data should be formatted in right to left (arabic) manner. How can I achieve this?
View 2 Replies
Nov 2, 2010
I've got an .rdlc report which I print from my .net app (C# Visual Studio 2005), where I use a RemoteReportPrinter object. I give it as parameters the server name, report name, report parameters, etc. Works fine. My question is, I would live to do an analagous export of that report to Excel. Set it up exactly the same, but have it export to Excel rather than print, probably using some other type of object than RemoteReportPrinter.
View 1 Replies
Apr 6, 2014
i use this code to export data into word.
Protected Sub Export(sender As Object, e As EventArgs) Handles btn_printexcel.Click
Response.Clear()
Response.Buffer = True
[Code]....
but the export docs will be downloaded into the user computer.
what should i do so that the exported docs is save into the server?
View 1 Replies
Feb 18, 2011
i want to export multiple tables in a dataset to excel workbook with each tables as sheets without using COM Interop or Excel Object.
View 2 Replies
Sep 22, 2010
We have the requirement to export the data from the grid excel. We can't install the Excel on the server. The excel generated need to be in the printable format. The excel generated needs to have custom headers, footers, repeatble rows, columns and landscape / portrait orientation style.
View 1 Replies
Jan 22, 2010
I am exporting a gridview in MS Excel as mentioned in the following link:
[URL]
I want to set orientation of excel pages as landscape. Is there any way to do that? Any header information to be added for file being exported to set orientation of pages as landscape?
View 2 Replies
Feb 25, 2011
i have table something like this on click of export to excel i need to save that or export that to excel file .can u plz help me how i can do this.one more thing how i can desing and build that big html table into excel is there any simple way i can do the same
View 1 Replies
Sep 22, 2010
We are deveopingawebiste in asp.net. There are tempelates of each aspx page made in the form of excel sheet. Upon completion of the online calculation, the user is to be allowed to export the results to excel and save them. There would be obviously no formulae in such sheet
I do not want to install Excel on theserver and instead want to utilize the Excel installed on the user's computer for this purpose as every user's computer is expected to have Excel installed. Is this possible to do? How to do this?
I am not an expert in this. let me know if you would need any more information or clarification.
View 2 Replies
Jan 21, 2010
In the header text I need to get an output of two lines. The top one in Spanish an the lower one in english. Is there a way to break a line?
[Code]....
View 8 Replies
Jan 29, 2010
i have this website with a gridview and a button that enables to user to export the data from the gridview to excel using this code.
[Code]....
If you would imagine the result of the exported data from gridview (Data Only without any paging...etc...), the intersection of the first Row and First Column is placed in A1 cell of excel to display the table.
what i wish to do is upon exporting i would like to ex. add 2 more rows above the table so that the resulting table intersection of the first row and first column is located in C1 cell.
View 1 Replies
Sep 1, 2010
i have try to export data to excel using gridview.
I have export it successfully but some data is missing which is due to the column format in the exported excel file is not TEXT .
[Code]....
I need to set the exported excel file column format to TEXT but find no solution on this.
View 2 Replies
Jul 7, 2010
we have wriiten code to export the data in xml and excel file. Its working fine with chrome,firefox, & IE 6.BUt i am facing problem with IE 8.
View 4 Replies
Dec 14, 2010
I want to export gridview to Excel and followed the code from the link below but never get it work. [URL] I used the data as below but after exporting, it became 1234567, 2266998,3388445. They are all missing '0'.
MEMBID (varchar(20))
01234567
02266998
03388445
View 6 Replies
Mar 12, 2010
anyone know how to export pdf table to excel using c# and asp.net? if any can you give me a sample code snippet?
View 1 Replies
Jan 9, 2010
I need to export a few (could be just one or more than one) Microsoft Charts to a PDF and Excel. It needs to happen on a button click and the charts should be directly exported to a PDF without getting rendered onto a web page.
Environment used: ASP.NET
View 1 Replies
Feb 12, 2011
I am using the following code to export fields from a database table into excel. What I want to do is be able to write a SQL statement to retrieve fields from multiple tables and export them into excel. This code only allows me to export one table. Also, how can I display a save prompt dialog?
protected void export_Click(object sender, EventArgs e)
{
string sql = null;
string data = null;
string path = save_as.Text;
int i = 0;
int j = 0;
Excel.Application xlApp;
Excel.Workbook xlWorkBook;
Excel.Worksheet xlWorkSheet;
object misValue = System.Reflection.Missing.Value;
xlApp = new Excel.ApplicationClass();
xlWorkBook = xlApp.Workbooks.Add(misValue);
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
//connectionString = "data source=servername;initial catalog=databasename;user id=username;password=password;";
SqlConnection cnn = new SqlConnection(GetConnectionString());
cnn.Open();
sql = "SELECT Story, CreationDate FROM Story";
SqlDataAdapter dscmd = new SqlDataAdapter(sql, cnn);
DataSet ds = new DataSet();
dscmd.Fill(ds);
for (i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
{
for (j = 0; j <= ds.Tables[0].Columns.Count - 1; j++)
{
data = ds.Tables[0].Rows[i].ItemArray[j].ToString();
xlWorkSheet.Cells[i + 1, j + 1] = data;
}
}
xlWorkBook.SaveAs(path+".xls", Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
xlWorkBook.Close(true, misValue, misValue);
xlApp.Quit();
releaseObject(xlWorkSheet);
releaseObject(xlWorkBook);
releaseObject(xlApp);
//MessageBox.Show("Excel file created , you can find the file c:\csharp.net-informations.xls");
}
private void releaseObject(object obj)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
obj = null;
}
catch (Exception ex)
{
obj = null;
//MessageBox.Show("Exception Occured while releasing object " + ex.ToString());
}
finally
{
GC.Collect();
}
}
View 2 Replies
Jan 12, 2010
I am trying to export my repeater to excel and here is my code...
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
string attachment = "attachment; filename=file.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/vnd.ms-excel";
[code]...
View 2 Replies
Nov 18, 2010
I am trying to export data to Excel from ASP.NET. The downloaded file is created on the fly when a link is clicked. The code that I use is something like this:Excel.Application xlApp;Excel.Workbook xlWorkBook;Excel.Worksheet xlWorkSheet; am not exporting from a grid. I have a list of business objects that I want to loop through to export.
View 1 Replies
Jul 30, 2010
I am only using ASP.net 2.0 C#. I am using jqGrid 3.6 version.I know that there is one property excelexport which need to be set true and we have to add one custom button and the on click of that button i have to call jqgrid.excelExport method. but i have to send on complex object to the page how do i send it? I dont want to send the search parameters as query string because my search parameters are going to be too long.
View 2 Replies