Quantcast
Channel: NPOI
Viewing all articles
Browse latest Browse all 1621

New Post: Importing a DataTable into xlsx using a template for formatting and column selection

$
0
0
Hi, I've used a commercial library before to create xlsx files and one feature I liked was the ability to create an xlsx file as a 'template' and then load one or more DataTables into it. I'd love to be able to do this with NPOI.

With that library, the template xlsx file was a normal xlsx file with whatever formatting and layout you like, and where the data should go you would put placeholders like '{{DataTableName.ColumnName}}' that would at runtime be replaced with the appropriate value from the datatable. New rows would be added to the file for each new row in the datatable. This means the template could be changed without changing any code. e.g. if you decide you want a different order of columns, different formatting, an extra 'readme' sheet that's copied from the template through to the output, etc, then you can do so without changing any code. Or even better you can give that task to someone else that doesn't know how the code works and only needs to understand the templating system.

I don't see anything like this in the NPOI or APOI documentation. Does it exist or does anyone know of someone who's implemented something like this over the top of NPOI?

thanks,

Rory

Viewing all articles
Browse latest Browse all 1621

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>