export-to-excel

How to prevent css missing when exporting some html to excel file?

Deadly 提交于 2019-12-23 01:58:08
问题 I am exporting an html table to excel file successfully using following code public void exportGridToExcel(Control ctl) { string attachment = "attachment; filename=etrack_excel_export.xls"; HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.AddHeader("content-disposition", attachment); HttpContext.Current.Response.ContentType = "application/ms-excel"; StringWriter stw = new StringWriter(); HtmlTextWriter htextw = new HtmlTextWriter(stw); ctl.RenderControl(htextw);

ASP GridView Refresh after Excel Export not working

前提是你 提交于 2019-12-22 18:46:05
问题 I have a Gridview inside an Ajax UpdatePanel. Inside each GV row I have a checkbox field. The idea is that the user checks the lines they want, and click a button to both update a label in that row as "shipped" and then also export the checked lines to an xls file (csv really). When my codebehind fires it loops through the gridview rows, looks for the checks, updates the database to mark each line and then I use .DataBind() to refresh the grid. This works perfectly and as expected. Now I want

How to export a HTML table to Excel supported by Chrome and IE?

▼魔方 西西 提交于 2019-12-22 13:52:18
问题 On my MVC project I have a HTML table bound with Knockout. I'm trying to Export the table to Excel. I tried on client side with JavaScript: self.exportToExcel = function () { javascript: window.open('data:application/vnd.ms-excel,' + $("#tableToprint").innerHTML()); } OR: var tableToExcel = (function () { var uri = 'data:application/vnd.ms-excel;base64,' , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3

stop Ms Excel auto-formatting numeric strings as numbers

↘锁芯ラ 提交于 2019-12-22 11:26:49
问题 I am exporting a report from MS Access(2003) to Excel (97-2003) output. One of the columns has a character string that is numeric for some rows e.g. "05-0880". When I open the output file in MS Excel the corresponding cell is set to the number -372424 . I assume this is caused by Excel being "clever" and deciding that "05-0808" represents a time value or date of some sort and converting the string to a corresponding numeric value. In my case the data represents product codes and this

download attribute on <a> tag doesn't work in Chrome

柔情痞子 提交于 2019-12-22 10:49:54
问题 As I click the export button, chrome will download a file called "download" whose type is "Document". If I add the extension(.xls) manually, the content of the downloaded file is correct. I wonder how does the download attribute work in such a situation. Here is my code: a = document.createElement("a"); var data_type = 'data:application/vnd.ms-excel,'; var table_div = document.getElementById('table'); var table_html = table_div.outerHTML.replace(/ /g, '%20'); a.download = "excel.xls"; a.href

Read only or Lock the particular cells or rows using open xml sdk

落花浮王杯 提交于 2019-12-22 09:31:54
问题 I am using open xml sdk to export excel. I get the excel file and copying that file to another place and then I'm inserting new rows with the data. I should make that rows as read only (or I've to lock) using open xml sdk.. How to do that ? 回答1: I've referred the following link Excel File Password Protection with Open XML SDK. Here I gave you full code to open the file from directory and insert cells. Here I've inserted only one cell. You can insert as you want. Here I've inserted locked

What's XLSHTML?

亡梦爱人 提交于 2019-12-22 09:15:33
问题 What's XLSHTML? I want to generate, as simply as possible, a file which will open in Excel when a user double-clicks it, and which has some minimal styling. XLS meets my user requirements, but it's not easy to generate. CSV is easy to generate but has no styling. HTML is easy to generate and has styling but won't open in Excel when double-clicked (you can File->Open it but that's not sufficient, and you can save it as .XLS but then the user gets a warning). I see in the file extension

PHPExcel download file

冷暖自知 提交于 2019-12-22 06:11:15
问题 I wanted to download an excel file generated by using PHPExcel. I followed the code from PHPExcel Force Download Issue and to no avail. After I log the data receive, my console only shows full of these symbols �.However, when I change the $objWriter->save('php://output'); to $objWriter->save('filename.xlsx'); then it just download the file to my root folder in my web server without any indication of downloading a file. Below is the code snippet for my php file <?php $con = mysqli_connect(

How to export HTML tables to a single Excel workbook with different sheets?

淺唱寂寞╮ 提交于 2019-12-22 03:24:40
问题 I have the following code which I call on a button click and which helps me pass an html table id and have it downloaded in a single Excel workbook. This works fine, but I want to pass multiple table ids to get the data of different tables in different sheets of the same Excel workbook. I am unable to modify this function to address that issue. Moreover, I want to retain similar kind of formatting and use the customized file name as I have used here. Can anyone help me? Please find my code

Export to Excel doesnt work on IE under SSL (https)

烂漫一生 提交于 2019-12-21 21:22:43
问题 I've been trying to fix something on a secure website (https) which is an Export to Excel button that generates a CSV file. It works on Firefox, Chrome , etc... but not in Internet Explorer. I have changed the headers eliminating the no-cache and also edited the IIS http header configuration setting an expiration date of 1 day. I have no idea of what can be going on and how to solve it. Do you guys have any idea of how to fix this stuff ? I've read so many posts and they're all saying the