Line 35... |
Line 35... |
35 |
import org.openconcerto.sql.model.SQLTable;
|
35 |
import org.openconcerto.sql.model.SQLTable;
|
36 |
import org.openconcerto.utils.ExceptionHandler;
|
36 |
import org.openconcerto.utils.ExceptionHandler;
|
37 |
import org.openconcerto.utils.StreamUtils;
|
37 |
import org.openconcerto.utils.StreamUtils;
|
38 |
import org.openconcerto.utils.Tuple2;
|
38 |
import org.openconcerto.utils.Tuple2;
|
39 |
import org.openconcerto.utils.cc.ITransformer;
|
39 |
import org.openconcerto.utils.cc.ITransformer;
|
- |
|
40 |
import org.openconcerto.utils.io.BOMSkipper;
|
40 |
|
41 |
|
41 |
import java.awt.Point;
|
42 |
import java.awt.Point;
|
- |
|
43 |
import java.io.BufferedReader;
|
42 |
import java.io.File;
|
44 |
import java.io.File;
|
43 |
import java.io.FileNotFoundException;
|
45 |
import java.io.FileNotFoundException;
|
44 |
import java.io.IOException;
|
46 |
import java.io.IOException;
|
45 |
import java.io.InputStream;
|
47 |
import java.io.InputStream;
|
- |
|
48 |
import java.io.InputStreamReader;
|
46 |
import java.lang.reflect.InvocationTargetException;
|
49 |
import java.lang.reflect.InvocationTargetException;
|
47 |
import java.math.BigDecimal;
|
50 |
import java.math.BigDecimal;
|
48 |
import java.math.RoundingMode;
|
51 |
import java.math.RoundingMode;
|
- |
|
52 |
import java.nio.charset.Charset;
|
49 |
import java.text.DateFormat;
|
53 |
import java.text.DateFormat;
|
50 |
import java.text.SimpleDateFormat;
|
54 |
import java.text.SimpleDateFormat;
|
51 |
import java.util.Collection;
|
55 |
import java.util.Collection;
|
52 |
import java.util.HashMap;
|
56 |
import java.util.HashMap;
|
53 |
import java.util.List;
|
57 |
import java.util.List;
|
Line 75... |
Line 79... |
75 |
private static int answer = JOptionPane.NO_OPTION;
|
79 |
private static int answer = JOptionPane.NO_OPTION;
|
76 |
|
80 |
|
77 |
private DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
|
81 |
private DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
|
78 |
|
82 |
|
79 |
// Cache pour la recherche des styles
|
83 |
// Cache pour la recherche des styles
|
80 |
private Map<Sheet, Map<String, Map<Integer, String>>> cacheStyle = new HashMap<Sheet, Map<String, Map<Integer, String>>>();
|
84 |
private Map<Sheet, Map<String, Map<Integer, String>>> cacheStyle = new HashMap<>();
|
81 |
private Map<SQLRowAccessor, Map<String, Object>> taxe = new HashMap<SQLRowAccessor, Map<String, Object>>();
|
85 |
private Map<SQLRowAccessor, Map<String, Object>> taxe = new HashMap<>();
|
82 |
private Map<String, Map<Integer, SQLRowAccessor>> cacheForeign = new HashMap<String, Map<Integer, SQLRowAccessor>>();
|
86 |
private Map<String, Map<Integer, SQLRowAccessor>> cacheForeign = new HashMap<>();
|
83 |
|
87 |
|
84 |
// Cache pour les SQLRow du tableau
|
88 |
// Cache pour les SQLRow du tableau
|
85 |
private Map<String, List<? extends SQLRowAccessor>> rowsEltCache = new HashMap<String, List<? extends SQLRowAccessor>>();
|
89 |
private Map<String, List<? extends SQLRowAccessor>> rowsEltCache = new HashMap<>();
|
86 |
private final OOXMLCache rowRefCache = new OOXMLCache();
|
90 |
private final OOXMLCache rowRefCache = new OOXMLCache();
|
87 |
private final SQLRow row;
|
91 |
private final SQLRow row;
|
88 |
|
92 |
|
89 |
public OOgenerationXML(SQLRow row) {
|
93 |
public OOgenerationXML(SQLRow row) {
|
90 |
this.row = row;
|
94 |
this.row = row;
|
Line 153... |
Line 157... |
153 |
if (xmlConfiguration == null) {
|
157 |
if (xmlConfiguration == null) {
|
154 |
JOptionPane.showMessageDialog(null, "Fichier de configuration manquant pour " + templateId + " " + ((rowLanguage == null) ? "" : rowLanguage.getString("CHEMIN")) + " "
|
158 |
JOptionPane.showMessageDialog(null, "Fichier de configuration manquant pour " + templateId + " " + ((rowLanguage == null) ? "" : rowLanguage.getString("CHEMIN")) + " "
|
155 |
+ ((typeTemplate == null) ? "" : typeTemplate));
|
159 |
+ ((typeTemplate == null) ? "" : typeTemplate));
|
156 |
return null;
|
160 |
return null;
|
157 |
}
|
161 |
}
|
- |
|
162 |
|
- |
|
163 |
final BufferedReader xmlConfigurationReader = new BufferedReader(new InputStreamReader(xmlConfiguration, Charset.forName("UTF8")));
|
- |
|
164 |
BOMSkipper.skip(xmlConfigurationReader);
|
158 |
Document doc = builder.build(xmlConfiguration);
|
165 |
final Document doc = builder.build(xmlConfigurationReader);
|
- |
|
166 |
xmlConfigurationReader.close();
|
159 |
xmlConfiguration.close();
|
167 |
xmlConfiguration.close();
|
160 |
|
168 |
|
161 |
// On initialise un nouvel élément racine avec l'élément racine du document.
|
169 |
// On initialise un nouvel élément racine avec l'élément racine du document.
|
162 |
Element racine = doc.getRootElement();
|
170 |
Element racine = doc.getRootElement();
|
163 |
|
171 |
|
Line 237... |
Line 245... |
237 |
Sheet sheet = spreadsheet.getSheet(idSheet);
|
245 |
Sheet sheet = spreadsheet.getSheet(idSheet);
|
238 |
// Derniere colonne du tableau permet de ne pas chercher sur toutes les colonnes
|
246 |
// Derniere colonne du tableau permet de ne pas chercher sur toutes les colonnes
|
239 |
// et d'optimiser la recherche
|
247 |
// et d'optimiser la recherche
|
240 |
Object oLastColTmp = tableau.getAttributeValue("lastColumn");
|
248 |
Object oLastColTmp = tableau.getAttributeValue("lastColumn");
|
241 |
int lastColumn = -1;
|
249 |
int lastColumn = -1;
|
242 |
int endPageLine = Integer.valueOf(tableau.getAttributeValue("endPageLine"));
|
250 |
int endPageLine = Integer.parseInt(tableau.getAttributeValue("endPageLine"));
|
243 |
if (oLastColTmp != null) {
|
251 |
if (oLastColTmp != null) {
|
244 |
lastColumn = sheet.resolveHint(oLastColTmp.toString() + 1).x + 1;
|
252 |
lastColumn = sheet.resolveHint(oLastColTmp.toString() + 1).x + 1;
|
245 |
}
|
253 |
}
|
246 |
|
254 |
|
247 |
Map<String, Map<Integer, String>> mapStyle = searchStyle(sheet, lastColumn, endPageLine);
|
255 |
Map<String, Map<Integer, String>> mapStyle = searchStyle(sheet, lastColumn, endPageLine);
|
Line 249... |
Line 257... |
249 |
if (tableau.getAttributeValue("table").equalsIgnoreCase("TVA")) {
|
257 |
if (tableau.getAttributeValue("table").equalsIgnoreCase("TVA")) {
|
250 |
fillTaxeDocumentMap(tableau, sheet, mapStyle, false);
|
258 |
fillTaxeDocumentMap(tableau, sheet, mapStyle, false);
|
251 |
return;
|
259 |
return;
|
252 |
}
|
260 |
}
|
253 |
int nbPage = fillTable(tableau, row, sheet, mapStyle, true, rowLanguage);
|
261 |
int nbPage = fillTable(tableau, row, sheet, mapStyle, true, rowLanguage);
|
254 |
int firstLine = Integer.valueOf(tableau.getAttributeValue("firstLine"));
|
262 |
int firstLine = Integer.parseInt(tableau.getAttributeValue("firstLine"));
|
255 |
int endLine = Integer.valueOf(tableau.getAttributeValue("endLine"));
|
263 |
int endLine = Integer.parseInt(tableau.getAttributeValue("endLine"));
|
256 |
Object printRangeObj = sheet.getPrintRanges();
|
264 |
Object printRangeObj = sheet.getPrintRanges();
|
257 |
|
265 |
|
258 |
System.err.println("Nombre de page == " + nbPage);
|
266 |
System.err.println("Nombre de page == " + nbPage);
|
259 |
if (nbPage == 1) {
|
267 |
if (nbPage == 1) {
|
260 |
fillTable(tableau, row, sheet, mapStyle, false, rowLanguage);
|
268 |
fillTable(tableau, row, sheet, mapStyle, false, rowLanguage);
|
Line 284... |
Line 292... |
284 |
|
292 |
|
285 |
// On agrandit le tableau pour qu'il remplisse la premiere page
|
293 |
// On agrandit le tableau pour qu'il remplisse la premiere page
|
286 |
int lineToAdd = endPageLine - endLine;
|
294 |
int lineToAdd = endPageLine - endLine;
|
287 |
String repeatedCount = tableau.getAttributeValue("repeatedCount");
|
295 |
String repeatedCount = tableau.getAttributeValue("repeatedCount");
|
288 |
if (repeatedCount != null && repeatedCount.trim().length() > 0) {
|
296 |
if (repeatedCount != null && repeatedCount.trim().length() > 0) {
|
289 |
int count = Integer.valueOf(repeatedCount);
|
297 |
int count = Integer.parseInt(repeatedCount);
|
290 |
sheet.duplicateRows(firstLine, lineToAdd / count, count);
|
298 |
sheet.duplicateRows(firstLine, lineToAdd / count, count);
|
291 |
final int rest = lineToAdd % count;
|
299 |
final int rest = lineToAdd % count;
|
292 |
// Si le nombre de ligne ne termine pas à la fin de la page
|
300 |
// Si le nombre de ligne ne termine pas à la fin de la page
|
293 |
if (rest != 0) {
|
301 |
if (rest != 0) {
|
294 |
sheet.insertDuplicatedRows(firstLine + lineToAdd - rest, rest);
|
302 |
sheet.insertDuplicatedRows(firstLine + lineToAdd - rest, rest);
|
Line 322... |
Line 330... |
322 |
for (int i = 1; i < nbPageRef; i++) {
|
330 |
for (int i = 1; i < nbPageRef; i++) {
|
323 |
MutableCell<SpreadSheet> cell2 = sheet.getCellAt(cell.getX(), cell.getY() + (endPageLine * i));
|
331 |
MutableCell<SpreadSheet> cell2 = sheet.getCellAt(cell.getX(), cell.getY() + (endPageLine * i));
|
324 |
cell2.setValue("Page " + (i + start) + "/" + nbPageRef);
|
332 |
cell2.setValue("Page " + (i + start) + "/" + nbPageRef);
|
325 |
}
|
333 |
}
|
326 |
if (pageAdd != null && pageAdd.trim().length() > 0) {
|
334 |
if (pageAdd != null && pageAdd.trim().length() > 0) {
|
327 |
int pAdd = Integer.valueOf(pageAdd);
|
335 |
int pAdd = Integer.parseInt(pageAdd);
|
328 |
for (int i = 0; i < pAdd; i++) {
|
336 |
for (int i = 0; i < pAdd; i++) {
|
329 |
Sheet s = sheet.getSpreadSheet().getSheet(idSheet + i + 1);
|
337 |
Sheet s = sheet.getSpreadSheet().getSheet(idSheet + i + 1);
|
330 |
MutableCell<SpreadSheet> cell2 = s.getCellAt(pageRef);
|
338 |
MutableCell<SpreadSheet> cell2 = s.getCellAt(pageRef);
|
331 |
cell2.setValue("Page " + (nbPageRef - (pAdd - i) + 1) + "/" + nbPageRef);
|
339 |
cell2.setValue("Page " + (nbPageRef - (pAdd - i) + 1) + "/" + nbPageRef);
|
332 |
}
|
340 |
}
|
Line 360... |
Line 368... |
360 |
} else {
|
368 |
} else {
|
361 |
|
369 |
|
362 |
SQLRowAccessor foreign = row.getForeign(field.getName());
|
370 |
SQLRowAccessor foreign = row.getForeign(field.getName());
|
363 |
|
371 |
|
364 |
if (c == null) {
|
372 |
if (c == null) {
|
365 |
Map<Integer, SQLRowAccessor> map = new HashMap<Integer, SQLRowAccessor>();
|
373 |
Map<Integer, SQLRowAccessor> map = new HashMap<>();
|
366 |
map.put(i, foreign);
|
374 |
map.put(i, foreign);
|
367 |
cacheForeign.put(field.getName(), map);
|
375 |
cacheForeign.put(field.getName(), map);
|
368 |
} else {
|
376 |
} else {
|
369 |
c.put(i, foreign);
|
377 |
c.put(i, foreign);
|
370 |
}
|
378 |
}
|
371 |
|
379 |
|
372 |
return foreign;
|
380 |
return foreign;
|
373 |
}
|
381 |
}
|
374 |
// return row.getForeignRow(field.getName());
|
- |
|
375 |
|
382 |
|
376 |
}
|
383 |
}
|
377 |
|
384 |
|
378 |
private void fillTaxe(Element tableau, List<? extends SQLRowAccessor> rows) {
|
385 |
private void fillTaxe(Element tableau, List<? extends SQLRowAccessor> rows) {
|
379 |
// getValuesFromElement(boolean achat, String fieldTotalHT, SQLRow row, SQLTable foreign,
|
386 |
// getValuesFromElement(boolean achat, String fieldTotalHT, SQLRow row, SQLTable foreign,
|
Line 382... |
Line 389... |
382 |
SQLTable tableElt = Configuration.getInstance().getRoot().findTable(tableau.getAttributeValue("table"));
|
389 |
SQLTable tableElt = Configuration.getInstance().getRoot().findTable(tableau.getAttributeValue("table"));
|
383 |
SQLBackgroundTableCacheItem cacheItem = SQLBackgroundTableCache.getInstance().getCacheForTable(tableElt.getTable("COMPTE_PCE"));
|
390 |
SQLBackgroundTableCacheItem cacheItem = SQLBackgroundTableCache.getInstance().getCacheForTable(tableElt.getTable("COMPTE_PCE"));
|
384 |
SQLBackgroundTableCacheItem prefsCpt = SQLBackgroundTableCache.getInstance().getCacheForTable(tableElt.getTable("PREFS_COMPTE"));
|
391 |
SQLBackgroundTableCacheItem prefsCpt = SQLBackgroundTableCache.getInstance().getCacheForTable(tableElt.getTable("PREFS_COMPTE"));
|
385 |
if (tableElt.contains("ID_TAXE") && tableElt.contains("T_PA_HT")) {
|
392 |
if (tableElt.contains("ID_TAXE") && tableElt.contains("T_PA_HT")) {
|
386 |
boolean achat = tableElt.contains("T_PA_TTC");
|
393 |
boolean achat = tableElt.contains("T_PA_TTC");
|
387 |
TotalCalculator calc = new TotalCalculator("T_PA_HT", achat ? "T_PA_HT" : "T_PV_HT", null, achat, null);
|
394 |
TotalCalculator calc = new TotalCalculator("T_PA_HT", achat ? "T_PA_HT" : "T_PV_HT", null, achat, null, null);
|
388 |
String val = DefaultNXProps.getInstance().getStringProperty("ArticleService");
|
395 |
String val = DefaultNXProps.getInstance().getStringProperty("ArticleService");
|
389 |
Boolean bServiceActive = Boolean.valueOf(val);
|
396 |
Boolean bServiceActive = Boolean.valueOf(val);
|
390 |
|
397 |
|
391 |
calc.setServiceActive(bServiceActive != null && bServiceActive);
|
398 |
calc.setServiceActive(bServiceActive != null && bServiceActive);
|
392 |
if (row.getTable().contains("ID_COMPTE_PCE_SERVICE") && !row.isForeignEmpty("ID_COMPTE_PCE_SERVICE")) {
|
399 |
if (row.getTable().contains("ID_COMPTE_PCE_SERVICE") && !row.isForeignEmpty("ID_COMPTE_PCE_SERVICE")) {
|
Line 485... |
Line 492... |
485 |
}
|
492 |
}
|
486 |
calc.checkResult();
|
493 |
calc.checkResult();
|
487 |
Map<SQLRowAccessor, Tuple2<BigDecimal, BigDecimal>> taxeCalc = calc.getMapHtTVARowTaux();
|
494 |
Map<SQLRowAccessor, Tuple2<BigDecimal, BigDecimal>> taxeCalc = calc.getMapHtTVARowTaux();
|
488 |
for (SQLRowAccessor sqlRow : taxeCalc.keySet()) {
|
495 |
for (SQLRowAccessor sqlRow : taxeCalc.keySet()) {
|
489 |
Tuple2<BigDecimal, BigDecimal> v = taxeCalc.get(sqlRow);
|
496 |
Tuple2<BigDecimal, BigDecimal> v = taxeCalc.get(sqlRow);
|
490 |
Map<String, Object> m = new HashMap<String, Object>();
|
497 |
Map<String, Object> m = new HashMap<>();
|
491 |
m.put("MONTANT_HT", v.get0());
|
498 |
m.put("MONTANT_HT", v.get0());
|
492 |
m.put("MONTANT_TVA", v.get1());
|
499 |
m.put("MONTANT_TVA", v.get1());
|
493 |
taxe.put(sqlRow, m);
|
500 |
taxe.put(sqlRow, m);
|
494 |
}
|
501 |
}
|
495 |
}
|
502 |
}
|
Line 508... |
Line 515... |
508 |
int currentLineTmp = tableElement.getFirstLine();
|
515 |
int currentLineTmp = tableElement.getFirstLine();
|
509 |
int currentLine = tableElement.getFirstLine();
|
516 |
int currentLine = tableElement.getFirstLine();
|
510 |
|
517 |
|
511 |
StyleSQLElement styleElt = Configuration.getInstance().getDirectory().getElement(StyleSQLElement.class);
|
518 |
StyleSQLElement styleElt = Configuration.getInstance().getDirectory().getElement(StyleSQLElement.class);
|
512 |
|
519 |
|
513 |
boolean cache = false;
|
- |
|
514 |
String ref = tableau.getAttributeValue("table") + "_" + row.getTable().getName() + row.getID();
|
520 |
String ref = tableau.getAttributeValue("table") + "_" + row.getTable().getName() + row.getID();
|
515 |
if (rowsEltCache.get(ref) == null) {
|
521 |
if (rowsEltCache.get(ref) == null) {
|
516 |
rowsEltCache.put(ref, tableElement.getRows());
|
522 |
rowsEltCache.put(ref, tableElement.getRows());
|
517 |
} else {
|
- |
|
518 |
cache = true;
|
- |
|
519 |
}
|
523 |
}
|
520 |
List<Element> listElts = tableau.getChildren("element");
|
524 |
List<Element> listElts = tableau.getChildren("element");
|
521 |
|
525 |
|
522 |
fillTaxe(tableau, rowsEltCache.get(ref));
|
526 |
fillTaxe(tableau, rowsEltCache.get(ref));
|
523 |
// on remplit chaque ligne à partir des rows recuperées
|
527 |
// on remplit chaque ligne à partir des rows recuperées
|
Line 551... |
Line 555... |
551 |
currentLine++;
|
555 |
currentLine++;
|
552 |
first = false;
|
556 |
first = false;
|
553 |
}
|
557 |
}
|
554 |
|
558 |
|
555 |
// Cache des valeurs
|
559 |
// Cache des valeurs
|
556 |
Map<Element, Object> mapValues = new HashMap<Element, Object>();
|
560 |
Map<Element, Object> mapValues = new HashMap<>();
|
557 |
|
561 |
|
558 |
// Test si l'ensemble des donnees tient sur la page courante
|
562 |
// Test si l'ensemble des donnees tient sur la page courante
|
559 |
Map<String, Integer> tmpMapNbCel = new HashMap<String, Integer>();
|
563 |
Map<String, Integer> tmpMapNbCel = new HashMap<>();
|
560 |
int tmpNbCellule = fillTableLine(sheet, mapStyle, true, rowLanguage, tableElement, currentLine, listElts, numeroRef, rowElt, tmpMapNbCel, styleName, mapValues);
|
564 |
int tmpNbCellule = fillTableLine(sheet, mapStyle, true, rowLanguage, tableElement, currentLine, listElts, numeroRef, rowElt, tmpMapNbCel, styleName, mapValues);
|
561 |
for (String s : tmpMapNbCel.keySet()) {
|
565 |
for (String s : tmpMapNbCel.keySet()) {
|
562 |
tmpNbCellule = Math.max(tmpNbCellule, tmpMapNbCel.get(s));
|
566 |
tmpNbCellule = Math.max(tmpNbCellule, tmpMapNbCel.get(s));
|
563 |
}
|
567 |
}
|
564 |
if ((currentLine + tmpNbCellule) > (tableElement.getEndPageLine() * nbPage)) {
|
568 |
if ((currentLine + tmpNbCellule) > (tableElement.getEndPageLine() * nbPage)) {
|
Line 567... |
Line 571... |
567 |
currentLineTmp = currentLine;
|
571 |
currentLineTmp = currentLine;
|
568 |
nbPage++;
|
572 |
nbPage++;
|
569 |
}
|
573 |
}
|
570 |
|
574 |
|
571 |
// Remplissage reel des cellules
|
575 |
// Remplissage reel des cellules
|
572 |
Map<String, Integer> mapNbCel = new HashMap<String, Integer>();
|
576 |
Map<String, Integer> mapNbCel = new HashMap<>();
|
573 |
int nbCellule = fillTableLine(sheet, mapStyle, test, rowLanguage, tableElement, currentLine, listElts, numeroRef, rowElt, mapNbCel, styleName, mapValues);
|
577 |
int nbCellule = fillTableLine(sheet, mapStyle, test, rowLanguage, tableElement, currentLine, listElts, numeroRef, rowElt, mapNbCel, styleName, mapValues);
|
574 |
|
578 |
|
575 |
for (String s : mapNbCel.keySet()) {
|
579 |
for (String s : mapNbCel.keySet()) {
|
576 |
nbCellule = Math.max(nbCellule, mapNbCel.get(s));
|
580 |
nbCellule = Math.max(nbCellule, mapNbCel.get(s));
|
577 |
}
|
581 |
}
|
Line 705... |
Line 709... |
705 |
return nbCellule;
|
709 |
return nbCellule;
|
706 |
}
|
710 |
}
|
707 |
|
711 |
|
708 |
private void fillTaxeDocumentMap(Element tableau, Sheet sheet, Map<String, Map<Integer, String>> mapStyle, boolean test) {
|
712 |
private void fillTaxeDocumentMap(Element tableau, Sheet sheet, Map<String, Map<Integer, String>> mapStyle, boolean test) {
|
709 |
|
713 |
|
710 |
int line = Integer.valueOf(tableau.getAttributeValue("firstLine"));
|
714 |
int line = Integer.parseInt(tableau.getAttributeValue("firstLine"));
|
711 |
List<Element> listElts = tableau.getChildren("element");
|
715 |
List<Element> listElts = tableau.getChildren("element");
|
712 |
|
716 |
|
713 |
for (SQLRowAccessor rowTaxe : taxe.keySet()) {
|
717 |
for (SQLRowAccessor rowTaxe : taxe.keySet()) {
|
714 |
|
718 |
|
715 |
Map<String, Object> m = taxe.get(rowTaxe);
|
719 |
Map<String, Object> m = taxe.get(rowTaxe);
|
Line 951... |
Line 955... |
951 |
|
955 |
|
952 |
e.printStackTrace();
|
956 |
e.printStackTrace();
|
953 |
}
|
957 |
}
|
954 |
|
958 |
|
955 |
// Copie de l'odsp
|
959 |
// Copie de l'odsp
|
956 |
try {
|
- |
|
957 |
File odspOut = new File(pathDest, fileName + ".odsp");
|
960 |
File odspOut = new File(pathDest, fileName + ".odsp");
|
958 |
final InputStream odspIn = TemplateManager.getInstance().getTemplatePrintConfiguration(templateId, langage, null);
|
961 |
try (final InputStream odspIn = TemplateManager.getInstance().getTemplatePrintConfiguration(templateId, langage, null);) {
|
959 |
if (odspIn != null) {
|
962 |
if (odspIn != null) {
|
960 |
StreamUtils.copy(odspIn, odspOut);
|
963 |
StreamUtils.copy(odspIn, odspOut);
|
961 |
odspIn.close();
|
- |
|
962 |
}
|
964 |
}
|
963 |
} catch (FileNotFoundException e) {
|
965 |
} catch (FileNotFoundException e) {
|
964 |
System.err.println("OOgenerationXML.saveSpreadSheet() : Le fichier odsp n'existe pas.");
|
966 |
System.err.println("OOgenerationXML.saveSpreadSheet() : Le fichier odsp n'existe pas.");
|
965 |
}
|
967 |
}
|
966 |
return fDest;
|
968 |
return fDest;
|
Line 983... |
Line 985... |
983 |
|
985 |
|
984 |
int rowCount = (rowEnd > 0) ? rowEnd : sheet.getRowCount();
|
986 |
int rowCount = (rowEnd > 0) ? rowEnd : sheet.getRowCount();
|
985 |
System.err.println("End row search : " + rowCount);
|
987 |
System.err.println("End row search : " + rowCount);
|
986 |
for (int i = 0; i < rowCount; i++) {
|
988 |
for (int i = 0; i < rowCount; i++) {
|
987 |
int x = 0;
|
989 |
int x = 0;
|
988 |
Map<Integer, String> mapCellStyle = new HashMap<Integer, String>();
|
990 |
Map<Integer, String> mapCellStyle = new HashMap<>();
|
989 |
String style = "";
|
991 |
String style = "";
|
990 |
|
992 |
|
991 |
for (int j = 0; j < columnCount; j++) {
|
993 |
for (int j = 0; j < columnCount; j++) {
|
992 |
|
994 |
|
993 |
try {
|
995 |
try {
|
Line 1043... |
Line 1045... |
1043 |
Element racine = doc.getRootElement();
|
1045 |
Element racine = doc.getRootElement();
|
1044 |
|
1046 |
|
1045 |
List<Element> listTable = racine.getChildren("table");
|
1047 |
List<Element> listTable = racine.getChildren("table");
|
1046 |
|
1048 |
|
1047 |
Element tableau;
|
1049 |
Element tableau;
|
1048 |
if (listTable.size() == 0) {
|
1050 |
if (listTable.isEmpty()) {
|
1049 |
return false;
|
1051 |
return false;
|
1050 |
} else {
|
1052 |
} else {
|
1051 |
if (listTable.get(0).getAttributeValue("table").equalsIgnoreCase("TVA")) {
|
1053 |
if (listTable.get(0).getAttributeValue("table").equalsIgnoreCase("TVA")) {
|
1052 |
tableau = listTable.get(1);
|
1054 |
tableau = listTable.get(1);
|
1053 |
} else {
|
1055 |
} else {
|
Line 1056... |
Line 1058... |
1056 |
}
|
1058 |
}
|
1057 |
final Sheet sheet = spreadSheet.getSheet(0);
|
1059 |
final Sheet sheet = spreadSheet.getSheet(0);
|
1058 |
|
1060 |
|
1059 |
Object oLastColTmp = tableau.getAttributeValue("lastColumn");
|
1061 |
Object oLastColTmp = tableau.getAttributeValue("lastColumn");
|
1060 |
int lastColumn = -1;
|
1062 |
int lastColumn = -1;
|
1061 |
int endPageLine = Integer.valueOf(tableau.getAttributeValue("endPageLine"));
|
1063 |
int endPageLine = Integer.parseInt(tableau.getAttributeValue("endPageLine"));
|
1062 |
if (oLastColTmp != null) {
|
1064 |
if (oLastColTmp != null) {
|
1063 |
lastColumn = sheet.resolveHint(oLastColTmp.toString() + 1).x + 1;
|
1065 |
lastColumn = sheet.resolveHint(oLastColTmp.toString() + 1).x + 1;
|
1064 |
}
|
1066 |
}
|
1065 |
|
1067 |
|
1066 |
Map<String, Map<Integer, String>> mapStyle = searchStyle(sheet, lastColumn, endPageLine);
|
1068 |
Map<String, Map<Integer, String>> mapStyle = searchStyle(sheet, lastColumn, endPageLine);
|