溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

如何使用PivotGrid修改導(dǎo)出的Excel文件

發(fā)布時(shí)間:2021-10-12 15:35:35 來(lái)源:億速云 閱讀:107 作者:iii 欄目:編程語(yǔ)言

這篇文章主要講解了“如何使用PivotGrid修改導(dǎo)出的Excel文件”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“如何使用PivotGrid修改導(dǎo)出的Excel文件”吧!

Kendo UI是帶有jQuery、Angular、React和Vue庫(kù)的JavaScript UI組件的最終集合,無(wú)論選擇哪種JavaScript框架,都可以快速構(gòu)建高性能響應(yīng)式Web應(yīng)用程序。通過(guò)可自定義的UI組件,Kendo UI可以創(chuàng)建數(shù)據(jù)豐富的桌面、平板和移動(dòng)Web應(yīng)用程序。通過(guò)響應(yīng)式的布局、強(qiáng)大的數(shù)據(jù)綁定、跨瀏覽器兼容性和即時(shí)使用的主題,Kendo UI將開(kāi)發(fā)時(shí)間加快了50%。

您可以通過(guò)修改生成的Workbook對(duì)象,將不同的樣式和值更改應(yīng)用于導(dǎo)出到Excel的Kendo UI PivtoGrid中。

下面的示例演示如何實(shí)現(xiàn)此操作。

<div id="example">

<button id="export">Export</button>
<div id="pivotgrid"></div>
<script>
$(document).ready(function () {
var pivotgrid = $("#pivotgrid").kendoPivotGrid({
excel: {
fileName: "Kendo UI PivotGrid Export.xlsx",
proxyURL: "//demos.telerik.com/kendo-ui/service/export",
filterable: true
},
excelExport: function(e) {
var sheet = e.workbook.sheets[0];
var rows = sheet.rows;
var rowIdx, colIdx, cells, cell;

for (rowIdx = 0; rowIdx < rows.length; rowIdx++) {
if (rows[rowIdx].type === "data") {
cells = rows[rowIdx].cells;

for (colIdx = sheet.freezePane.colSplit; colIdx < cells.length; colIdx++) {
cell = cells[colIdx];

cell.background = "#aabbcc";
cell.value = kendo.toString(cell.value, "c");
}
}
}
},
dataCellTemplate: $("dataCellTemplate").html(),
filterable: true,
sortable: true,
columnWidth: 200,
height: 580,
dataSource: {
type: "xmla",
columns: [{ name: "[Date].[Calendar]", expand: true }, { name: "[Product].[Category]" } ],
rows: [{ name: "[Geography].[City]" }],
measures: ["[Measures].[Reseller Freight Cost]"],
transport: {
connection: {
catalog: "Adventure Works DW 2008R2",
cube: "Adventure Works"
},
read: "//demos.telerik.com/olap/msmdpump.dll"
},
schema: {
type: "xmla"
},
error: function (e) {
alert("error: " + kendo.stringify(e.errors[0]));
}
}
}).data("kendoPivotGrid");

$("#export").click(function() {
pivotgrid.saveAsExcel();
});
});
</script>
</div>

感謝各位的閱讀,以上就是“如何使用PivotGrid修改導(dǎo)出的Excel文件”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)如何使用PivotGrid修改導(dǎo)出的Excel文件這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI