编辑Word文档
是否可以在 SharePoint 上托管的 Word 文档中编辑和插入条目?
我需要根据最后一次对文档进行更改的人填写审阅者表格。
我知道我会使用事件接收器来执行此操作,但如何与 Word 文档交互交互?
Is it possible to edit and insert entries in a word document that is hosted on SharePoint?
I need to fill in a reviewer's table based on who made the last change to the document.
I know I would use an event receiver to do this, but how do I interact with the word document interactively?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您希望使用 SPListItem 的 CreatedBy 或 ModifiedBy 值以及 OpenXml API 来执行此操作,这样您就不必使用 WSS/MOSS 服务器上的 Word 对象模型。
要获取用户信息,您需要这样做。
有了作者后,要更新 Word 文档,可以参考此 SharePoint 和 OpenXml wiki 页面以获取一些帮助。 这是基于 Eric White 的博客(和其他人)使用 Open Xml。 我强烈建议您阅读他的博客并查看 PowerTools for OpenXml Codeplex 项目,以获取一些肯定会的代码乐于助人。
另请参阅 OpenXmlDeveloper 和 打开 XML 开发人员门户 了解更多信息
希望这会有所帮助。
You want to use the an SPListItem's CreatedBy or ModifiedBy values and the OpenXml API to do this so you do not have to use the Word Object Model on the WSS/MOSS Server.
To obtain the user information, you'll want to to something like this.
Once you have the author, to update the Word document, you can refer to this SharePoint and OpenXml wiki page for some assistance. This is based on Eric White's blog (and others) with Open Xml. I highly suggest you read his blog and look at the PowerTools for OpenXml Codeplex project for some code that will definitely be helpful.
Also see OpenXmlDeveloper and Open XML Developer portal for more information
Hope this helps.
您可以使用 SPDocumentLibrary 类和方法GetItemsInFolder 返回 SPListItemCollection。
从那里,您可以将项目转换为 Word 对象,并通过 单词对象模型
You can use the SPDocumentLibrary class and the method GetItemsInFolder to return a SPListItemCollection.
From there you can cast an item to a Word object and manipulate it through the word object model