差异 2 打开 XML Word 文档

发布于 2024-10-03 12:31:32 字数 127 浏览 2 评论 0原文

预先感谢您的任何帮助和帮助。

我试图找到一些实用程序/方向,了解如何最好地比较两个 word docx 文件(原始版本和修改版本)的差异,然后突出显示 c# 中修改版本的更改。

再次非常感谢您提供的任何帮助。

Thanks in advance for any help and assistance.

I'm trying to find some utility / direction on how best to compare two word docx files (Original and modified version) for differences and then to highlight the changes in the modified version in c#.

Again many thanks for any assistance you can provide.

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

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

发布评论

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

评论(6

塔塔猫 2024-10-10 12:31:32

OpenXML SDK 2.0 工具包 附带了一个可以执行此操作的工具。它称为 OpenXMLDiff。您还可以在此处阅读该工具包提供的其他内容:Open XML SDK 2.0 简介

如果这不是您所需要的,那么您将必须仔细检查 Open XML 文档的每个包并确定它们之间的差异。

The OpenXML SDK 2.0 Toolkit comes with a tool that does this. It's called OpenXMLDiff. You can also read about what else the toolkit offers here: An introduction to Open XML SDK 2.0.

If that's not what you need then you're going to have to go through each package of the Open XML documents and determine the differences between them.

蛮可爱 2024-10-10 12:31:32

您可以使用 XMLDiff.exe 实用程序,它是 MS“XML Diff and Patch Tool”的一部分。

请阅读 MSDN 文章“在应用程序中使用 XML 差异和修补工具”。

下载链接:Xmldiffpatch.exe (也在 MSDN 文章的开头)。

You could use XMLDiff.exe utility that is part of the MS 'XML Diff and Patch Tool'.

Read more in MSDN article "Using the XML Diff and Patch Tool in Your Applications".

The download link: Xmldiffpatch.exe (also at the very beginning of the MSDN article).

救星 2024-10-10 12:31:32

docx 文件是重命名的 zip 文件。您可以将其重命名为 .zip 并将其解压。

然而,docx 不是单个文件的 zip。它是一个包含 xml 文件的文件夹层次结构。因此,您可以将其提取出来并编写一个比较实用程序(例如 Beyond Compare)来获取差异。

我不确定你会如何呈现这些差异?您想直观地显示Word文档中的差异吗?例如,第二个文件中缺少此段落等。

A docx file is a renamed zip file. You could rename it to .zip and extract it out.

However the docx is not a zip of a single file.. its a folder hierarchy with xml files in it. So you could extract it out and script a comparing utility like Beyond Compare to get the differences.

I'm not sure how you would present the differences though ? Do you want to visually show the difference in the Word documents? e.g. this paragraph is missing in the second file etc.

感情旳空白 2024-10-10 12:31:32

文档内容是 XML 标记的,并根据保存之间添加/修改/删除的任何选项、更改、强调等进行分解。像添加和删除换行符这样简单的事情可能会导致不同的物理 XML 结构。最终的实际内容不会有任何差异,但 XML 可能会有所不同。

您想要确定的“差异”到底是什么?这将决定您需要对内部结构进行多少解析以及您可以使用哪些技术或工具来识别差异。

The document content is XML-tagged and broken up depending on whatever options, changes, emphasis etc is added/modified/deleted between saves. Something as simple as adding and removing a newline can result in a different physical XML structure. There won't be any difference in the final actual content, but the XML might be different.

What exactly counts as a 'difference' you want to identify? That'll determine how much parsing of the internal structure you need to do and what techniques or tools you can use to identify the differences.

总以为 2024-10-10 12:31:32

我将稍微刷新一下这个主题。目前,“Open XML SDK 2.5 Productivity Tool”可以完成此任务。我发现它在不同的 pptx\docx\xlsx 文件中非常有用。
Open XML SDK 2.5

如果您使用的是 Visual Studio你还应该考虑添加这个插件:
打开 Visual Studio 的 XML 包编辑器
当您快速查看文件或更改某些内容时,它非常有用。

I'll refresh this topic a little. Currently "Open XML SDK 2.5 Productivity Tool" does the thing. I found it very usefull in differing pptx\docx\xlsx files.
Open XML SDK 2.5

If you're using Visual Studio you should also consider adding this plugin:
Open XML Package Editor for Visual Studio.
It's very usefull when you have quickly have a look into file or change something.

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