Line 164... |
Line 164... |
164 |
Map<String, Map<Integer, String>> mapStyle = searchStyle(sheet, lastColumn, endPageLine);
|
164 |
Map<String, Map<Integer, String>> mapStyle = searchStyle(sheet, lastColumn, endPageLine);
|
165 |
|
165 |
|
166 |
int nbPage = fillTable(tableau, liste, sheet, mapStyle, true, style);
|
166 |
int nbPage = fillTable(tableau, liste, sheet, mapStyle, true, style);
|
167 |
int firstLine = Integer.valueOf(tableau.getAttributeValue("firstLine"));
|
167 |
int firstLine = Integer.valueOf(tableau.getAttributeValue("firstLine"));
|
168 |
int endLine = Integer.valueOf(tableau.getAttributeValue("endLine"));
|
168 |
int endLine = Integer.valueOf(tableau.getAttributeValue("endLine"));
|
- |
|
169 |
|
169 |
Object printRangeObj = sheet.getPrintRanges();
|
170 |
Object printRangeObj = sheet.getPrintRanges();
|
170 |
|
171 |
|
171 |
System.err.println("Nombre de page == " + nbPage);
|
172 |
System.err.println("Nombre de page == " + nbPage);
|
172 |
if (nbPage == 1) {
|
173 |
if (nbPage == 1 || endLine == -1) {
|
173 |
fillTable(tableau, liste, sheet, mapStyle, false, style);
|
174 |
fillTable(tableau, liste, sheet, mapStyle, false, style);
|
174 |
} else {
|
175 |
} else {
|
175 |
|
176 |
|
176 |
if (printRangeObj != null) {
|
177 |
if (printRangeObj != null) {
|
177 |
String s = printRangeObj.toString();
|
178 |
String s = printRangeObj.toString();
|
Line 231... |
Line 232... |
231 |
int nbPage = 1;
|
232 |
int nbPage = 1;
|
232 |
int currentLineTmp = Integer.valueOf(tableau.getAttributeValue("firstLine"));
|
233 |
int currentLineTmp = Integer.valueOf(tableau.getAttributeValue("firstLine"));
|
233 |
int currentLine = Integer.valueOf(tableau.getAttributeValue("firstLine"));
|
234 |
int currentLine = Integer.valueOf(tableau.getAttributeValue("firstLine"));
|
234 |
int endPageLine = Integer.valueOf(tableau.getAttributeValue("endPageLine"));
|
235 |
int endPageLine = Integer.valueOf(tableau.getAttributeValue("endPageLine"));
|
235 |
|
236 |
|
- |
|
237 |
int endLine = Integer.valueOf(tableau.getAttributeValue("endLine"));
|
- |
|
238 |
|
236 |
List listElts = tableau.getChildren("element");
|
239 |
List listElts = tableau.getChildren("element");
|
237 |
|
240 |
|
238 |
Object o = null;
|
241 |
Object o = null;
|
239 |
String columnSousTotal = tableau.getAttributeValue("groupSousTotalColumn");
|
242 |
String columnSousTotal = tableau.getAttributeValue("groupSousTotalColumn");
|
240 |
|
243 |
|
241 |
Map<String, Double> mapSousTotal = new HashMap<String, Double>();
|
244 |
Map<String, Double> mapSousTotal = new HashMap<String, Double>();
|
242 |
Map<String, Double> mapTotal = new HashMap<String, Double>();
|
245 |
Map<String, Double> mapTotal = new HashMap<String, Double>();
|
243 |
|
246 |
|
244 |
// on remplit chaque ligne à partir des rows recuperées
|
247 |
// agrandissement selon le nombre de ligne à insérer
|
- |
|
248 |
if (endLine == -1) {
|
- |
|
249 |
sheet.setRowCount(currentLine + 1);
|
- |
|
250 |
sheet.setRowCount(currentLine + liste.size(), currentLine);
|
- |
|
251 |
// sheet.duplicateRows(currentLine+1, liste.size(), 1);
|
- |
|
252 |
endPageLine = currentLine + 1 + liste.size();
|
- |
|
253 |
}
|
245 |
|
254 |
|
- |
|
255 |
// on remplit chaque ligne à partir des rows recuperées
|
246 |
for (int i = 0; i < liste.size(); i++) {
|
256 |
for (int i = 0; i < liste.size(); i++) {
|
247 |
Map<String, Object> mValues = liste.get(i);
|
257 |
Map<String, Object> mValues = liste.get(i);
|
248 |
// System.err.println(mValues);
|
258 |
// System.err.println(mValues);
|
249 |
|
259 |
|
250 |
String styleName = null;
|
260 |
String styleName = null;
|
Line 400... |
Line 410... |
400 |
return res;
|
410 |
return res;
|
401 |
}
|
411 |
}
|
402 |
|
412 |
|
403 |
private static Object resizeValue(Element elt, Object res) {
|
413 |
private static Object resizeValue(Element elt, Object res) {
|
404 |
{
|
414 |
{
|
- |
|
415 |
String digitSize = elt.getAttributeValue("digitsFormat");
|
- |
|
416 |
if (digitSize != null) {
|
- |
|
417 |
int size = Integer.valueOf(digitSize);
|
- |
|
418 |
if (res != null && res.toString().length() > 0) {
|
- |
|
419 |
res = String.format("%-" + size + "s", res).replace(' ', '0');
|
- |
|
420 |
}
|
- |
|
421 |
}
|
- |
|
422 |
}
|
- |
|
423 |
{
|
405 |
String attributeValueMaxChar = elt.getAttributeValue("maxChar");
|
424 |
String attributeValueMaxChar = elt.getAttributeValue("maxChar");
|
406 |
if (attributeValueMaxChar != null) {
|
425 |
if (attributeValueMaxChar != null) {
|
407 |
int maxChar = Integer.valueOf(attributeValueMaxChar);
|
426 |
int maxChar = Integer.valueOf(attributeValueMaxChar);
|
408 |
if (res != null && res.toString().length() > maxChar) {
|
427 |
if (res != null && res.toString().length() > maxChar) {
|
409 |
res = res.toString().substring(0, maxChar);
|
428 |
res = res.toString().substring(0, maxChar);
|
Line 437... |
Line 456... |
437 |
* @return value of composant
|
456 |
* @return value of composant
|
438 |
*/
|
457 |
*/
|
439 |
private static Object getValueOfComposant(Element eltField, Map<String, Object> mValues) {
|
458 |
private static Object getValueOfComposant(Element eltField, Map<String, Object> mValues) {
|
440 |
|
459 |
|
441 |
String field = eltField.getAttributeValue("name");
|
460 |
String field = eltField.getAttributeValue("name");
|
442 |
|
- |
|
443 |
return mValues.get(field);
|
461 |
return mValues.get(field);
|
444 |
}
|
462 |
}
|
445 |
|
463 |
|
446 |
private static int fill(Point resolveHint, Object value, Sheet sheet, boolean replace, String replacePattern, String styleOO, boolean test) {
|
464 |
private static int fill(Point resolveHint, Object value, Sheet sheet, boolean replace, String replacePattern, String styleOO, boolean test) {
|
447 |
return fill(resolveHint, value, sheet, replace, replacePattern, styleOO, test, true);
|
465 |
return fill(resolveHint, value, sheet, replace, replacePattern, styleOO, test, true);
|
Line 604... |
Line 622... |
604 |
// on parcourt chaque ligne de la feuille pour recuperer les styles
|
622 |
// on parcourt chaque ligne de la feuille pour recuperer les styles
|
605 |
int columnCount = (colEnd == -1) ? sheet.getColumnCount() : (colEnd + 1);
|
623 |
int columnCount = (colEnd == -1) ? sheet.getColumnCount() : (colEnd + 1);
|
606 |
System.err.println("End column search : " + columnCount);
|
624 |
System.err.println("End column search : " + columnCount);
|
607 |
|
625 |
|
608 |
int rowCount = (rowEnd > 0) ? rowEnd : sheet.getRowCount();
|
626 |
int rowCount = (rowEnd > 0) ? rowEnd : sheet.getRowCount();
|
609 |
|
- |
|
- |
|
627 |
// Limite pour éviter les breakrepeated
|
- |
|
628 |
rowCount = Math.min(100, rowCount);
|
610 |
System.err.println("End row search : " + rowCount);
|
629 |
System.err.println("End row search : " + rowCount);
|
611 |
for (int i = 0; i < rowCount && (mapStyleDef.keySet().size() - 2) > mapStyleFounded.keySet().size(); i++) {
|
630 |
for (int i = 0; i < rowCount && (mapStyleDef.keySet().size() - 2) > mapStyleFounded.keySet().size(); i++) {
|
612 |
|
631 |
|
613 |
int x = 0;
|
632 |
int x = 0;
|
614 |
Map<Integer, String> mapCellStyle = new HashMap<Integer, String>();
|
633 |
Map<Integer, String> mapCellStyle = new HashMap<Integer, String>();
|