Tag: angularjs

从MVC控制器返回excel文件,并在POST请求中从angularJS下载

MVC部分 返回文件(stream,“application / vnd.ms-excel”,file.FileName); 我以上述方式从MVC控制器返回文件。 AngularJS控制器 $scope.ExcelValidate = function () { if ($scope.files && $scope.files.length && $scope.selectedFileType != -1) { busyIndicatorService.showBusy("Uploading data…"); for (var i = 0; i < $scope.files.length; i++) { var file = $scope.files[i]; $scope.file = file.name; Upload.upload({ url: '/MasterExcelImport/ValidateExcelData', fields: { uploadType: $scope.selectedFileType.Key.Key }, file: file }).progress(function (evt) { console.log('percent: ' + […]

使用Angularjs从前端导出excel文件当通过插件js-xlsx编写excel文件时,得到一个不寻常的内容错误

在打开excel文件时,导出为.xlsm格式的文件,出现以上错误 请在控制器中查看下面的代码,写入excel文件 使用js-xls插件的angular度控制器function。 使用两个名为js-xls和filesaver.js的插件作为blob函数 $scope.exportData = function(){ function Workbook() { if(!(this instanceof Workbook)) return new Workbook(); this.SheetNames = []; this.Sheets = {}; } function sheet_from_array_of_arrays(data, opts) { var ws = {}; var range = {s: {c:10000000, r:10000000}, e: {c:0, r:0 }}; for(var R = 0; R != data.length; ++R) { for(var C = 0; C […]

Windows 10浏览器上传 – 错误的mimetype

我有一个上传xls和doc文件通过web浏览器到我的python应用程序的问题。 当使用Win 10 Home 10.0.14393我在后端为xls文件接收application/octet-stream mimetype。 但是当使用Win 10 Home 10.0.15063工作都很好,而mimetype是application/vnd.ms-excel 。 它在Chrome和Firefox上失败(没有testing其他浏览器) 有没有人发现可能导致问题的原因? 有什么方法可以解决吗? 在FE中,我使用ng-file-upload进行file upload处理。 在后端Python 3.6和Ubuntu 16.04

如何将.xls / .xlsx文件中的数据从angularjs保存到mongodb?

我想从.js文件中将.xls / .xlsx文件中的数据保存到mongodb中。 我有一个angularjs前端,一个web服务和mongodb。 我想我可以在angularjs中parsing.xls / .xlsx文件,并为每一行创build一个JSON对象。 Angularjs将使用Web服务将JSON对象发送到后端以保存到mongodb。 我担心的是如果我有很多行,需要很长时间来处理。 另一个select是将file upload到服务器上的特定位置,处理文件,然后保存到mongodb。 有没有更好的方法来实现相同的目标,或者你推荐我提到的选项之一? 任何帮助表示赞赏。 问候, Nilang

下载的本地.xlsx文件无法打开(AngularJS和Javascript)

我创build了一个button来下载位于前端的test-report.xlsx。 具有正确名称的文件将下载,但是,它不会打开。 正常的文件大约是10MB,但通过button下载后的文件大约是6MB。 下载时需要对xlsx文件做些什么吗? 编辑:当点击文件时,我从数字中得到以下错误: "test-report.xlsx” can't be opened right now. Numbers couldn't read the file. 我的代码: <md-button target="_self" href="files/test-report.xlsx" download="test-report.xlsx"> Download Report </md-button>

Angularjs ng-csv出口擅长多列

我试图导出我的表到一个Excel文件,我正在寻找这样的例子: 示例ng-csv HTML <div ng-app="myApp"> <div ng-controller="myCtrl"> <p>Hello, {{name}}!</p> <button ng-csv="testDelim" csv-header="['Field A', 'Field B', 'Field C']" csv-column-order="order" filename="custom.csv">Download CSV</button> </div> JS angular .module('myApp',['ngSanitize', 'ngCsv']) .controller('myCtrl', function($scope){ $scope.name = 'Superhero'; $scope.order = [ 'b', 'a', 'c' ]; $scope.testDelim = [ {a:1, b:2, c:3}, {a:4, b:5, c:6} ]; }); 但是这个和所有的例子在导出Excel时只做一列,就像这样: 而且我要: 是否有任何forms来分开Excel上的列表? 或者其他工具在Angularjs中导出.csv。

如何保持数据过滤和从angular度ui网格sorting和导出?

我正在使用大型数据集的angular度ui网格,现在我能够导出过滤结果的所有分页,当我应用sortingfunction一起,它的作品在视图上,而不是导入的文件,也就是说用户再次需要使用excel进行下载后sorting(这是不方便的)。 我的代码 function exportFilteredData() { $scope.exportDatalist = _.filter($scope.gridApi.grid.rows, (o) => { return o.visible; }); var entities = _.map($scope.exportDatalist, 'entity'); alasql.promise('SELECT * INTO XLSX("Log_Details.xlsx",{headers:true}) FROM ?', [entities]); } 注意:我已经使用了额外的依赖关系 xlsx.js underscore.js alasql.js

将Angular Kendo UI网格导出到Excel

我有一个使用Angular Kendo UI Grid的项目,希望能够将数据导出到Excel文档中。 我已经看了NG网格CSV导出,但它似乎需要使用插入插件选项,但angularKendo UI网格没有这个。 有人能指出我正确的方向吗? 谢谢

我正在用angularjsdevise一个表,并在excel中为每一列提供多文本过滤选项

我正在用AngularJSdevise一个有许多行和列的表格。 我需要为每个列添加一个filterbutton![filterbutton] [1]。 当点击filterbutton时,它应该展开成类似于exce的东西,列出列中的所有元素,并select必要的数据进行过滤。 有没有办法在AngularJS中做到这一点? 任何想法将不胜感激。 非常感谢!

XMLHttpRequest的responseType属性接受多个值

我有一个$ http reponseType取决于URL查询参数的情况。 当output-target = html时,如果我根本没有提到responseType,我可以正确地得到html中的响应。 然而当output-target = xls时,我需要这样做,使其工作并将responseType设置为arraybuffer( 以在Excel中获得响应 ) var blob = new Blob([data],{type:“application / vnd.ms-excel”}); $http({ method: 'GET', url: "https://xyz/abc?output-target=" + $scope.outputTarget, headers: {'Content-Type': 'application/x-www-form-urlencoded', 'Accept': '*/*'}, responseType: arraybuffer //for $scope.outputTarget=xls }) 我需要一些能够接受各种响应types的东西。 如果这个选项不可用,那么这是怎么回事? 我也尝试将函数传递给responseType,但是也没有工作。 responseType: (function () { if($scope.outputTarget === "table/excel;page-mode=flow") { var arraybuffer return arraybuffer; } else {return;} })() responseType文档