C#/Powerpoint 插件 如何将 datagridview 保存到演示文稿中?
所以我一直在研究这个ppt插件。我主要使用标签哈希来保存字符串,到目前为止效果很好;但是,现在我需要将 2D 数组保存到演示文稿中。我选择使用 datagridview 组件并将其放置在新表单中。
一旦用户输入他的数据并且表单准备关闭,我不知道在哪里保存网格。我本质上想稍后将其作为某种二维数组进行访问(可能有更简单的方法来访问此数据);但是,首先我需要以某种方式将其保存到演示文稿中。
powerpoint是否只是序列化整个演示对象并完全保存它?在这种情况下,我可以做类似的事情:
PowerPoint.Presentation preso = Globals.ThisAddIn.Application.ActivePresentation;
preso.myGrid = theGridViewFromTheForm;
或者类似的事情吗?
有想法吗?
So I have been working on this ppt add-in. I have been saving strings mostly using the tags hash and it has worked fine thus far; however, now I need to essentially save a 2D array to the presentation. I chose the use the datagridview component and placed it in a new form.
Once the user inputs his data and the form is ready to close I have no idea where to save the grid. I essentially would like to access it later as a 2D array of some sort (there are probably easier ways to access this data); however, first I need to save it to the presentation some how.
Does powerpoint just serialize the entire presentation object and save it entirely? In this case can I just do something like:
PowerPoint.Presentation preso = Globals.ThisAddIn.Application.ActivePresentation;
preso.myGrid = theGridViewFromTheForm;
Or something along those lines?
Ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我只是使用标签保存了所有内容。我想你可以用其他不那么明显的方式来保存东西。
I simply saved everything using Tags. I suppose you can save things in other ways that aren't so obvious.
datagridview 有两种保存数据的选项。
首先使用序列化类
第二个使用数据表。
第二种解决方案:
以文本形式序列化数据表并将其保存到演示文稿或幻灯片标签中。
There are two option to save data of datagridview.
First using serialize class
second using Datatable.
Second solution:
Serialize your datatable in text and save it into presentation or slide tag.