use of eu.ggnet.lucidcalc.LucidCalcWriter in project dwoss by gg-net.
the class ReturnsExporter method returnsToXls.
public static File returnsToXls(List<ReportLine> lines) {
List<Object[]> linesData = new ArrayList<>();
for (ReportLine reportLine : lines) {
Object[] data = new Object[] { reportLine.getDossierIdentifier(), reportLine.getActual(), reportLine.getRefurbishId(), reportLine.getPartNo(), reportLine.getName(), reportLine.getSerial(), reportLine.getMfgDate(), reportLine.getReportingDate() };
linesData.add(data);
}
STable newTable = new STable();
newTable.setTableFormat(new CFormat("Verdana", 10, new CBorder(Color.BLACK, CBorder.LineStyle.THIN)));
newTable.setHeadlineFormat(new CFormat(CFormat.FontStyle.BOLD, Color.BLACK, Color.YELLOW, CFormat.HorizontalAlignment.CENTER, CFormat.VerticalAlignment.MIDDLE));
newTable.add(new STableColumn("Auftrag", 15));
newTable.add(new STableColumn("Datum", 10, new CFormat(CFormat.Representation.SHORT_DATE)));
newTable.add(new STableColumn("SopoNr", 10));
newTable.add(new STableColumn("ArtikelNr", 15));
newTable.add(new STableColumn("Bezeichnung", 40));
newTable.add(new STableColumn("Seriennummer", 35));
newTable.add(new STableColumn("MFGDate", 10, new CFormat(CFormat.Representation.SHORT_DATE)));
newTable.add(new STableColumn("reported Am", 10, new CFormat(CFormat.Representation.SHORT_DATE)));
newTable.setModel(new STableModelList<>(linesData));
STable table = new STable(newTable);
table.setModel(new STableModelList<>(linesData));
ReturnsExporter.SResult summary = createReturnsSummary(table, lines.size());
SBlock block = new SBlock();
block.setFormat(new CFormat(Color.BLACK, Color.LIGHT_GRAY, CFormat.HorizontalAlignment.LEFT));
block.add(new SCell("Rückläufer"), "");
CSheet sheet = new CSheet("Rückläufer Report");
sheet.setShowGridLines(false);
sheet.addBelow(block);
sheet.addBelow(newTable);
sheet.addBelow(4, 1, summary.block);
CCalcDocument doc = new TempCalcDocument("Rückläufer");
doc.add(sheet);
LucidCalcWriter writer = LucidCalc.createWriter(LucidCalc.Backend.XLS);
return writer.write(doc);
}
Aggregations