从客户端更新字体设置
Contents
[
Hide
]
本主题讨论了在Aspose.Cells.GridWeb控件的客户端更改字体设置。
Aspose.Cells GridWeb 现在支持从客户端更改字体设置。为此,API 提供了以下函数
- updateCellFontStyle:参数 - r/i/b/ib 分别代表正常/斜体/粗体/斜体和粗体
- updateCellFontSize:参数 - fontname 等,‘System’
- updateCellFontName:参数 - fontsize 等,‘12pt’
- updateCellFontColor:参数 - none/u/l/ul 分别表示无/下划线/删除线/下划线和删除线
- updateCellFontLine:参数 - HTML颜色代码,例如#aa22ee或常用颜色名称如green, red…
- updateCellBackGroundColor:参数 - HTML颜色代码,例如#aa22ee或常用颜色名称如green, red…
以下代码片段演示了在 GridWeb 中在客户端更改字体设置。
示例代码
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
<script> | |
function makeFontItalic(){ | |
gridwebinstance.getByIndex(0).rangeupdate(updateCellFontStyle, "i"); | |
} | |
function makeFontBold(){ | |
gridwebinstance.getByIndex(0).rangeupdate(updateCellFontStyle, "b"); | |
} | |
function changeFontSize(){ | |
gridwebinstance.getByIndex(0).rangeupdate(updateCellFontSize, "5pt"); | |
} | |
function changeFontFamily(){ | |
gridwebinstance.getByIndex(0).rangeupdate(updateCellFontName, "Corbel Light"); | |
} | |
function changeFontColor(){ | |
gridwebinstance.getByIndex(0).rangeupdate(updateCellFontColor, "green"); | |
} | |
function changeFontBackgroundColor(){ | |
gridwebinstance.getByIndex(0).rangeupdate(updateCellBackGroundColor, "yellow"); | |
} | |
</script> |