OpenXML libraries (alternatives to ClosedXML) [closed]

和自甴很熟 提交于 2019-11-29 01:09:33

问题


What are some libraries that extend OpenXML (or add a kind of abstraction layer to OpenXML) similar to ClosedXML?

I'm looking for a commercial or freeware tool with at least 1.0 version.

Thank you in advance.


回答1:


Open-Source: Have you looked at EPPlus?

Slogan: Create advanced Excel 2007/2010 spreadsheets on the server.

License: GNU Library General Public License (LGPL).




回答2:


I've been evaluating EPPlus, ClosedXML, and SpreadsheetLight over the past week. All three are really great libraries that make working with the extremely convoluted OpenXML a breeze. I've decided to go with EPPlus for the following reasons:

  • Initially, I was going to go with ClosedXML. It has great documentation and the object structure made a lot of sense to me. I have some charting requirements though and as of right now, ClosedXML doesn't have any charting functions.

  • Then I stumbled upon SpreadsheetLight which also has good docs and does support some charting. I also like the author's attitude and his commitment to his product. However, the project is built on top of the OpenXML 2.0 SDK, not 2.5, which is a deal breaker for me because I want to have the flexibility to work directly with OpenXML in the event that the library doesn't quite meet my needs. My project is targeting excel 2013 so I want to have the latest SDK to work with. ...Update! See ErrCode's comment below for additional info...

  • Finally, I came across EPPlus which has okay documentation and supports charting. It is has been downloaded far more times than the other two which gives me some security in knowing that others are using it and the community seems to be active around the project. They are also currently on beta 2 of version 4 which sounds promising from what others are saying. I'm also getting the gist that EPPlus has good performance (not that the others are necessarily bad) and the upcoming version 4 seems to be improving on that further.


Update

Another very useful feature I've found included with EPPlus is how it exposes the XML for the various parts of the worksheet. If there's a feature that is not supported by EPPlus, you can still edit the XML (in some cases) to get the desired output. For example, if you have a pivot chart and want to enable multi-level labels, you can do the following:

    private void EnableMultiLevelLabels(ExcelChart chart)
    {   
        var element = chart.ChartXml.GetElementsByTagName("c:catAx")[0];
        if (element == null)
            return;

        var multiLevelLabelNode = element.AppendChildElementNode("c:noMultiLvlLbl");
        if (multiLevelLabelNode != null)
            multiLevelLabelNode.AppendNodeAttribute("val", "0");
    }



回答3:


SpreadsheetLight, and it runs internally on Open XML SDK. MIT License. Disclaimer: I wrote SpreadsheetLight.



来源:https://stackoverflow.com/questions/10501528/openxml-libraries-alternatives-to-closedxml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!