找回密码
 立即注册

QQ登录

只需一步,快速开始

lkxtracy

金牌服务用户

12

主题

57

帖子

195

积分

金牌服务用户

积分
195
lkxtracy
金牌服务用户   /  发表于:2018-6-13 18:29  /   查看:2822  /  回复:3
重新编译C:\Program Files (x86)\GrapeCity\Spread.NET 11\Windows Forms\v11.45.20181.0\Samples\Cs\SpreadDesigner代码,加载Excel文件后多选单元格设置字体,报错。
编译环境:
Win7 x64
VS2017

报错Excel文件.xlsx

10.19 KB, 下载次数: 106

3 个回复

倒序浏览
Helen
高级会员   /  发表于:2018-6-14 10:27:30
沙发
您好!
通过对Spread Studio产品的测试,并没有这个问题。该问题应该是SpreadDesigner示例代码的问题。
SpreadDesigner只是示例参考代码,帮助您了解Spread Studio常用功能的写法,不建议您直接用于实际项目开发。
回复 使用道具 举报
lkxtracy
金牌服务用户   /  发表于:2018-6-14 10:54:57
板凳
报错是一个Dispose方法引起的,测试发现,新建的空白表格不会出现错误,Excel导入的表格会出现这个错误。
报错位置.png
回复 使用道具 举报
Helen
高级会员   /  发表于:2018-6-14 14:45:15
地板
lkxtracy 发表于 2018-6-14 10:54
报错是一个Dispose方法引起的,测试发现,新建的空白表格不会出现错误,Excel导入的表格会出现这个错误。

来至研发的回复:
Font object might be used by more than one cell. Even other element (header, conditional format…) may use the Font too.
It’s better not to dispose manually. By design of GDI+’s Font, if it isn’t used by any object, the font will be collected and disposed automatically.
In ChangeFont function, he just remove the following code:
If(hasCellFont)
     cellFont.Dispose();
In case he need to collect memory and release resource, call Gc.Collect(). All unused Font objects will be disposed.
SpreadDesigner并非实际产品,只是示例参考代码,再次建议您不要直接用于实际项目开发。更多SpreadDesigner代码问题,如果不直接影响效果展示,我们不会进行健壮性维护。
谢谢!
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部