使用户能够在 .NET 应用程序中编辑 Word 97-2010 文档

发布于 2024-10-09 02:28:21 字数 971 浏览 0 评论 0原文

我想知道是否有人知道任何产品/方法可以使我的最终用户能够在我们的 C#/.NET 应用程序中编辑 Word 文档,从而避免使用自动化和在应用程序外部打开 Word 的单独实例。这是一种可能性[备份计划!] - 但我宁愿不必实施(由于涉及的工作量以及让用户退出我们的应用程序)。

我知道我可能会使用 WebBrowser 控件 - 但从我所能找到的情况来看 - 对此的支持充其量是粗略的,并且工具栏之类的东西不存在,并且它似乎不适用于 Word 2010反正。

我一直在评估一些声称可以做到这一点的产品,但许多产品缺乏功能或在文档中产生兼容性错误,导致它们在 Word 中打开时毫无用处。

我们使用 Word 2003 和 Word 2010。我们的文档通过自定义合并/模板化流程以 .DOCX 文件开始。

任何有关产品或其他想法的建议都会很棒。

  • 编辑: 我们使用 OpenXML 创建文档没有任何问题。有趣的东西,效果真的很好。然而,归根结底,我更希望用户直接在我们的 .NET 应用程序中编辑创建的文档以及遗留文档(创建为 .DOC 文件)。不幸的是,随着 Microsoft 取消了通过 ActiveX/OLE 等嵌入的功能,没有办法做到这一点。我正在寻找实现这一目标的第三方产品,它应该与 .DOC 和 .DOCX 格式几乎 100% 兼容。

对于那些问为什么的人?安全性、易用性等。我们将文档存储在数据库中。一旦我开始将文件拖放到文件系统上并使用自动化支持/宏,...需要做很多事情才能将文件返回到数据库/更新等。这变得特别困难,因为 Word不公开文档的原始字节[],并且文件必须保存为文件系统上某处的临时文件。只是很头疼。

因此,“最简单”的解决方案 - 嵌入 Word [似乎不可能] 或使用支持编辑 .DOC/.DOCX 文件的第三方产品。

一个例子是 DevExpress XtraRichEdit 控件 - 不幸的是,虽然它支持许多不错的类似 Word/兼容的功能,但它只适用于 .DOCX 文件..并且与 Word 相比,它并不是 100% 功能完整。

I was wondering if anyone has any idea of any product/method to give my end users the ability to edit Word documents within our C#/.NET application, avoiding the use of Automation and separate instances of Word opening outside of the application. This is a possibility [backup plan!] - but one that I'd rather not have to implement (due to the amount of work involved and having users exit our application).

I know that I could possibly use the WebBrowser control - but from what I've been able to find -- support for this is sketchy at best, and things such as toolbars are not present, and it does not appear to work with Word 2010 anyway.

I've been evaluating a few products that claim to do this but many are lacking in features or produce compatibility errors within documents rendering them useless when opened in Word.

We are using Word 2003 and Word 2010. Our documents start out as .DOCX files through our custom merge/templating processes.

Any suggestions for products or other ideas would be great.

  • Edit:
    We're creating documents without issue using OpenXML. Fun stuff, works really well. However, at the end of the day I would prefer to have users editing the created documents as well as legacy documents (created as .DOC files) within our .NET application directly. Unforunately, with Microsoft removing the ability to embed via ActiveX/OLE, etc. there isn't a way to do this. What I am looking for is a 3rd party product to achieve this, which should be virtually 100% compatible with both the .DOC and .DOCX formats.

For those asking why ? Security, ease of use, etc. We are storing documents in a database. Once I start dropping files on the filesystem and working with Automation support/macros, ... there's a lot of things that would have to be done to get the files back into the database / update, etc. This is made especially difficult since Word doesn't expose the raw bytes[] of a document and files must be saved as temporary files somewhere on the fs. Just a lot of headaches.

So, the "easiest" solution - embed Word [seems not possible] or use a 3rd party product that supports editing .DOC/.DOCX files.

