0

I'm basically inserting information from a dataset into an excel document. We really don't want to use interop services, so my best option is to use the OpenXML SDK.

Basically all I need to do is select a cell based on an id/name/whatever (I would rather not use the standard "A1" format), and then insert something into it. But for the life of me I can't figure out how to obtain a set of cell elements based on an attribute value.

Part 2 of this is I then need to merge certain cells. Which is much easier to do since it involves simply appending a collection of mergecell elements to the mergecells table. But I'm looking to make sure that any cell within a merge range isn't a part of another merged cell range, as this would cause problems.

I feel like this is a REALLY powerful tool, but the lack of documentation and examples makes it a difficult subject to approach.

cDecker32
  • 813
  • 1
  • 10
  • 20

1 Answers1

1

It seems the easiest interface for editing excel documents is the ClosedXML library.

Searching each worksheet for specific cells is a lot easier. You can also search for named ranges.

and it automatically handles cell mergers by deleting any previous merged ranges that conflict with the newest one.

cDecker32
  • 813
  • 1
  • 10
  • 20