1
2
3
4
5
6
7
8
9
10
11
12
13
14 package olg.csv.base;
15
16
17
18
19
20
21
22
23
24 public abstract class AbstractSheetWriter implements IWriter {
25
26
27
28
29 protected String sheetName;
30
31
32
33
34 protected Integer beginAtRow = 1;
35
36
37
38 protected Integer beginAtColumn = 0;
39
40
41
42 protected boolean withHeaders;
43
44
45
46
47
48
49 protected AbstractSheetWriter(AbstractSheetSettings<? extends AbstractSheetSettings<?>> settings) {
50 if (settings == null) {
51 throw new IllegalArgumentException("SheetWriter Constructor settings argument must not be null");
52 }
53 if (settings.getSheetName() == null) {
54 throw new IllegalArgumentException(
55 "SheetWriter constructor settings argument : must have not null sheetName attribut");
56 }
57
58 this.sheetName = settings.getSheetName();
59 if (settings.getBeginAtRow() != null) {
60 this.beginAtRow = settings.getBeginAtRow();
61 if (this.beginAtRow < 1) {
62 throw new IllegalArgumentException("SheetWriter Constructor ettings argument :beginAtRow parameter ["
63 + beginAtRow
64 + "] must be a positive number or null (in this last case reading begins at the first row)");
65
66 }
67 }
68
69 if (settings.getBeginAtColumn() != null) {
70 this.beginAtColumn = Cell.fromSheetCellNumber(settings.getBeginAtColumn());
71 }
72 this.withHeaders = settings.isWithHeaders();
73 }
74
75
76
77
78
79
80 public String getSheetName() {
81 return sheetName;
82 }
83
84
85
86
87
88
89 public boolean isWithHeaders() {
90
91 return withHeaders;
92 }
93
94 }