removed obsolete tableheader class
This commit is contained in:
@ -0,0 +1,25 @@
|
|||||||
|
package de.muehlencord.shared.pdf;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author joern.muehlencord
|
||||||
|
*/
|
||||||
|
class ColumnDefinition {
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
private final Float width;
|
||||||
|
|
||||||
|
protected ColumnDefinition(Float width) {
|
||||||
|
this.width = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* *** getter *** */
|
||||||
|
|
||||||
|
protected float getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -71,6 +71,10 @@ class DefaultTableRow extends TableRow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String getFontAlias(int columnPos) {
|
||||||
|
return row.get(columnPos).getFontAlias();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isList() {
|
protected boolean isList() {
|
||||||
return isList;
|
return isList;
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import com.google.gson.annotations.Expose;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.pdfbox.pdmodel.PDPageContentStream;
|
import org.apache.pdfbox.pdmodel.PDPageContentStream;
|
||||||
import org.apache.pdfbox.pdmodel.font.PDFont;
|
import org.apache.pdfbox.pdmodel.font.PDFont;
|
||||||
@ -20,41 +19,35 @@ public class PDFTableContent extends Content {
|
|||||||
private static final Logger LOGGER = LoggerFactory.getLogger(PDFTableContent.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(PDFTableContent.class);
|
||||||
|
|
||||||
@Expose
|
@Expose
|
||||||
private final PDFFont headerFont;
|
private final List<ColumnDefinition> columSizes;
|
||||||
|
|
||||||
@Expose
|
|
||||||
private final TableHeader header;
|
|
||||||
|
|
||||||
@Expose
|
@Expose
|
||||||
private List<TableRow> data = null;
|
private List<TableRow> data = null;
|
||||||
|
|
||||||
public PDFTableContent(PDFDocument doc, PDFFont hf) {
|
public PDFTableContent(PDFDocument doc, PDFFont hf) {
|
||||||
super(doc);
|
super(doc);
|
||||||
this.header = new TableHeader();
|
this.columSizes = new ArrayList<>();
|
||||||
this.headerFont = hf;
|
this.data = new ArrayList<>();
|
||||||
this.data = new LinkedList<>();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDFTableContent(PDFDocument doc, PDFFont hf, int x, int y) {
|
public PDFTableContent(PDFDocument doc, PDFFont hf, int x, int y) {
|
||||||
super(doc, x, y);
|
super(doc, x, y);
|
||||||
this.header = new TableHeader();
|
this.columSizes = new ArrayList<>();
|
||||||
this.headerFont = hf;
|
|
||||||
this.data = new ArrayList<>();
|
this.data = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDFTableContent addHeader(String headerText, int colSize) {
|
public PDFTableContent addColumn(float size) {
|
||||||
this.header.add(headerText, colSize);
|
// TODO check if enough columns are defined
|
||||||
|
this.columSizes.add(new ColumnDefinition(size));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDFTableContent addHeader(String headerText, int colSize, float padding) {
|
public PDFTableContent addColumn(float... sizes) {
|
||||||
this.header.add(headerText, colSize, padding);
|
// TODO check if enough columns are defined
|
||||||
return this;
|
for (float size : sizes) {
|
||||||
}
|
addColumn(size);
|
||||||
|
}
|
||||||
public PDFTableContent addHeader(String headerText, int colSize, PDFTextAlignment alignment) {
|
|
||||||
this.header.add(headerText, colSize, alignment);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,104 +65,112 @@ public class PDFTableContent extends Content {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PDFTableContent addRow(String... values) throws ConfigurationException {
|
public PDFTableContent addRow(String... values) throws ConfigurationException {
|
||||||
return addRow(Arrays.asList(values));
|
return PDFTableContent.this.addRow(Arrays.asList(values));
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDFTableContent addRow(List<String> values) throws ConfigurationException {
|
public PDFTableContent addRow(List<String> values) throws ConfigurationException {
|
||||||
DefaultTableRow newLine = new DefaultTableRow();
|
DefaultTableRow newRow = new DefaultTableRow();
|
||||||
data.add(newLine);
|
data.add(newRow);
|
||||||
|
if (values.size() != columSizes.size()) {
|
||||||
|
throw new ConfigurationException("Table defines " + columSizes.size() + " columns, but " + values.size() + " columns given");
|
||||||
|
}
|
||||||
|
validateConfiguration(newRow, false);
|
||||||
for (String cellText : values) {
|
for (String cellText : values) {
|
||||||
addColumn (cellText);
|
PDFTableContent.this.setCellValue(cellText);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDFTableContent addColumn(String text) throws ConfigurationException {
|
public PDFTableContent setCellValue(String text) throws ConfigurationException {
|
||||||
|
TableRow lastRow = data.get(data.size() - 1);
|
||||||
|
validateConfiguration(lastRow, true);
|
||||||
|
lastRow.addColumn(new TextElement(text));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PDFTableContent setCellValue(String text, String fontAlias) throws ConfigurationException {
|
||||||
|
TableRow lastRow = data.get(data.size() - 1);
|
||||||
|
validateConfiguration(lastRow, true);
|
||||||
|
data.get(data.size() - 1).addColumn(new TextElement(text, fontAlias));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PDFTableContent setCellValue(String text, float padding) throws ConfigurationException {
|
||||||
|
TableRow lastRow = data.get(data.size() - 1);
|
||||||
|
validateConfiguration(lastRow, true);
|
||||||
|
lastRow.addColumn(new TextElement(text), padding);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PDFTableContent setCellValue(String text, String fontAlias, float padding) throws ConfigurationException {
|
||||||
|
TableRow lastRow = data.get(data.size() - 1);
|
||||||
|
validateConfiguration(lastRow, true);
|
||||||
|
lastRow.addColumn(new TextElement(text, fontAlias), padding);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PDFTableContent setCellValue(String text, PDFTextAlignment alignment) throws ConfigurationException {
|
||||||
|
TableRow lastRow = data.get(data.size() - 1);
|
||||||
|
validateConfiguration(lastRow, true);
|
||||||
|
lastRow.addColumn(new TextElement(text, alignment));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PDFTableContent setCellValue(String text, String fontAlias, PDFTextAlignment alignment) throws ConfigurationException {
|
||||||
if (data.isEmpty()) {
|
if (data.isEmpty()) {
|
||||||
throw new ConfigurationException ("Need to call newRow first");
|
throw new ConfigurationException("Need to call newRow first");
|
||||||
}
|
}
|
||||||
data.get(data.size()-1).addColumn(new TextElement (text));
|
data.get(data.size() - 1).addColumn(new TextElement(text, fontAlias, alignment));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDFTableContent addColumn(String text, PDFTextAlignment alignment) throws ConfigurationException {
|
public PDFTableContent setCellValue(String text, PDFTextAlignment alignment, float padding) throws ConfigurationException {
|
||||||
if (data.isEmpty()) {
|
if (data.isEmpty()) {
|
||||||
throw new ConfigurationException ("Need to call newRow first");
|
throw new ConfigurationException("Need to call newRow first");
|
||||||
}
|
}
|
||||||
data.get(data.size()-1).addColumn(new TextElement (text, alignment));
|
data.get(data.size() - 1).addColumn(new TextElement(text, alignment), padding);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDFTableContent addColumn(String text, PDFTextAlignment alignment, float padding) throws ConfigurationException {
|
|
||||||
if (data.isEmpty()) {
|
|
||||||
throw new ConfigurationException ("Need to call newRow first");
|
|
||||||
}
|
|
||||||
data.get(data.size()-1).addColumn(new TextElement (text, alignment), padding);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected TableRow getRow(int no) {
|
|
||||||
return data.get(no);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected int getRowCount() {
|
|
||||||
return data.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Coordinate addContentToPdf(PDPageContentStream cos) throws IOException, ConfigurationException {
|
protected Coordinate addContentToPdf(PDPageContentStream cos) throws IOException, ConfigurationException {
|
||||||
cos.beginText();
|
cos.beginText();
|
||||||
|
|
||||||
PDFont hFont = document.getFont(headerFont.getFontName());
|
|
||||||
PDFont standardFont = document.getFont(document.getStandardFont().getFontName());
|
|
||||||
int xOffSet = 0;
|
int xOffSet = 0;
|
||||||
for (int i = 0; i < header.size(); i++) {
|
for (int i = 0; i < columSizes.size(); i++) {
|
||||||
xOffSet -= header.getColumnSize(i);
|
xOffSet -= columSizes.get(i).getWidth();
|
||||||
}
|
}
|
||||||
int yOffset = document.getStandardFont().getFontSize() * -1 - document.getStandardFont().getPadding();
|
int yOffset = document.getStandardFont().getFontSize() * -1 - document.getStandardFont().getPadding();
|
||||||
float currentX = x;
|
float currentX = x;
|
||||||
float currentY = y;
|
float currentY = y;
|
||||||
|
|
||||||
cos.setFont(hFont, headerFont.getFontSize());
|
|
||||||
cos.newLineAtOffset(x, y);
|
cos.newLineAtOffset(x, y);
|
||||||
for (int i = 0; i < header.size(); i++) {
|
|
||||||
String headerText = header.getHeader(i);
|
|
||||||
PDFTextAlignment currentAlignment = header.getAlignment(i);
|
|
||||||
float cellPadding = header.getCellPadding(i);
|
|
||||||
|
|
||||||
float startX;
|
|
||||||
if (currentAlignment == PDFTextAlignment.RIGHT) {
|
|
||||||
|
|
||||||
float textWdith = (standardFont.getStringWidth(headerText) / 1000F) * document.getStandardFont().getFontSize();
|
|
||||||
float width = header.getColumnSize(i) - (2F * cellPadding);
|
|
||||||
startX = width - textWdith;
|
|
||||||
cos.newLineAtOffset(startX, 0);
|
|
||||||
} else {
|
|
||||||
startX = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
cos.showText(headerText);
|
|
||||||
cos.newLineAtOffset(header.getColumnSize(i) - startX, 0);
|
|
||||||
}
|
|
||||||
if (data.isEmpty()) {
|
|
||||||
currentY -= headerFont.getFontSize() - headerFont.getPadding();
|
|
||||||
}
|
|
||||||
|
|
||||||
cos.setFont(standardFont, document.getStandardFont().getFontSize());
|
|
||||||
for (int lineNo = 0; lineNo < data.size(); lineNo++) {
|
for (int lineNo = 0; lineNo < data.size(); lineNo++) {
|
||||||
TableRow currentRow = data.get(lineNo);
|
TableRow currentRow = data.get(lineNo);
|
||||||
cos.newLineAtOffset(xOffSet, yOffset);
|
|
||||||
currentY += yOffset;
|
|
||||||
for (int colNo = 0; colNo < currentRow.getColumnCount(); colNo++) {
|
for (int colNo = 0; colNo < currentRow.getColumnCount(); colNo++) {
|
||||||
String currentColText = currentRow.getColumnValue(colNo);
|
String currentColText = currentRow.getColumnValue(colNo);
|
||||||
PDFTextAlignment currentColAlignment = currentRow.getAlignment(colNo);
|
PDFTextAlignment currentColAlignment = currentRow.getAlignment(colNo);
|
||||||
float cellPadding = currentRow.getCellPadding(colNo);
|
float cellPadding = currentRow.getCellPadding(colNo);
|
||||||
float startX;
|
float colWidth = columSizes.get(colNo).getWidth();
|
||||||
|
String fontAlias = currentRow.getFontAlias(colNo);
|
||||||
|
PDFFont font;
|
||||||
|
int fontSize;
|
||||||
|
if (fontAlias != null) {
|
||||||
|
font = document.getFontByAlias(fontAlias);
|
||||||
|
fontSize = document.getFontByAlias(fontAlias).getFontSize();
|
||||||
|
} else {
|
||||||
|
font = document.getStandardFont();
|
||||||
|
fontSize = document.getStandardFont().getFontSize();
|
||||||
|
}
|
||||||
|
PDFont pdFont = document.getFont(font.getFontName());
|
||||||
|
cos.setFont(pdFont, fontSize);
|
||||||
|
|
||||||
|
float startX;
|
||||||
// FIXME duplication with header and textContent object
|
// FIXME duplication with header and textContent object
|
||||||
if (currentColAlignment == PDFTextAlignment.RIGHT) {
|
if (currentColAlignment == PDFTextAlignment.RIGHT) {
|
||||||
float textWdith = (standardFont.getStringWidth(currentColText) / 1000F) * document.getStandardFont().getFontSize();
|
float textWdith = (pdFont.getStringWidth(currentColText) / 1000F) * fontSize;
|
||||||
float width = header.getColumnSize(colNo) - (2F * cellPadding);
|
float width = colWidth - (2F * cellPadding);
|
||||||
startX = width - textWdith;
|
startX = width - textWdith;
|
||||||
LOGGER.info("Text width for {} = {}", currentColText, textWdith);
|
LOGGER.info("Text width for {} = {}", currentColText, textWdith);
|
||||||
cos.newLineAtOffset(startX, 0);
|
cos.newLineAtOffset(startX, 0);
|
||||||
@ -178,8 +179,10 @@ public class PDFTableContent extends Content {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cos.showText(currentColText);
|
cos.showText(currentColText);
|
||||||
cos.newLineAtOffset(header.getColumnSize(colNo) - startX, 0);
|
cos.newLineAtOffset(columSizes.get(colNo).getWidth() - startX, 0);
|
||||||
}
|
}
|
||||||
|
cos.newLineAtOffset(xOffSet, yOffset);
|
||||||
|
currentY += yOffset;
|
||||||
}
|
}
|
||||||
currentY += yOffset;
|
currentY += yOffset;
|
||||||
|
|
||||||
@ -188,8 +191,15 @@ public class PDFTableContent extends Content {
|
|||||||
return new Coordinate(currentX, currentY);
|
return new Coordinate(currentX, currentY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *** getter / setter *** */
|
private void validateConfiguration(TableRow lastRow, boolean calledFromSetCellValue) throws ConfigurationException {
|
||||||
public PDFFont getHeaderFont() {
|
if (data.isEmpty()) {
|
||||||
return headerFont;
|
throw new ConfigurationException("Need to call newRow first");
|
||||||
|
}
|
||||||
|
if (calledFromSetCellValue) {
|
||||||
|
if (lastRow.getColumnCount() >= columSizes.size()) {
|
||||||
|
throw new ConfigurationException("Cannot add more columns than defined");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,74 +0,0 @@
|
|||||||
package de.muehlencord.shared.pdf;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.Expose;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author joern.muehlencord
|
|
||||||
*/
|
|
||||||
class TableHeader {
|
|
||||||
|
|
||||||
@Expose
|
|
||||||
private final List<CellValue> headerCells;
|
|
||||||
|
|
||||||
public TableHeader() {
|
|
||||||
headerCells = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public TableHeader add(String headerText, int colSize) {
|
|
||||||
headerCells.add (new TextCellValue (headerText, colSize));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TableHeader add(String headerText, int colSize, float padding) {
|
|
||||||
headerCells.add (new TextCellValue (headerText, colSize));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TableHeader add(String headerText, int colSize, PDFTextAlignment align) {
|
|
||||||
headerCells.add (new TextCellValue (headerText, colSize, align));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TableHeader add(String headerText, int colSize, PDFTextAlignment align, float padding) {
|
|
||||||
headerCells.add (new TextCellValue (headerText, colSize, align, padding));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* *** getter *** */
|
|
||||||
public int size() {
|
|
||||||
return headerCells.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getColumnSize(int pos) {
|
|
||||||
return headerCells.get(pos).getColSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHeader(int pos) throws ConfigurationException {
|
|
||||||
CellValue header = headerCells.get(pos);
|
|
||||||
if (header instanceof TextCellValue) {
|
|
||||||
TextCellValue textHeader = (TextCellValue) header;
|
|
||||||
return textHeader.getCellText();
|
|
||||||
} else {
|
|
||||||
return "Unsupported";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public PDFTextAlignment getAlignment (int pos) {
|
|
||||||
CellValue header = headerCells.get(pos);
|
|
||||||
if (header instanceof TextCellValue) {
|
|
||||||
TextCellValue textHeader = (TextCellValue) header;
|
|
||||||
return textHeader.getAlignment();
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected float getCellPadding(int pos) {
|
|
||||||
return headerCells.get(pos).getCellPadding();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -18,6 +18,8 @@ abstract class TableRow {
|
|||||||
|
|
||||||
protected abstract float getCellPadding (int columnPos);
|
protected abstract float getCellPadding (int columnPos);
|
||||||
|
|
||||||
|
protected abstract String getFontAlias(int columnPos);
|
||||||
|
|
||||||
protected abstract String getListName();
|
protected abstract String getListName();
|
||||||
|
|
||||||
protected abstract String getVarName();
|
protected abstract String getVarName();
|
||||||
@ -27,4 +29,6 @@ abstract class TableRow {
|
|||||||
protected abstract void addColumn(TextElement element, float padding);
|
protected abstract void addColumn(TextElement element, float padding);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,17 @@
|
|||||||
package de.muehlencord.shared.pdf;
|
package de.muehlencord.shared.pdf.test;
|
||||||
|
|
||||||
|
import de.muehlencord.shared.pdf.ConfigurationException;
|
||||||
|
import de.muehlencord.shared.pdf.Invoice;
|
||||||
|
import de.muehlencord.shared.pdf.InvoiceLine;
|
||||||
|
import de.muehlencord.shared.pdf.PDFDocument;
|
||||||
|
import de.muehlencord.shared.pdf.PDFFont;
|
||||||
|
import de.muehlencord.shared.pdf.PDFImageContent;
|
||||||
|
import de.muehlencord.shared.pdf.PDFPaperSize;
|
||||||
|
import de.muehlencord.shared.pdf.PDFTableContent;
|
||||||
|
import de.muehlencord.shared.pdf.PDFTemplate;
|
||||||
|
import de.muehlencord.shared.pdf.PDFTextAlignment;
|
||||||
|
import de.muehlencord.shared.pdf.PDFTextContent;
|
||||||
|
import de.muehlencord.shared.pdf.TemplateException;
|
||||||
import de.muehlencord.shared.pdf.util.ImageUtil;
|
import de.muehlencord.shared.pdf.util.ImageUtil;
|
||||||
import freemarker.template.Configuration;
|
import freemarker.template.Configuration;
|
||||||
import freemarker.template.Template;
|
import freemarker.template.Template;
|
||||||
@ -49,10 +61,9 @@ public class PDFDocumentTest {
|
|||||||
doc.addContent(informationContent);
|
doc.addContent(informationContent);
|
||||||
|
|
||||||
PDFTableContent informationContent2 = new PDFTableContent(doc, doc.getStandardFont());
|
PDFTableContent informationContent2 = new PDFTableContent(doc, doc.getStandardFont());
|
||||||
informationContent2
|
informationContent2.addColumn(100, 100)
|
||||||
.addHeader("Kunden-Nr", 100)
|
.addRow("Kunden-Nr", "${invoice.customerNumber}")
|
||||||
.addHeader("${invoice.customerNumber}", 100);
|
.addRow("Rechnungs-Nr.:", "${invoice.invoiceNumber}")
|
||||||
informationContent2.addRow("Rechnungs-Nr.:", "${invoice.invoiceNumber}")
|
|
||||||
.addRow("Ausgabe: ", "Dezember")
|
.addRow("Ausgabe: ", "Dezember")
|
||||||
.addRow("Rechnungsdatum:", "${invoice.invoiceDate?date}");
|
.addRow("Rechnungsdatum:", "${invoice.invoiceDate?date}");
|
||||||
doc.addContent(informationContent2);
|
doc.addContent(informationContent2);
|
||||||
@ -65,25 +76,27 @@ public class PDFDocumentTest {
|
|||||||
doc.addContent(invoiceInfoInformation);
|
doc.addContent(invoiceInfoInformation);
|
||||||
|
|
||||||
PDFTableContent invoiceLines = new PDFTableContent(doc, doc.getFontByAlias("bold"));
|
PDFTableContent invoiceLines = new PDFTableContent(doc, doc.getFontByAlias("bold"));
|
||||||
invoiceLines.addHeader("Menge", 50, 10F)
|
invoiceLines.addColumn(50, 300, 80, 80);
|
||||||
.addHeader("Beschreibung", 300, 10F)
|
|
||||||
.addHeader("Einzelpreis", 80, PDFTextAlignment.RIGHT)
|
|
||||||
.addHeader("Summe", 80, PDFTextAlignment.RIGHT);
|
|
||||||
invoiceLines.addRow()
|
invoiceLines.addRow()
|
||||||
.addColumn("1000", PDFTextAlignment.RIGHT, 5F)
|
.setCellValue("Menge", "bold", 10F)
|
||||||
.addColumn("Anzeige Hövelhofer Rundschau")
|
.setCellValue("Beschreibung", "bold", 10F)
|
||||||
.addColumn("10,00 €", PDFTextAlignment.RIGHT)
|
.setCellValue("Einzelpreis", "bold", PDFTextAlignment.RIGHT)
|
||||||
.addColumn("10,00 €", PDFTextAlignment.RIGHT);
|
.setCellValue("Summe", "bold", PDFTextAlignment.RIGHT);
|
||||||
|
invoiceLines.addRow()
|
||||||
|
.setCellValue("1000", PDFTextAlignment.RIGHT, 5F)
|
||||||
|
.setCellValue("Anzeige Hövelhofer Rundschau")
|
||||||
|
.setCellValue("10,00 €", PDFTextAlignment.RIGHT)
|
||||||
|
.setCellValue("10,00 €", PDFTextAlignment.RIGHT);
|
||||||
invoiceLines.addListRow("invoice.invoiceLines", "invoiceline")
|
invoiceLines.addListRow("invoice.invoiceLines", "invoiceline")
|
||||||
.addColumn("${invoiceline.amount}", PDFTextAlignment.RIGHT, 5F)
|
.setCellValue("${invoiceline.amount}", PDFTextAlignment.RIGHT, 5F)
|
||||||
.addColumn("${invoiceline.description}")
|
.setCellValue("${invoiceline.description}")
|
||||||
.addColumn("${invoiceline.price}", PDFTextAlignment.RIGHT)
|
.setCellValue("${invoiceline.price}", PDFTextAlignment.RIGHT)
|
||||||
.addColumn("${invoiceline.total}", PDFTextAlignment.RIGHT);
|
.setCellValue("${invoiceline.total}", PDFTextAlignment.RIGHT);
|
||||||
invoiceLines.addRow()
|
invoiceLines.addRow()
|
||||||
.addColumn("2", PDFTextAlignment.RIGHT, 5F)
|
.setCellValue("2", PDFTextAlignment.RIGHT, 5F)
|
||||||
.addColumn("Anzeige Hövelhofer Rundschau")
|
.setCellValue("Anzeige Hövelhofer Rundschau")
|
||||||
.addColumn("10,00 €", PDFTextAlignment.RIGHT)
|
.setCellValue("10,00 €", PDFTextAlignment.RIGHT)
|
||||||
.addColumn("20,00 €", PDFTextAlignment.RIGHT);
|
.setCellValue("20,00 €", PDFTextAlignment.RIGHT);
|
||||||
doc.addContent(invoiceLines);
|
doc.addContent(invoiceLines);
|
||||||
|
|
||||||
PDFTextContent test = new PDFTextContent(doc)
|
PDFTextContent test = new PDFTextContent(doc)
|
||||||
Reference in New Issue
Block a user