create a report from template using C# excel OpenXML API

I've been using Microsoft COM model to prepare reports but it is slow and fails if server does not have excel installed. So I am moving to using OpenXML for creating reports from a server process that does a ton of other things as well.

I've a template that contains named ranges for data that I need to change or extend, named charts, named chart series, named worksheets, etc. All my formatting is contained in excel file and all I do in my server side process is populate the file with data.

These are the steps that I need to replicate using Excel OpenXML:

  • Open an existing sheet and create a new sheet based on it.
  • Get the worksheet by worksheet name
  • Get the Named Ranges in that worksheet.
  • Populate the Named Ranges from data and extend the ranges if required based on data set.
  • Get Chart by Chart Name
  • Get Chart Series by Series Title
  • Set Chart series to the new range
  • Export Chart to jpeg to be used in html.
  • Save new File.
  • Is it possible to do these steps in OpenXML cleanly? Any examples will help me a lot. Or a light weight library that does this. Some of these 3rd party libraries are too big and are more useful in creating new sheets from scratch.

    Any help appreciated.


    AFAIK, with OpenXml you can do anything.

    I recommend a ClosedXml lib, it wraps OpenXML SDK and makes it easier to do your job. Link contains samples and stuff. Hope that helps.

    链接地址: http://www.djcxy.com/p/52340.html

    上一篇: 使用openxml和C#将Excel嵌入到Powerpoint 2007中

    下一篇: 使用C#excel OpenXML API从模板创建报告