An example is DevExpress XtraRichEdit control - unfortunately, while it supports a lot of nice Word-like/compatible features it only works with .DOCX files.. and isn't 100% feature complete, compared to Word.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

清音悠歌 2024-10-16 02:28:21

Word 文档的文件结构非常庞大,即使对有限的 .doc/docx 支持进行编程也可能需要数百个工时。使用你的程序编辑word文件而不是word本身的原因到底是什么?

我不太确定 Word 2003 如何支持 .docx,但我的理解是,当 Office 2007 发布时,只有一个 Word 查看器版本,当然,这个问题已经存在多年了。

如果您实际上打算执行此操作,则只需添加对 .doc 文件的支持,因为那里有更多信息,您可以根据需要允许 word 本身处理到 .docx 文件的转换。

The file structure of a word document is huge, it could take hundreds of man hours to program even limited .doc/docx support. What exactly is the reason for using your program to edit a word file over word itself?

I am not exactly sure how Word 2003 has .docx support though, my understanding is there was only a word viewer release when Office 2007 was released, it of course has been years since thats been a problem.

If you are going to actually do this only add support for .doc files since there is more information out there, you can allow word itself to handle the converstion to a .docx file if you want.

不必了 2024-10-16 02:28:21

您不会找到可以做到这一点的第三方产品。构建一个 100% 支持 Word 格式的应用程序所需的工作量是无法想象的。不仅每个功能,而且每个错误都必须被复制。考虑到这样做可能存在的法律陷阱,任何头脑正常的人都不会费心去尝试。顺便说一句,法律方面是采用新格式的主要原因之一。

这意味着你必须走出去。这里有两个非常好的选择。

一种方法是连接到 Office Live,让他们能够在线编辑 Microsoft 文档。

另一种可能性是在您的应用程序中利用 Sharepoint。它具有内置的文档工作流程方法,并与 Office 完美集成。

第三种可能性是编写您自己的 Word 插件,它将负责保存/加载系统中的文档。在走这条路之前,我会选择上面的前两个。

You are not going to find a third party product that does this. The amount of effort required to build an app that 100% supports the Word formats is beyond consideration. Not just every feature, but every bug as well would have to be duplicated. Considering the potential legal pitfalls of doing such, no one in their right mind would bother trying. The legal aspects, incidentally, is one of the primary reasons for the new formats.

Which means you have to go external. There are two really good options here.

One would be to hook into Office Live to give them the ability to edit Microsoft Documents online.

Another possibility is to just leverage Sharepoint in your application. It has built in methods for document workflow and integrates nicely with Office.

A third possibility would be to write your own word add-in which would take care of saving / loading the documents from your system. I'd go with the first two above before going this route.

满地尘埃落定 2024-10-16 02:28:21

这过去是通过称为 OLE 嵌入的功能来支持的。过去 10 年来,微软软件和工具对它的支持逐渐消失。值得注意的是.NET 不支持它。 Office 是最后坚持抵制的公司之一,2007 年它已经变得相当暴躁。但这在 2010 年版中看起来确实完全是奇闻趣事。 DSOFramer 控件(一种通用 ActiveX 嵌入控件)的所有下载链接在 2010 年进入测试版时被删除。

这里没有未来,看VSTO前面的路。

This used to be supported through a feature called OLE Embedding. Support for it has been disappearing from Microsoft software and tools over the past 10 years. Notably .NET has no support for it whatsoever. Office was one of the last hold-outs with 2007 already getting pretty cranky about it. But this indeed looks to be completely gonzo in the 2010 edition. All download links to the DSOFramer control, a generic ActiveX embedding control were removed around the time that 2010 went into beta.

There's no future here, look at VSTO for the road ahead.

原野 2024-10-16 02:28:21

当然不是 100% 覆盖 Word 功能,但是您尝试过 ASPOSE.Words.NET 总计还是 TXTextControl.NET

Certainly not 100% coverage of Word features, but have you tried ASPOSE.Words.NET Total or TXTextControl.NET?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文