Search in sources :

Example 31 with Table

use of com.itextpdf.layout.element.Table in project i7js-highlevel by itext.

the class TableProperties method createNewTable.

public Table createNewTable() {
    Table table = new Table(UnitValue.createPercentArray(2)).useAllAvailableWidth();
    table.addCell("test1");
    table.addCell("test2");
    table.addCell("test3");
    table.addCell("test4");
    table.addCell("test5");
    table.addCell("test6");
    table.addCell("test7");
    table.addCell("This is a long text snippet that " + "will be used and reused to test paragraph " + "properties. This paragraph should take " + "more than one line. We'll change different " + "properties and then look at the effect " + "when we add the paragraph to the document.");
    return table;
}
Also used : Table(com.itextpdf.layout.element.Table)

Example 32 with Table

use of com.itextpdf.layout.element.Table in project ComponentManagement by Bac3Phi.

the class ReportPaymentController method addTablePayments.

private void addTablePayments(Document document) throws SQLException {
    float[] pointColumnWidths = { 200F, 200F, 200F };
    Table table = new Table(pointColumnWidths);
    table.addCell(new Cell().add("Mã Chi Tiết Chi").setTextAlignment(TextAlignment.CENTER).setFontSize(14).setFont(font_bold));
    table.addCell(new Cell().add("Tên Mặt Hàng").setTextAlignment(TextAlignment.CENTER).setFontSize(14).setFont(font_bold));
    table.addCell(new Cell().add("Tổng Nhập").setTextAlignment(TextAlignment.CENTER).setFontSize(14).setFont(font_bold));
    resultSet = dbConn.getData("select MaCTC, TenMH, TongNhap\n" + "from CHITIETCHI CTC join MATHANG MH on CTC.MaMH = MH.MaMH\n" + "where MaBCTC = '" + txtPaymentReportId.getText() + "'");
    while (resultSet.next()) {
        table.addCell(new Cell().add(resultSet.getString("MaCTC")).setTextAlignment(TextAlignment.LEFT).setFontSize(12).setFont(font));
        table.addCell(new Cell().add(resultSet.getString("TenMH")).setTextAlignment(TextAlignment.LEFT).setFontSize(12).setFont(font));
        table.addCell(new Cell().add(String.valueOf(resultSet.getLong("TongNhap"))).setTextAlignment(TextAlignment.RIGHT).setFontSize(12).setFont(font));
    }
    document.add(table);
}
Also used : Table(com.itextpdf.layout.element.Table) Cell(com.itextpdf.layout.element.Cell)

Example 33 with Table

use of com.itextpdf.layout.element.Table in project ComponentManagement by Bac3Phi.

the class ReportPaymentController method addTableRecetpts.

private void addTableRecetpts(Document document) throws SQLException {
    float[] pointColumnWidths = { 200F, 200F, 200F };
    Table table = new Table(pointColumnWidths);
    table.addCell(new Cell().add("Mã Chi Tiết Thu").setTextAlignment(TextAlignment.CENTER).setFontSize(14).setFont(font_bold));
    table.addCell(new Cell().add("Tên Mặt Hàng").setTextAlignment(TextAlignment.CENTER).setFontSize(14).setFont(font_bold));
    table.addCell(new Cell().add("Tổng Bán").setTextAlignment(TextAlignment.CENTER).setFontSize(14).setFont(font_bold));
    resultSet = dbConn.getData("select MaCTT, TenMH, TongBan\n" + "from CHITIETTHU CTT join MATHANG MH on CTT.MaMH = MH.MaMH\n" + "where MaBCTC = '" + txtPaymentReportId.getText() + "'");
    while (resultSet.next()) {
        table.addCell(new Cell().add(resultSet.getString("MaCTT")).setTextAlignment(TextAlignment.LEFT).setFontSize(12).setFont(font));
        table.addCell(new Cell().add(resultSet.getString("TenMH")).setTextAlignment(TextAlignment.LEFT).setFontSize(12).setFont(font));
        table.addCell(new Cell().add(String.valueOf(resultSet.getLong("TongBan"))).setTextAlignment(TextAlignment.RIGHT).setFontSize(12).setFont(font));
    }
    document.add(table);
}
Also used : Table(com.itextpdf.layout.element.Table) Cell(com.itextpdf.layout.element.Cell)

Example 34 with Table

use of com.itextpdf.layout.element.Table in project ComponentManagement by Bac3Phi.

the class ReportPaymentController method addTable.

