完整的请求如下:
$.ajax({
url: "${pageContext.request.contextPath}/spread/patternReview/downloadAll",
type: "POST",
data: JSON.stringify(ids),
contentType:"application/json",
dataType: 'binary',
async : false,
success: function(blob){
var excelIO = new GC.Spread.Excel.IO();
zip.createReader(new zip.BlobReader(blob), function(reader) {
reader.getEntries(function(entries) {
for (var i = 0; i < entries.length; i++) {
entries[i].getData(new zip.BlobWriter(), function(jsBlob) {
zip.createReader(new zip.BlobReader(jsBlob), function(jsreader) {
jsreader.getEntries(function(xlsxEntries) {
if (xlsxEntries.length) {
xlsxEntries[0].getData(new zip.TextWriter(), function(json) {
excelIO.save(json, function (xlsxBlob) {
saveAs(xlsxBlob, entries[0].fileName);
}, function (e) {
console.log(e);
});
});
}
});
});
});
}
});
});//zip.createReader
}//success
}); |