使用kendo ui导出在excel上为单元文本字段上色

时间:2023-01-30 03:54:08

I am able to color a number cell with the following code

我可以用以下代码给数字单元格上色

cell.format = '[green]$#,###0'

I can't customize a text field though I am using the following format.

我不能自定义文本字段,尽管我正在使用以下格式。

cell.format = '[green]'

1 个解决方案

#1


1  

You are able to use cell.color to set color. Once problem what you can meet is that it not recognize colors as "red", "blue" etc. You have to use hexa entry.

你可以使用cell。设置颜色。一旦你遇到问题,你会发现它不能识别“红色”、“蓝色”等颜色。

row.cells[cellIndex].color = "#582A71";

Dojo example here

Dojo的例子

Anyway, I recommend check this page there is described what kendo workbook can do. If you meet this syntax

无论如何,我推荐检查这一页,这里描述了kendo工作簿可以做什么。如果遇到这种语法

rows: [
    { cells: [ { value: "red", color: "#ff0000" } ] }
]

then in your export function, you can rewrite it to something like this

然后在导出函数中,可以把它重写成这样

cell.value = "red";
cell.color = "#ff0000";

#1


1  

You are able to use cell.color to set color. Once problem what you can meet is that it not recognize colors as "red", "blue" etc. You have to use hexa entry.

你可以使用cell。设置颜色。一旦你遇到问题,你会发现它不能识别“红色”、“蓝色”等颜色。

row.cells[cellIndex].color = "#582A71";

Dojo example here

Dojo的例子

Anyway, I recommend check this page there is described what kendo workbook can do. If you meet this syntax

无论如何,我推荐检查这一页,这里描述了kendo工作簿可以做什么。如果遇到这种语法

rows: [
    { cells: [ { value: "red", color: "#ff0000" } ] }
]

then in your export function, you can rewrite it to something like this

然后在导出函数中,可以把它重写成这样

cell.value = "red";
cell.color = "#ff0000";