One of the program's functions: accessing sql for generating a tabular report in Excel.

Problem in Excel document:

  1. The heading of the table itself has a complex structure of merged cells.

Prompted to use the library NPOI. Is there an example of the implementation of the use of this library, in order to open a template xlsx file and replace some cells in it, in order not to pile up the code for the entire table heading?

The number of rows of the table is constantly increasing; it is not possible to know in advance the height of the table. In the template itself, the columns form some calculations with a final value at the end of the table, i.e. I would not want to shoot them down.

Closed due to the fact that the essence of the question is not clear to the participants of Kromster , aleksandr barakin , D-side , user194374, Streletz 18 Jun '16 at 7:47 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • What does a complex table mean? Not two-dimensional or what? - Monk
  • I agree, not the best wording. Multi-level hat, with elements of cell associations - Garrus_En
  • I would advise to look in the direction of some solution like FastReport - you put on a template, feed a tablet, get a document. Extra layer on the one hand, on the other - no manual hammering of nails. - Monk
  • Is the problem only in the program merging of cells or do you need something else when building a report in an Excel document? - rdorn
  • In fact, Excel can work with templates. They even have their own extension. - Power Stream

1 answer 1

Good day. We had a similar problem on the project, it was necessary to form a bunch of diverse reports in excel just like you had with the formation of complex caps. To solve the problem, we used the NPOI library to solve the problems we had, which may help you too :)