使用 C# 我应该如何从 docx 文档中提取标题、副标题和段落

发布于 2024-07-11 19:35:16 字数 236 浏览 6 评论 0原文

使用 C# 我应该如何从 docx 文档中提取标题、副标题和段落。

我正在考虑通过 VSTO 来做到这一点,但确实知道对象模型这个词。 我只熟悉Excel对象模型。

我应该采用 unzip + linq to XML 方法吗?

使用 VSTO,我可以构建一个插件,可用于编辑我要在 docx 之间进行转换的应用程序。

有人有过此类事情的经验吗? 任何线索将不胜感激。

Using C# how should I go about extracting titles subtitles and paragraphs from a docx document.

I am thinking of doing this through VSTO but do know know the word object model. I am only familiar with the Excel object model.

Should I take the unzip + linq to XML approach ?

Using VSTO i could build an addin which could be used to edit the application where I would convert to and from docx.

does anyone have prior experiences with this kind of thing?
any leads will be greatly appreciated.

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

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

发布评论

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

评论(1

雪落纷纷 2024-07-18 19:35:16

就我个人而言,我会采用 unzip + LINQ2XML 方法。 (您可以使用内置支持解压缩
在框架中或者如果您使用的是旧版本,您可以使用 icsharpcode.net 提供的 zip 库

我会采用这种方法,因为对于像这样简单的事情我宁愿不这样做
取决于VSTO。 这样,最终用户甚至不需要安装 Office。
(并且没有其他许可证问题......我不知道详细信息)。

只是我的观点。

Personally I'd take the unzip + LINQ2XML approach. (You can unzip using the built-in support
in the framework or if you are using an old version you can use the zip library provided by icsharpcode.net

I'd take this approach because for something as simple as this I'd rather not
depend on VSTO. This way the end user doesn't even need to have Office installed.
(And there are no other license issues... of which I don't know the details).

Just my opinion.

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