private void addTable(Document document) throws SQLException {
    float[] pointColumnWidths = { 200F, 200F, 200F, 200F, 200F, 200F, 200F };
    Table table = new Table(pointColumnWidths);
    table.addCell(new Cell().add("Mã BCTC").setTextAlignment(TextAlignment.CENTER).setFontSize(14).setFont(font_bold));
    table.addCell(new Cell().add("Nhân Viên").setTextAlignment(TextAlignment.CENTER).setFontSize(14).setFont(font_bold));
    table.addCell(new Cell().add("Tổng Thu").setTextAlignment(TextAlignment.CENTER).setFontSize(14).setFont(font_bold));
    table.addCell(new Cell().add("Tổng Chi").setTextAlignment(TextAlignment.CENTER).setFontSize(14).setFont(font_bold));
    table.addCell(new Cell().add("Ngày Lập").setTextAlignment(TextAlignment.CENTER).setFontSize(14).setFont(font_bold));
    table.addCell(new Cell().add("Loại Báo Cáo").setTextAlignment(TextAlignment.CENTER).setFontSize(14).setFont(font_bold));
    table.addCell(new Cell().add("Thời Gian").setTextAlignment(TextAlignment.CENTER).setFontSize(14).setFont(font_bold));
    ReceiptsAndPaymentsReport selectedRow = tbvReport.getSelectionModel().getSelectedItem();
    table.addCell(new Cell().add(selectedRow.getReportID()).setTextAlignment(TextAlignment.LEFT).setFontSize(12).setFont(font));
    table.addCell(new Cell().add(selectedRow.getEmployeeName()).setTextAlignment(TextAlignment.LEFT).setFontSize(12).setFont(font));
    table.addCell(new Cell().add(String.valueOf(selectedRow.getSumReceipts())).setTextAlignment(TextAlignment.RIGHT).setFontSize(12).setFont(font));
    table.addCell(new Cell().add(String.valueOf(selectedRow.getSumPayments())).setTextAlignment(TextAlignment.RIGHT).setFontSize(12).setFont(font));
    table.addCell(new Cell().add(String.valueOf(selectedRow.getPublishDate())).setTextAlignment(TextAlignment.RIGHT).setFontSize(12).setFont(font));
    table.addCell(new Cell().add(selectedRow.getType()).setTextAlignment(TextAlignment.RIGHT).setFontSize(12).setFont(font));
    table.addCell(new Cell().add(selectedRow.getDate()).setTextAlignment(TextAlignment.RIGHT).setFontSize(12).setFont(font));
    document.add(table);
}
Also used : Table(com.itextpdf.layout.element.Table) Cell(com.itextpdf.layout.element.Cell)

Example 35 with Table

use of com.itextpdf.layout.element.Table in project ComponentManagement by Bac3Phi.

the class InventoriesReportController method addTable.

private void addTable(Document document) throws SQLException {
    float[] pointColumnWidths = { 200F, 200F, 200F, 200F, 200F, 200F, 200F };
    Table table = new Table(pointColumnWidths);
    table.addCell(new Cell().add("Mã BCHT").setTextAlignment(TextAlignment.CENTER).setFontSize(14));
    table.addCell(new Cell().add("Ngày lập").setTextAlignment(TextAlignment.CENTER).setFontSize(14));
    table.addCell(new Cell().add("Tháng").setTextAlignment(TextAlignment.CENTER).setFontSize(14));
    table.addCell(new Cell().add("Tên nhân viên lập").setTextAlignment(TextAlignment.CENTER).setFontSize(14));
    table.addCell(new Cell().add("Tổng nhập").setTextAlignment(TextAlignment.CENTER).setFontSize(14));
    table.addCell(new Cell().add("Tổng bán").setTextAlignment(TextAlignment.CENTER).setFontSize(14));
    table.addCell(new Cell().add("Tổng tồn").setTextAlignment(TextAlignment.CENTER).setFontSize(14));
    InventoriesReport selectedRow = tbvReport.getSelectionModel().getSelectedItem();
    table.addCell(new Cell().add(selectedRow.getReportID()).setTextAlignment(TextAlignment.LEFT).setFontSize(12));
    table.addCell(new Cell().add(selectedRow.getPublishDate().toString()).setTextAlignment(TextAlignment.LEFT));
    table.addCell(new Cell().add(String.valueOf(selectedRow.getReportMonth())).setTextAlignment(TextAlignment.RIGHT).setFontSize(12));
    table.addCell(new Cell().add(String.valueOf(selectedRow.getEmployeeName())).setTextAlignment(TextAlignment.RIGHT).setFontSize(12));
    table.addCell(new Cell().add(String.valueOf(selectedRow.getSumImport())).setTextAlignment(TextAlignment.RIGHT).setFontSize(12));
    table.addCell(new Cell().add(String.valueOf(selectedRow.getSumSell())).setTextAlignment(TextAlignment.RIGHT).setFontSize(12));
    table.addCell(new Cell().add(String.valueOf(selectedRow.getSumStock())).setTextAlignment(TextAlignment.RIGHT).setFontSize(12));
    document.add(table);
}
Also used : Table(com.itextpdf.layout.element.Table) Cell(com.itextpdf.layout.element.Cell)

Aggregations

Table (com.itextpdf.layout.element.Table)37 Cell (com.itextpdf.layout.element.Cell)29 PdfDocument (com.itextpdf.kernel.pdf.PdfDocument)25 PdfWriter (com.itextpdf.kernel.pdf.PdfWriter)25 Document (com.itextpdf.layout.Document)25 Paragraph (com.itextpdf.layout.element.Paragraph)22 CsvTo2DList (com.itextpdf.highlevel.util.CsvTo2DList)7 List (java.util.List)7 SolidBorder (com.itextpdf.layout.borders.SolidBorder)3 DashedBorder (com.itextpdf.layout.borders.DashedBorder)2 DottedBorder (com.itextpdf.layout.borders.DottedBorder)2 Image (com.itextpdf.layout.element.Image)2 IOException (java.io.IOException)2 PdfFont (com.itextpdf.kernel.font.PdfFont)1 Rectangle (com.itextpdf.kernel.geom.Rectangle)1 PdfDocumentInfo (com.itextpdf.kernel.pdf.PdfDocumentInfo)1 PdfCanvas (com.itextpdf.kernel.pdf.canvas.PdfCanvas)1 Canvas (com.itextpdf.layout.Canvas)1 Style (com.itextpdf.layout.Style)1 SolidBorder (com.itextpdf.layout.border.SolidBorder)1