找回密码
 立即注册

QQ登录

只需一步,快速开始

iceman

社区贡献组

270

主题

1万

帖子

1万

积分

社区贡献组

积分
19311

活字格认证微信认证勋章元老葡萄

iceman
社区贡献组   /  发表于:2014-4-4 13:56  /   查看:6123  /  回复:2
问题描述: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;
复制代码


源码下载
VS  版本:2010
.NET版本: 2.0
点击下载

效果截图:

本帖子中包含更多资源

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

x

2 个回复

倒序浏览
raymond_lk
注册会员   /  发表于:2017-6-21 11:36:38
沙发
太不合适了。
回复 使用道具 举报
Clark.Pan讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-6-26 17:42:04
板凳
本帖最后由 ClarkPan 于 2017-6-26 17:43 编辑

回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部