File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed
src/main/java/org/fugerit/java/query/export/facade/format Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 55 <groupId >org.fugerit.java</groupId >
66 <artifactId >query-export-tool</artifactId >
77
8- <version >0.3.0 </version >
8+ <version >0.3.1 </version >
99 <packaging >jar</packaging >
1010
1111 <name >query-export-tool</name >
2323 <maven .compiler.target>1.8</maven .compiler.target>
2424 <maven .compiler.source>1.8</maven .compiler.source>
2525 <!-- libraries versions -->
26- <fj-version >0.7.4 .8</fj-version >
27- <opencsv-version >4 .6</opencsv-version >
26+ <fj-version >0.7.6 .8</fj-version >
27+ <opencsv-version >5 .6</opencsv-version >
2828 <poi-version >4.1.2</poi-version >
2929 </properties >
3030
Original file line number Diff line number Diff line change 1818
1919public abstract class QueryExportHandlerXLSBase extends QueryExportHandler {
2020
21+ public static void resizeSheet ( Sheet s ) {
22+ Row row = s .getRow ( 0 );
23+ Iterator <Cell > cells = row .cellIterator ();
24+ while ( cells .hasNext () ) {
25+ Cell c = cells .next ();
26+ s .autoSizeColumn ( c .getColumnIndex () );
27+ }
28+ }
29+
30+ public static void autoSizeColumns (Workbook workbook ) {
31+ int numberOfSheets = workbook .getNumberOfSheets ();
32+ for (int i = 0 ; i < numberOfSheets ; i ++) {
33+ Sheet sheet = workbook .getSheetAt (i );
34+ resizeSheet ( sheet );
35+ }
36+ }
37+
2138 public QueryExportHandlerXLSBase (String format ) {
2239 super (format );
2340 }
2441
2542 public static final String ARG_XLS_TEMPLATE = "xls-template" ;
2643
44+ public static final String ARG_XLS_RESIZE = "xls-resize" ;
45+
46+ public static final String ARG_XLS_RESIZE_DEFAULT = "false" ;
47+
2748 private void addRow ( Iterator <MetaField > record , Sheet sheet , int index ) throws Exception {
2849 int col = 0 ;
2950 Row row = sheet .createRow ( index );
You can’t perform that action at this time.
0 commit comments