找回密码
 立即注册

QQ登录

只需一步,快速开始

roger.wang
社区贡献组   /  发表于:2014-5-16 10:49  /   查看:4690  /  回复:0
问题描述:Spread 实现上下标格式。例如:X3
问题解答:RichTextCellType 可以通过RichTextBox 的Rtf 属性赋值,所以任何可以在RichTextBox 实现的样式都可以在单元格中显示。
关键代码:
  1.    RichTextBox rtbsup = newRichTextBox();
  2.             rtbsup.SelectedText = "天然气体积=100m3";
  3.             rtbsup.SelectionStart = 10;
  4.             rtbsup.SelectionLength = 1;
  5.             rtbsup.SelectionCharOffset = 5;   //位移的像素,正数为上移,负数为下移

  6.             FarPoint.Win.Spread.CellType.RichTextCellType rtct = new FarPoint.Win.Spread.CellType.RichTextCellType();
  7.             this.fpSpread1.ActiveSheet.Cells[0, 0].CellType = rtct;
  8.             this.fpSpread1.ActiveSheet.Cells[0, 0].Value = rtbsup.Rtf;
复制代码


效果截图:


示例下载:点击下载

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

0 个回复

您需要登录后才可以回帖 登录 | 立即注册
返回顶部