【发布时间】:2017-10-25 11:09:10
【问题描述】:
我正在尝试将我的剑道网格导出到 Excel。它工作正常,除了格式丢失。我认为是因为我使用的是模板。
The Telerik documentation 明确声明:
要在将表格导出到 Excel 期间格式化单元格值,请设置 单元格的格式选项。
这个我试过了,还是不行:
columns: [
{
field: "EntryWage",
headerTemplate: entryLevelWageColumnHeading + "<span name='EntryWage' class='k-icon k-i-close remove' style='float: right;'></span>",
width: 125,
attributes: { style: "text-align:right;" },
format: "{0:c}",
template: "#= (EntryWage != null) ? kendo.toString(EntryWage, 'C') : 'N/A' #"
}];
我也有这个功能(用于excel网格定义):
excelExport: function (e) {
var sheet = e.workbook.sheets[0];
var row = sheet.rows[0];
$("#grid .k-grid-header .k-link").each(function (index) { //for each column header in the grid...
row.cells[index].value = $(this).text(); //set cell text from grid column text
row.cells[index].background = "#0070C0"; //set cell to "blue" color
});
},
我需要在这里解析每个单元格吗?难道我做错了什么?我认为这真的很简单,因为整个导出到 Excel 很简单??
【问题讨论】:
标签: c# jquery kendo-ui kendo-grid