参考文献需要使用Open XML从.NET Web应用程序中参考文献、应用程序、Open、XML

2023-09-03 04:16:08 作者:无人伴我共白头

我要放弃与在.NET应用程序Word中的自动化和要尝试使用的Open XML。

I'm about to give up with Word automation from within a .net application and am going to try using Open XML.

看来我需要提及:

using System.IO;
using System.IO.Packaging
using DocumentFormat.OpenXm;l.Packaging;

在一个有点深挖各地,我发现你需要添加一个引用到Windows基本得到System.IO.Packaging程序出现。

After a bit of ferreting around I found you need to add a reference to Windows Base to get System.IO.Packaging to appear.

你有什么需要引用去使用DocumentFormat.OpenXml.Packaging?我找不到它的任何地方。我想你可能需要参考类似Microsoft.Office,但不可用两种。

What do you need to reference to get to use DocumentFormat.OpenXml.Packaging? I can't find it anywhere. I thought you might have to reference something like Microsoft.Office but that is not available either.

推荐答案

在我的最新项目(ASP.NET MVC3)我引用这些:

In my latest project (ASP.NET MVC3) I've referenced these:

DocumentFormat.OpenXML =>从的Open XML SDK WindowsBase 的System.Xml

正如previous的评论,您需要下载并安装Open XML SDK才能看到大会和引用它。

As stated previous in comment, you need to download and install Open XML Sdk in order to see the Assembly and reference it.

PS:看看的Open XML电动工具的项目,这是一个库(我想这是可通过的NuGet),以减轻一点你的工作。

PS: Take a look at Open XML Powertools project, it's a library (I guess it's available via nuget) that will ease a bit your work.