原創(chuàng)|其它|編輯:郝浩|2012-06-26 21:36:18.000|閱讀 1658 次
概述:電子表格組件Aspose.Cells提供了設置字體上標和下標效果的功能。開發(fā)人員可以使用Font對象的setEscapement方法實現(xiàn)字體上標效果。而對于字體的下標效果,開發(fā)人員可以則可使用Font對象的setEscapement方法。通過下面的代碼示例,我們一起來看看如何使用Aspose.Cells APIs實現(xiàn)字體的上標和下標效果。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
電子表格組件Aspose.Cells提供了設置字體上標和下標效果的功能。開發(fā)人員可以使用Font對象的setEscapement方法實現(xiàn)字體上標效果。而對于字體的下標效果,開發(fā)人員可以則可使用Font對象的setEscapement方法。
通過下面的代碼示例,我們一起來看看如何使用Aspose.Cells APIs實現(xiàn)字體的上標和下標效果。
設置上標效果:
[Java]
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Accessing the added worksheet in the Excel file
Worksheet worksheet = workbook.getWorksheets().get(0);
Cells cells = worksheet.getCells();
//Adding some value to the "A1" cell
Cell cell = cells.get("A1");
cell.setValue("Hello");
//Setting the font name to "Times New Roman"
Style style = cell.getStyle();
Font font = style.getFont();
font.setSuperscript(true);
cell.setStyle(style);
//Saving the modified Excel file in default format
workbook.save("e:\\excels\\Superscript.xls");
設置下標效果:
[Java]
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Accessing the added worksheet in the Excel file
Worksheet worksheet = workbook.getWorksheets().get(0);
Cells cells = worksheet.getCells();
//Adding some value to the "A1" cell
Cell cell = cells.get("A1");
cell.setValue("Hello");
//Setting the font name to "Times New Roman"
Style style = cell.getStyle();
Font font = style.getFont();
font.setSubscript(true);
cell.setStyle(style);
//Saving the modified Excel file in default format
workbook.save("e:\\excels\\Subscript.xls");
查看Aspose.Cells FAQ://fc6vip.cn/zh-CN/EVQuestions
本站文章除注明轉載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網(wǎng)