从Office 2007加载项序列化当前的ActiveDocument [英] Serialize current ActiveDocument from office 2007 add-in

查看:75
本文介绍了从Office 2007加载项序列化当前的ActiveDocument的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建VSTO Office 2007加载项.

Im creating a VSTO Office 2007 add-in.

我需要启用它,或者找到一种解决方案,在其中可以使用byte[]而不是硬盘驱动器保存到Web服务.

I need to be enable or find a solution where I can save to a webservice with a byte[] instead of hard drive.

所以, 我通过访问网站并单击URL来打开文档,该单击将给我发送Word文档,然后选择使用MS Word 2007打开".

So, I open the document by going to a website and clicking on a url, that click send me a Word Document, and I select Open using MS Word 2007.

文档打开,如果我检查数据,则:

The document open, and if I check the data I have:

ActiveDocument.Fullname = http://[服务器名称或ip]/[某些iis文件夹]/file.asp?id = 353& type = doc`

ActiveDocument.Fullname = http://[servername or ip]/[some iis folder]/file.asp?id=353&type=doc`

所以我认为这些都在内存中,因为我没有原始文件或临时文件(如果存在).

so I think this is all in memory since I dont have the original file or temp file if exists.

即使打开了文档,磁盘也没有问题. 如何从当前的ActiveDocument生成byte[]?

I have no problem from a disk, even if the document is open. How can I do a byte[] from an current ActiveDocument?

我找到了很多答案,说明无法完成.但是我也有一个客户,有一个旧的加载项,该加载项从当前的ActiveDocument执行byte[].

I have found a lot of answers, that state that it cannot be done. But I also have a customer that have an old add-in that does the byte[] from a current ActiveDocument.

任何人都可以帮助我.

推荐答案

您可以转换 IPersistFile 将打开文档字节的副本保存到本地临时路径,然后读回以发送到您的Web服务.在Office中,如果不先保存到磁盘,则无法从活动文档中读取字节.参见 查看全文

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