您好,您可以试一下下面的方法,下面的代码执行后将在图表的字体处添加对应字体
- var res = GC.Spread.Sheets.Designer.getResources();
- [
- { value: "微软雅黑", text: "微软雅黑" },
- { value: "黑体", text: "黑体" },
- { value: "新宋体", text: "新宋体" },
- { value: "仿宋", text: "仿宋" },
- { value: "隶书", text: "隶书" },
- { value: "楷体", text: "楷体" },
- ].forEach(function (font) {
- var id = "ff" + (Object.keys(res.ribbon.fontFamilies).length + 1);
- res.ribbon.fontFamilies[id] = { name: font.value, text: font.text };
- })
- GC.Spread.Sheets.Designer.setResources(res);
复制代码 |