如何将spreadbuilder工作簿对象转换为Microsoft interop excel工作簿而不保存文件? [英] How to convert spreadbuilder workbook object to Microsoft interop excel workbook with out saving the file?

查看:103
本文介绍了如何将spreadbuilder工作簿对象转换为Microsoft interop excel工作簿而不保存文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我们有一个用VB.Net编写的windows窗体表示。在应用程序中,我们将数据从数据库导出到Spread Builder工作簿,我们将该工作簿保存在本地驱动器上。现在我不想将工作簿保存在本地驱动器上,我想打开它以便向用户阅读。为此,我想将spreadbuilder类型的工作簿打开到microsoft excel类型。但是我无法转换这个演员。



我得到的错误信息是无法将'DataDynamics.SpreadBuilder.Workbook'类型的对象转换为'Microsoft.Office.Interop.Excel.Workbook' '。



任何人都可以建议我如何将datadynamics.spreadbuilder.workbook类型转换为Excel工作簿类型,或者有没有办法打开spreadbuilder工作簿而不保存?



任何建议都会被贬低。



感谢您的支持。

Hi,

We have a windows forms aplicaition written in VB.Net. In the application, we are exporting data from the database into an Spread Builder Workbook and we are saving that workbook on local drive. Now i don't want to save the workbook on local drive and i want to open it for reading to the user. For this i want to do open the workbook of spreadbuilder type into microsoft excel type. but I am unable to convert this casting.

The error message that i am getting is "Unable to cast object of type 'DataDynamics.SpreadBuilder.Workbook' to type 'Microsoft.Office.Interop.Excel.Workbook'."

Can any one suggest me how to convert the datadynamics.spreadbuilder.workbook type to Excel workbook type or is there a way to open the spreadbuilder workbook without saving?

Any suggestions will be appreaciated.

Thanks for your support.

推荐答案

你真的别无选择,只能保存并重新加载它,除非SpreadBuilder公开了一些方法为你做转换。



你没有投射或将一种对象类型转换为另一种对象类型,因为它们都不在其他的继承链中。



你唯一的另一种方法是写一个转换自己在哪里获取一个对象的属性并将值复制到另一个对象的实例的属性中。当然,你必须考虑到任何儿童对象和这些孩子的孩子。
You really have no choice but to save and reload it, unless SpreadBuilder exposes some method to do the conversion for you.

You have no shot at casting or converting the one object type to the other because neither of them is in the others inheritence chain.

Your only other method is to write a conversion yourself where you take the properties of one object and copy the values into the properties of an instance of the other. You'll, of course, have to take into account any child object and children of those children.


这篇关于如何将spreadbuilder工作簿对象转换为Microsoft interop excel工作簿而不保存文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