Web Forms :: Export To PDF Format Is Not Working
Mar 1, 2010
I was trying to export asp.net content to PDF format by setting the content type to "PDF" using following sample code.
MemoryStream theStream= new MemoryStream();
theStream.Write(Encoding.UTF8.GetBytes("Srikanth"),0,"Export to PDF".Length);
byte[] byteArr = (byte[])Array.CreateInstance(typeof(byte), theStream.Length);
theStream.Position = 0;
theStream.Read(byteArr, 0, (int)theStream.Length);
theStream.Close();
Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment; filename=ExportedTo.pdf");
Response.OutputStream.Write(byteArr,0,byteArr.Length);
Response.End();
On opening this PDF attachment i am gettng an error message.
Adobe Reader could not open 'ExportedTo[1].pdf' because it is either not a supported file type or because this file has been damaged(for example, it was sent as an email attachment and wasn't correctly decoded).
Is it that with this approach we can't export asp.net content into PDF. Do i have to use any 3rd party component to export the content into PDF format.
View 1 Replies
Similar Messages:
Apr 27, 2016
When data comes more than 30 Rows in Grid then the Excel goes in different format.There is parsian/Urdu Font in Grid data.
<div id="PrintDiv">
<asp:GridView ID="gvExamReport" ClientIDMode="Static" runat="server" OnDataBound="gvExamReport_DataBound"
HeaderStyle-Height="20" HeaderStyle-HorizontalAlign="Center" OnRowDataBound="gvExamReport_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="مرتبة">
[CODE]..
View 1 Replies
Apr 26, 2010
I want to export the grid data to excel then write the following code but the following lines of code are working at firefox3 but not at ie8(no response).
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.AddHeader("Content-disposition", "attachment;filename=ProjectTimeSheet.xls");
System.Web.HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
string excelFile = "";
excelFile = ConvertToExcel(PrepareGridViewForExport()); //generate formated table for excel
System.Web.HttpContext.Current.Response.Write(excelFile);
System.Web.HttpContext.Current.Response.End();
View 4 Replies
Jun 23, 2010
I want to create a button which exports the grid view contents only (not the menu and the master page) into the CSV format.
View 16 Replies
Mar 12, 2010
I want to Export my gridview to Excel BIFF. Could any one suggest the approaches to do this.
View 2 Replies
Oct 11, 2010
I have a table in sql server 2008 database... i need to take an export of that table using stored procedure.. i need to take the export in .mdb format.. i am using asp .net with c#...
View 3 Replies
Apr 28, 2010
I'm trying to export my data to an Excel file. Here's my code behind:
[Code]....
And here's the GridView control:
[Code]....
The problem I have is that when I exported into Excel, the texts in column two (which is the Lable1 in the Gridview) does not work when applying Wrap Text in MS Excel 2007. I believed that there is something in the btnExcel_Click method causes the texts to appear as ## all the time regardless if I format the cell to Wrap Text. If I copy the cell and pasted into another sheet or cell as "Paste Values" then the texts showed up and wrap text is working. What could I have changed on the code behind so that it appears as plain texts in Excel?
View 5 Replies
Feb 17, 2011
There was a string (1008901023816550000000) in the GridView somehow was saved as a scientific number (1.0089E+21) in Excel when I exported the GridView to Excel.I am using .Net 4.0.Here is what I tried, but they didn't solve the problem:
Added DataFormatString="{0:g}" to the BoundColumn tag.
Set the style after the RenderControl was called.
string style = @" .text { mso-number-format:@; } ";
View 1 Replies
Apr 26, 2010
Using Reporting services in SQL Server 2005 in asp.net with c#, how can we export reports in word document?
View 2 Replies
Apr 26, 2010
I need to be able to export PDF's that I am creating to JPEG, so that users can have a screenshot/thumbnail of the end product, which is faster than opening the whole PDF.
I am running this on an ASP.NET website running in Medium Trust in the Rackspace Mosso Cloud.
I have yet to find a library that will either work in Medium trust, or in the case of ABC PDF, which works great locally, wont load in Mosso. Maybe Mosso has a custom trust level?
I know that iTextSharp works on Mosso, but I haven't been able to figure how to "screenshot" a single page of a PDF, or export a page to JPEG.
View 1 Replies
Jun 9, 2010
i want to export one of my databases to localdrive in mdf format
View 2 Replies
Mar 15, 2010
Iam using the VS 2008 Report Viewer Control in my project . Iam using the Sub reports in many cases. when ever i export such reports containing sub reports to Excel format which is the major client requirement in our project , the exported excel file shows 'Sub Reports within table / Matrix cells are ignored. If not possible in reporting service then is there any other way to get data in excel format?
View 2 Replies
Jan 22, 2010
When I click on the export button and get the pop-up where you choose the export format....when I choose the Crystal Reports format and click ok,the contents of that pop-up window is now the same as the page where I clicked the export button along with an 'Access Denied' message above the tool bar.
If I choose any other export format,this does not happen and I get the expected dialog where I can choose to open or save the export file.It seems to be a permissions issue, but I can't figure out what CR is trying access that it doesn't have permissions for.
View 1 Replies
Sep 7, 2010
I'm exporting data to an excel sheet from the ojects list. The data is exporting to excel sheet well, but I'm unable to see the grid format for the data. The data is looking with out the rows and columns lines.I think I'm missing to set some property or somethnig ehwn exporting.
View 6 Replies
May 7, 2015
I have one problem im exporting my data into excel in that i have one column,after exporting that data to excel now it is taking system date format instead of that i want date format like mm/dd/yyyy
below in my code...
string strBaselineassessmentVisitdate = list[i].BaselineDateOfAssessment.ToString("MM/dd/yyyy");
First I am taking the data from database then im converting that to MM/dd/yyyy forma but still it taking the system date format which I don't want....
View 1 Replies
Feb 1, 2011
I used following code to export data to excel but when on click-1 nothing happens, on click-2 it exports fine.
due to this when user wants to go back by clicking browsers back button he clicks two times to go back. Sometimes after one click the browser back button got diabled.
[Code]....
[Code]....
View 15 Replies
Apr 10, 2010
In our program, we are exporting crystal report (ExportToStream method) in html format and sendind via email body contents.
The email is showing correct format i.e same format as like format showing in crystal report viewer.
But when the user, farwarding the same email to any other person, the format is totally collapsed. All lines are moving up and text parts showing down with out proper alignment.
How to resolve this issue?
View 3 Replies
Apr 6, 2010
datetime.parseexact not working in windows 7. I have set Datetime Format using Control panel also change the Location and English (India) to English(USA)...but still not working...
its perfectly work with WinXP
View 3 Replies
Jan 6, 2010
I have been attempting to find a solution for my phone number formatting problem for 2 hours now and I am not getting any closer. My 10 digit phone number is stored as a varchar(14) without any formatting (just 10 digits).
Here is the code to format the phone number in a gridview:
[Code]....
why the formatting won't work? It just displays the 10 numbers with no formatting.
View 8 Replies
Aug 5, 2010
I have a ListView control that pulls a phone number from a db table. I'd like to format the phone number in the presentation layer to look like (###) ###-####.
The code line currently looks like this. The page displays the phone# but unformatted, i.e. 9999999999.
[Code]....
Based on other posts I've looked at in this forum, I've also tried:
<li>Phone: <%# String.Format("{0:(###) ###-####}", Databinder.Eval (Container.DataItem("Phone"))) %> with no success. In fact, this particular line throws an exception in my application (Input string not in the correct format).
The datatype I'm using in SQL is varchar(15)
The MSDN documentation for the String.Format method hasn't been very helpful thus far.
View 20 Replies
Jun 3, 2010
[Code]....
and i m Binding its DataSource as follows:
[Code]....
But when it shows the graph its XAxis Date Format is not according to my requirement i.e. "MMM-yy" But its showing the format that is stored procedure giving to the DataSource binding of this chart.
View 4 Replies
Feb 9, 2010
I have create my application in .net 3.5 . and in my local pc have iis 5.1 . in local application its working perfectly . and when i m deploy the application then export functionality is not working . only page is refresh at that time. and in my deployment pc have iis 6.0. what i have to do?
View 2 Replies
Aug 10, 2010
I have developed a report in SSRS 2005 and My report uses subReport as well. MY report export functionality to PDF or any other formate works fine when parent report is popualted but when the parent report don't have any record and my user try to export it pdf it generate following error
An error occurred during local report processing.
An internal error occurred on the report server. See the error log for more details.
When i checked the Error log it says Sub report is not found
View 1 Replies
Oct 20, 2010
I am trying to export a file upon button click event. The structure of my app is like this.
UpdatePanel
TabContainer
Tab1
[code]...
View 1 Replies
Dec 12, 2012
I am using the following code for exporting into excel sheet. It works when i run form my visual studio. But when i run from server,excel is not getting generated.
Code:
Session("S_BID_ID") = "SI12110031"
Session("S_SUBBID_ID") = "0"
connStr = ConfigurationManager.ConnectionStrings("LocalSqlServer").ConnectionString
conn = New System.Data.SqlClient.SqlConnection(connStr)
conn.Open()
[Code] ....
View 1 Replies