Data Controls :: Exporting Gridview With Arabic Characters To PDF?
Apr 12, 2013
Reference to your reply to a post at
[URL]
I'm able to export Arabic characters now to PDF. The problem is that the Arabic characters are displayed in "reverse" order like shown in the figure below.
I have arabic text recorded in ntext field inside database. The record looks ok in table rows but while retreiving and displaying on web page it shows something like these characters 1.شÙŠءIs there any solution or I am missing anything. I have tried with different meta tags and character sets,
I want user to enter name in Arabic if the user enter in english it should give Message " Enter Message In Arabic " and same for English if user try to enter in arabic it should give a message "Enter Name in English"Â ...
<asp:TemplateField HeaderText="" meta:resourcekey="PStartTime" ItemStyle-CssClass="cssItemStyle" HeaderStyle-CssClass="cssItemStyle"> Â Â <ItemTemplate> Â Â Â Â Â <asp:Label ID="lblPStartTime" runat="server" Text='<%#Eval("PStartTime")%>'></asp:Label> Â Â </ItemTemplate> Â Â <ItemStyle Width="25%" Height="30px" HorizontalAlign="left" /> </asp:TemplateField>
I am showing the pages in English and Arabic using Local Resources in my website. I want to show Gregorian date time in Gridview  in both English and Arabic Pages(ar-SA). How I will do it,
Steps: 1. Go to the List --> Contact Persons page. 2. Click on the "Export" button to generate .XLS report for the Contact Persons List. 3. Close the .XLS report and navigate to other pages e.g. Contacts List. 4. In the Contacts List, click on "Close" button to REDIRECT back to the "Contact Persons" list page.
Expected: - Page shoud display the Contact Persons List page.
Actual: - A strange page is displayed containing mojibaki characters. See image in this [URL] ....
Here are the codes to generate the excel using an Active report:
Exporting the GridView to various file types. I have got the PDF working great and also want to add Excel. When I use the code I get a message that the file I am trying to open is a different file format from the extension I am trying to open. If i click OK it opens and alls is fine. Trying to get rid of this errors so customers and sales staff doesn't see it. Excel is version 2010.
I have created a nested gridview and want to be able to export the gridview to CSV file. When I export it it also exports all the HTML in the file which I do not want. It is fine if i export it to and XLS file though.
I just wondered if anyone has managed to export to CSV with nested gridviews without the HTML getting exported also.
Here is my code
[Code]....
and here is my gridview
[Code]....
I am setting the datasource for the nested repeater here:
I am exporting GridView to Excel but keep on getting a pop up "The file you are trying to open, 'somefile.xls' is in a different format than specidied by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?When I click "yes" the file opens fine. But why I am getting the pop up at the first place.Also as I have Office 2007 on my machine
Kindly note, the ID. QTy are currently in a gridview and the Label is a label on top of the gridview. I would like to export both the label and the gridview to excel...how can I do this.
This is an ASP.NET 3.5 project being created with VS2008. One page contains a gridview with six columns. One of the columns displays standard, 17 character , Vehicle Identification Numbers (VIN). The VIN numbers display normally when the page is rendered. However, when the gridview is exported to Excel, the VIN numbers change. For example, in the gridview, the VIN might be 12345678912345678But when the gridview exports into Excel, that same VIN becomes 1.23457E+16The value of that Excel cell changes to 12345678912345600, changing the last two digits from 78 to 00. It does this for every VIN in the gridview table.I did some Googling but couldn't find anything specifically on this issue. Has anyone seen it before? Is there a way to format the column in the gridview so that Excel will accept it as literal text? I tried programmatically adding a style called 'text' to that column but that had no effect on the outcome. All of the other columns are behaving normally.
I have boundfiled column inside gridview and made the column as invisible by setting visible="false".
But while exporting the gridview to excel I am getting the Header text alone exported. Wherever the column's visibility is set to false the header text should not be exported. After binding the gridview I have set the column's visiblity to false so it won't export the column values.
The problem is to stop exporting the header text to excel. Let's say column index is 10
I am able to save excel sheet from GridView perfectly. However, I need to add one custom column, which will be URL of a file on sever, I am not allowed to add URLs directly in the table (as per company's development policies). I tried pulling URL from web.config however I am not sure where to add that in the following code
I want to export a gridview data to excel; however, my form contains an update panel. I am getting the error message below. Note: the function works without an update Panel.
RegisterForEventValidation can only be called during Render(); private { Response.ClearContent(); Response.AddHeader( Response.ContentType =
In my Webapplication i am trying to export GridView data into PDF format and the application is working fine.But in the resulted PDF file i'm not getting GridView Headers.
In my gridview,the first 5 columns are filled with the values retrived from database on selecting an item dropdown.The last i.e, 6th column(date) is filled with value given in the textbox.
Now I need to export the gridview rows  to  Excel in which checkbox is checked.But Now With the code i have,Excel is containing the empty date column.Pls correct my code to get the proper filled Excel.
I have a requirement that i need to remove the columns from gridview which are blank but at remove funtion it gives me error so i make that columns visible false now its working fine but at the time of exporting data from gridview to excel it also export that visible= false columns in spredsheet and i don't want that blank or hidden column in my excel sheet
This is the class file im using to export the datagrid to excel sheet.Problem is i cant able to transfer the image from gridview to excel sheet using this code. What are the modifications i can do for the below code to export the image.
public class ExcelReport { # region Export to excel /// /// Function for Export html report to Excel sheet /// /// File name /// Gridview /// public void ExportToExcel(string fileName, GridView gv) { try { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", fileName)); HttpContext.Current.Response.ContentType = "application/ms-excel"; using (StringWriter sw = new StringWriter()) { using (HtmlTextWriter htw = new HtmlTextWriter(sw)) { Table table = new Table(); if (gv.HeaderRow != null) { //gv.HeaderRow.CssClass = "GridviewStyle"; // gv.HeaderRow.Font.Bold = true; PrepareControlForExport(gv.HeaderRow); table.Rows.Add(gv.HeaderRow); } foreach (GridViewRow row in gv.Rows) { //row.CssClass = "GridviewStyle"; // row.BorderColor = System.Drawing.Color.Blue; // row.Height = 20; PrepareControlForExport(row); table.Rows.Add(row); } if (gv.FooterRow != null) { PrepareControlForExport(gv.FooterRow); table.Rows.Add(gv.FooterRow); } table.RenderControl(htw); HttpContext.Current.Response.Write(sw.ToString()); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End(); } } } catch (Exception ex) { throw ex; } } private void PrepareControlForExport(Control control) { for (int i = 0; i < control.Controls.Count; i++) { Control current = control.Controls[i]; if (current is LinkButton) { control.Controls.Remove(current); control.Controls.AddAt(i, new LiteralControl((current as LinkButton).Text)); } else if (current is ImageButton) { control.Controls.Remove(current); control.Controls.AddAt(i, new LiteralControl((current as ImageButton).AlternateText)); } else if (current is....................................
I finally managed to export a gridview to an excel sheet.
Next, how can I remove the column width and alternatingrowstyle color (or all formatting if it is easier) "programatically" before exporting it to excel?
I am trying to export a gridview that is returned from a search form. The gridview also has paging enabled. In order to export the records from all pages in the gridview I had to turn off paging and do a databind, but instead of only exporting the search results it exports all the records in the gridview.
How can I only export the records from the search results, but also the make sure the records on the different pages export also?
With the code i have below i am able to export only one page of gridview to excel. check and modify it once.so that i can import all the pages of gridview to excel at a time with  checked status of checkbox.
protected void btnExporttoExcel_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); dt.Columns.AddRange(new DataColumn[5] { new DataColumn("Presentees"), new DataColumn("StudentName"), new DataColumn("ColgRegisterNum"), new DataColumn("CollegeName"), new DataColumn("Date"), }); foreach (GridViewRow row in gvStdntDetails.Rows)
I want to export my GridView, but also, replace any CheckBox controls that are rendered automatically with T/F fields in the process, with LiteralControls, so that everything is text in Excel.
See my below code. I'm not getting any errors, but the code is just not working. The resulting spreadsheet contains the CheckBox fields anyway.