Spread Studio .NET 7: 实现上下标注格式

发布时间:2013/05/30 00:05 发布者:iceman

返回博客中心

论坛中有许多用户询问,Spread 能否实现上下标格式。例如:X3

Spread Winform 实现方法:

RichTextBox rtb = new RichTextBox(); 
rtb.Text = "e=mc2"; 
rtb.SelectionStart = 4; 
rtb.SelectionLength = 1; 
rtb.SelectionCharOffset = Font.Height / 2; 
rtb.SelectedText = "2"; 

fpSpread1.ActiveSheet.Cells[0, 0].Renderer = new FarPoint.Win.Spread.CellType.RichTextCellType(); 
fpSpread1.ActiveSheet.Cells[0, 0].Value = rtb.Rtf;

 

效果图:

image

Spread ASP.NET 实现方法:

protected void Page_Load(object sender, EventArgs e) 
{ 
if (IsPostBack) 
{ 
return; 
} 
FpSpread1.EncodeValue = false; 
FpSpread1.ActiveSheetView.Cells[0, 0].Text = "H<sub>2</sub>0 - Water"; 
FpSpread1.ActiveSheetView.Cells[1, 0].Text = "H<sup>2</sup>0 - Water"; 

}

 

效果图:

image


关于葡萄城

赋能开发者!葡萄城是专业的集开发工具、商业智能解决方案、低代码开发平台于一身的软件和服务提供商,为超过 75% 的全球财富 500 强企业提供服务。葡萄城专注控件软件领域30年,希望通过模块化的开发控件、灵活的低代码应用开发平台等一系列开发工具、解决方案和服务,帮助开发者快速响应复杂多变的业务需求,最大程度地发挥开发者的才智和潜能,让开发者的 IT 人生更从容更美好。

了解详情,请访问葡萄城官网