export-to-excel

ASP.NET MVC Excel export file format error

强颜欢笑 提交于 2019-12-19 04:11:35
问题 I am currently writing an ASP.NET MVC 5 controller action to export some data to an Excel file (using some code I found here). It works...mostly. It outputs an Excel file, which I can open, but not before displaying the following error message: "The file format and extension of 'Export.xls' don't match. The file could be corrupted or unsafe. Unless you trust it's source, don't open it. Do you want to open it anyway?" I go on to select "Yes" and then it opens. I can resave it on my machine and

Best way to convert CSV file into XLSX and provide both formats as export for user

人走茶凉 提交于 2019-12-19 03:42:25
问题 I implemented a CSV exporter which works like the following: User triggers CSV export App creates a new background job Job generates CSV using CSV.generate Job saves file on Amazon S3 with paperclip (assign file with StringIO ) User can download CSV after job is done This process works well! Now I need to provide an xlsx export as well I just tried to change the content type for the file to an xlsx format, but I got Content Spoofing errors with paperclip. I am also struggling to set the

Export Html Table to excel and keep css styles

眉间皱痕 提交于 2019-12-18 21:51:30
问题 I'm using excel web queries to export an html table (mvc view) to excel. How do I get it to carry across the css styles? If I set class="redLabel" it doesn't interpret that and make the label red. I have to use inline styles in my table for this to work. Any ideas? 回答1: As far as I know, most Office programs do NOT support included styling, but only inline styling. It's likely that you'll be required to include your styling inline (exporting sucks, almost like mail styling). 回答2: Excel does

Export data from dataset to excel

我的梦境 提交于 2019-12-18 13:33:39
问题 I am trying to export data from dataset to excel and save it directly to a given path without giving me the option to open,save or cancel. 回答1: Using ExcelLibrary this is a one liner ... DataSet myDataSet; ... populate data set ... ExcelLibrary.DataSetHelper.CreateWorkbook("MyExcelFile.xls", myDataSet); See also Create Excel (.XLS and .XLSX) file from C# 回答2: This C# Excel library can also be used to export the dataset. More details about how to export can be found here. ExcelDocument xls =

how to export json data to excel file using javascript?

谁说胖子不能爱 提交于 2019-12-18 12:38:54
问题 I have json data which needs to be exported to an excel sheet. I have tried window.open('data:application/vnd.ms-excel,' + encodeURIComponent( $('#tableId').html())); But this works for html table only. 回答1: $(document).ready(function() { $('button').click(function() { var data = $('#txt').val(); if (data == '') return; JSONToCSVConvertor(data, "Vehicle Report", true); }); }); function JSONToCSVConvertor(JSONData, ReportTitle, ShowLabel) { //If JSONData is not an object then JSON.parse will

ColdFusion (9) mysteriously removes characters 'D' and 'F' after numbers when exporting to Microsoft Excel (2007)

时间秒杀一切 提交于 2019-12-18 08:34:26
问题 Here's some code snippets for an example: theSheet = SpreadsheetNew("Rates","True"); SpreadsheetAddRow(theSheet,"4A,4B,4C,4D,4E,4F,4G,4H,4I,4J"); SpreadsheetAddRow(theSheet,"4K,4L,4M,4N,4O,4P,4Q,4R,4S,4T"); SpreadsheetAddRow(theSheet,"4U,4V,4W,4X,4Y,4Z,4D4,4F4"); and <cfheader name="content-disposition" value="attachment; filename=#GetTickCount()#.xlsx"> <CFHEADER NAME="Expires" VALUE="#now()#"> <cfcontent type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" variable="

Jaspererports iReport: split report into several excel sheets on export

旧时模样 提交于 2019-12-18 07:07:45
问题 I have a report which I created using iReport designer. The report contains 3 datasets and 3 tables, which get filled with data from those datasets. Each table is located in detail band. Our business owner wants these 3 tables to be displayed on 3 different excel sheets upon excel export. I have checked several tutorials and posts, but none of them seems to work for me. Help needed! Thanks in advance! 回答1: add pagebreak after each table, then set property net.sf.jasperreports.export.xls.one

Unit testing classes that use EPPlus

我与影子孤独终老i 提交于 2019-12-18 06:48:29
问题 I am having issues unit testing classes that use EPPlus. In my mind, I have two options. I can mock & inject the HttpPostedFileBase into a method, or I can mock & inject the EPPlus ExcelPackage class. Mocking the HttpPostedFileBase, at least doing a true mock, seems limited. I can mock the basic properties on the file (MIME type, filename, etc), but to mock its InputStream in a way that allows the tests to actually interact with it, seems extremely difficult. The only solution I can come up

Export html table to excel in asp.net MVC2

假如想象 提交于 2019-12-18 05:14:13
问题 Hi am looking for the best way on how export to excel does in ASP.NET MVC Now i got this one from billsternberger.net Export to Excel or CSV from ASP.NET MVC with C# //Export to excel public ActionResult Download() { List<Lookup> lookupList = data,GetLookupList(); var grid = new System.Web.UI.WebControls.GridView(); grid.DataSource = lookupList; grid.DataBind(); Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=YourFileName.xlsx"); Response.ContentType =

Saving results with headers in Sql Server Management Studio

时光怂恿深爱的人放手 提交于 2019-12-17 22:08:44
问题 I am using SQL Server Management Studio. I wish to save the results of a query to an excel file. I choose "save as" and then save to CSV file which I can open in excel. All good except I am missing column headers, any ideas how I get them exported? 回答1: Tools > Options > Query Results > SQL Server > Results to Text (or Grid if you want) > Include columns headers in the result set You might need to close and reopen SSMS after changing this option. On the SQL Editor Toolbar you can select save