ExportParams.java
6.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
package com.bckefu.excel.entity;
import com.bckefu.excel.entity.enmus.ExcelType;
import com.bckefu.excel.export.style.ExcelExportStylerDefaultImpl;
import org.apache.poi.hssf.util.HSSFColor;
/**
* @author caoliang1918@aliyun.com
* @Date 2017/11/5:22:15
*/
public class ExportParams extends ExcelBaseParams {
/**
* 表格名称(可以为null)
*/
private String title;
/**
* 表高度
*/
private short titleHeight = 10;
/**
* 第二行名称
*/
private String secondTitle;
/**
* 表格名称
*/
private short secondTitleHeight = 8;
/**
* sheetName
*/
private String sheetName;
/**
* 过滤的属性
*/
private String[] exclusions;
/**
* 是否添加序号
*/
private boolean addIndex;
/**
* 序号名称
*/
private String indexName = "序号";
/**
* 冻结列
*/
private int freezeCol;
/**
* 冻结行
*/
private int freezeRow;
/**
* 表头颜色
*/
private short color = HSSFColor.HSSFColorPredefined.WHITE.getIndex();
/**
* 属性说明行的颜色 例如:HSSFColor.SKY_BLUE.index 默认
*/
private short headerColor = HSSFColor.HSSFColorPredefined.BRIGHT_GREEN.getIndex();
/**
* Excel 导出版本
*/
private ExcelType type = ExcelType.HSSF;
/**
* Excel 导出style
*/
private Class<?> style = ExcelExportStylerDefaultImpl.class;
/**
* 是否创建表头
*/
private boolean isCreateHeadRows = true;
/**
* 是否动态获取数据
*/
private boolean isDynamicData = false;
/**
* 是否追加图形
*/
private boolean isAppendGraph = true;
/**
* 单sheet最大值
* 03版本默认6W行,07默认100W
*/
private int maxNum = 0;
/**
* 导出时在excel中每个列的高度 单位为字符,一个汉字=2个字符
* 全局设置,优先使用
*/
public short height = 0;
/**
* 表头字体大小
*/
private short titleSize = 12;
/**
* 属性字体大小
*/
private short headerSize = 11;
public ExportParams() {
}
public ExportParams(String title, String sheetName) {
this.title = title;
this.sheetName = sheetName;
}
public ExportParams(String title, String sheetName, ExcelType type) {
this.title = title;
this.sheetName = sheetName;
this.type = type;
}
public ExportParams(String sheetName, ExcelType type) {
this.sheetName = sheetName;
this.type = type;
}
public ExportParams(String title, String secondTitle, String sheetName) {
this.title = title;
this.secondTitle = secondTitle;
this.sheetName = sheetName;
}
public short getColor() {
return color;
}
public String[] getExclusions() {
return exclusions;
}
public short getHeaderColor() {
return headerColor;
}
public String getSecondTitle() {
return secondTitle;
}
public short getSecondTitleHeight() {
return (short) (secondTitleHeight * 50);
}
public String getSheetName() {
return sheetName;
}
public String getTitle() {
return title;
}
public short getTitleHeight() {
return (short) (titleHeight * 50);
}
public boolean isAddIndex() {
return addIndex;
}
public void setAddIndex(boolean addIndex) {
this.addIndex = addIndex;
}
public void setColor(short color) {
this.color = color;
}
public void setExclusions(String[] exclusions) {
this.exclusions = exclusions;
}
public void setHeaderColor(short headerColor) {
this.headerColor = headerColor;
}
public void setSecondTitle(String secondTitle) {
this.secondTitle = secondTitle;
}
public void setSecondTitleHeight(short secondTitleHeight) {
this.secondTitleHeight = secondTitleHeight;
}
public void setSheetName(String sheetName) {
this.sheetName = sheetName;
}
public void setTitle(String title) {
this.title = title;
}
public void setTitleHeight(short titleHeight) {
this.titleHeight = titleHeight;
}
public ExcelType getType() {
return type;
}
public void setType(ExcelType type) {
this.type = type;
}
public String getIndexName() {
return indexName;
}
public void setIndexName(String indexName) {
this.indexName = indexName;
}
public Class<?> getStyle() {
return style;
}
public void setStyle(Class<?> style) {
this.style = style;
}
public int getFreezeCol() {
return freezeCol;
}
public void setFreezeCol(int freezeCol) {
this.freezeCol = freezeCol;
}
public boolean isCreateHeadRows() {
return isCreateHeadRows;
}
public void setCreateHeadRows(boolean isCreateHeadRows) {
this.isCreateHeadRows = isCreateHeadRows;
}
public boolean isDynamicData() {
return isDynamicData;
}
public void setDynamicData(boolean isDynamicData) {
this.isDynamicData = isDynamicData;
}
public boolean isAppendGraph() {
return isAppendGraph;
}
public void setAppendGraph(boolean isAppendGraph) {
this.isAppendGraph = isAppendGraph;
}
public int getMaxNum() {
return maxNum;
}
public void setMaxNum(int maxNum) {
this.maxNum = maxNum;
}
public short getHeight() {
return (short) (height * 50);
}
public void setHeight(short height) {
this.height = height;
}
public int getFreezeRow() {
return freezeRow;
}
public void setFreezeRow(int freezeRow) {
this.freezeRow = freezeRow;
}
public short getTitleSize() {
return titleSize;
}
public void setTitleSize(short titleSize) {
this.titleSize = titleSize;
}
public short getHeaderSize() {
return headerSize;
}
public void setHeaderSize(short headerSize) {
this.headerSize = headerSize;
}
}