Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "format as table" in Excel or apache POI?

In Excel 2010 it's possible to "format as table" a group of cells - enabling easy sorting and filtering (Home > Format As Table).

Can I do the same in Apache POI? Alternatively, can one accomplish the above directly in Excel via a macro/formula (as opposed to CTRL+T or clicking on a toolbar button)?

like image 458
Nikita Avatar asked Feb 25 '11 15:02

Nikita


1 Answers

There's a fairly new feature in POI that may deliver what you need. Grab a recent nightly/svn build (or wait for POI 3.8 beta 3 in a week or so), and take a look at XSSFTable. You should now be able to add one to a sheet, specify the range it applies to (the range you want to be made a table), and that hopefully will do you. It's quite new though, so you may need to join the POI dev list and help with the development of the feature if it's not quite there for you!

like image 194
Gagravarr Avatar answered Oct 07 '22 09:10

Gagravarr