Example usage for com.lowagie.text Paragraph setAlignment

List of usage examples for com.lowagie.text Paragraph setAlignment

Introduction

In this page you can find the example usage for com.lowagie.text Paragraph setAlignment.

Prototype

public void setAlignment(String alignment) 

Source Link

Document

Sets the alignment of this paragraph.

Usage

From source file:com.jd.survey.web.pdf.StatisticsPdf.java

License:Open Source License

private void writeSubTitle(Document document, String title) throws Exception {
    Paragraph titleParagraph = new Paragraph(title, subTitleFont);
    titleParagraph.setAlignment(Element.ALIGN_LEFT);
    titleParagraph.setLeading(20);//ww  w . j a v a 2s.co m
    titleParagraph.setSpacingAfter(2);
    document.add(titleParagraph);
}

From source file:com.macrosoft.icms.util.PDFCreator.java

public static void createPdfByData(String fileName, String path, Map dataMap) {
    Document document = new Document(PageSize.A4.rotate(), 50, 50, 50, 50);
    String opetype = (String) dataMap.get("opetype");

    try {/*from   www  . j  a va  2 s  . c o m*/
        //PDF
        File file = new File(path);
        if (!file.exists()) {
            file.mkdirs();
        }
        PdfWriter.getInstance(document, new FileOutputStream(path + fileName));

        //PDF
        document.open();

        //
        BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
        Font titleChinese = new Font(bfChinese, 30, Font.BOLD);
        //table
        Font contentFont = new Font(bfChinese, 16, Font.NORMAL);
        //table
        Font tblTitleFont = new Font(bfChinese, 16, Font.BOLD);
        //PDF
        Paragraph title = new Paragraph((String) dataMap.get("title"), titleChinese);
        title.setAlignment(Paragraph.ALIGN_CENTER);
        document.add(title);

        Paragraph attionTitle = new Paragraph("", contentFont);
        attionTitle.setAlignment(Paragraph.ALIGN_CENTER);

        if ("GT".equals(opetype)) {
            Map<String, String> gtMap = (Map<String, String>) dataMap.get("gtMap");
            Table gtxxtable = new Table(5);
            int gtxxwidths[] = { 30, 15, 20, 15, 20 };
            gtxxtable.setWidths(gtxxwidths);
            gtxxtable.setWidth(100);
            gtxxtable.setPadding(3);
            gtxxtable.setBorderWidth(1);
            gtxxtable.setAlignment(Cell.ALIGN_CENTER);

            Cell cell = new Cell(new Phrase(" ", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("traname"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            cell.setColspan(4);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setRowspan(7);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("name"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("sex"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("cerno"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            cell.setColspan(3);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("dom"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            cell.setColspan(3);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("postalcode"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("tel"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("email"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            cell.setColspan(3);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("polstand"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("nation"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("litedeg"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("occstbeapp"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setRowspan(2);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("grjy"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            cell.setColspan(4);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("jtjy"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("fammember"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            cell.setColspan(2);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("busscoandform"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            cell.setColspan(4);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("oploc"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            cell.setColspan(4);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("empnum"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase("", contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            gtxxtable.addCell(cell);
            cell = new Cell(new Phrase(gtMap == null ? "" : gtMap.get("capam"), contentFont));
            cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            cell.setColspan(2);
            gtxxtable.addCell(cell);

            Paragraph p1 = new Paragraph(
                    "\n    ",
                    contentFont);
            Paragraph p2 = new Paragraph(" ", contentFont);
            p2.setIndentationLeft(500);
            Paragraph p3 = new Paragraph("                         ", contentFont);
            p3.setIndentationLeft(500);
            cell = new Cell();
            cell.add(p1);
            cell.add(p2);
            cell.add(p3);
            cell.setColspan(5);
            gtxxtable.addCell(cell);

            document.add(gtxxtable);

            Paragraph wtitle = new Paragraph("\n", titleChinese);
            wtitle.setAlignment(Paragraph.ALIGN_CENTER);
            document.add(wtitle);

            Map<String, String> wtrMap = (Map<String, String>) dataMap.get("wtrMap");
            Paragraph wtr = new Paragraph("\n :" + (wtrMap == null ? "" : wtrMap.get("sqr")),
                    contentFont);
            document.add(wtr);
            wtr = new Paragraph(" " + (wtrMap == null ? "" : wtrMap.get("wtr")), contentFont);
            document.add(wtr);
            wtr = new Paragraph("  \n", contentFont);
            document.add(wtr);
            wtr = new Paragraph("1. " + (wtrMap == null ? " " : wtrMap.get("qx1"))
                    + "  ", contentFont);
            wtr.setIndentationLeft(100);
            document.add(wtr);
            wtr = new Paragraph("2. " + (wtrMap == null ? " " : wtrMap.get("qx2"))
                    + "  ", contentFont);
            wtr.setIndentationLeft(100);
            document.add(wtr);
            wtr = new Paragraph(
                    "3. " + (wtrMap == null ? " " : wtrMap.get("qx3")) + "  ",
                    contentFont);
            wtr.setIndentationLeft(100);
            document.add(wtr);
            wtr = new Paragraph("4. " + (wtrMap == null ? " " : wtrMap.get("qx4"))
                    + "  ", contentFont);
            wtr.setIndentationLeft(100);
            document.add(wtr);

            wtr = new Paragraph("\n   " + (wtrMap == null ? "" : wtrMap.get("confrom"))
                    + "         " + (wtrMap == null ? "" : wtrMap.get("conto")) + "\n", contentFont);
            document.add(wtr);

            Table t = new Table(4);
            int twidths[] = { 20, 30, 20, 30 };
            t.setWidths(twidths);
            t.setWidth(100);
            t.setPadding(3);
            t.setBorderWidth(1);
            t.setAlignment(Cell.ALIGN_CENTER);

            Cell tCell = new Cell(new Phrase("", contentFont));
            tCell.setColspan(2);
            tCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            t.addCell(tCell);
            tCell = new Cell(new Phrase(wtrMap == null ? "" : wtrMap.get("unit"), contentFont));
            tCell.setColspan(2);
            tCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            t.addCell(tCell);
            tCell = new Cell(new Phrase("", contentFont));
            tCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            t.addCell(tCell);
            tCell = new Cell(new Phrase(wtrMap == null ? "" : wtrMap.get("postalcode"), contentFont));
            tCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            t.addCell(tCell);
            tCell = new Cell(new Phrase("", contentFont));
            tCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            t.addCell(tCell);
            tCell = new Cell(new Phrase(wtrMap == null ? "" : wtrMap.get("tel"), contentFont));
            tCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            t.addCell(tCell);
            document.add(t);

            Paragraph pp = new Paragraph("\n", contentFont);
            document.add(pp);
            pp = new Paragraph("                                                                     ",
                    contentFont);
            pp.setAlignment(Paragraph.ALIGN_RIGHT);
            document.add(pp);

        } else {
            //
            //
            Table jbxxtable = new Table(4);
            int jbxxwidths[] = { 20, 30, 20, 30 };
            jbxxtable.setWidths(jbxxwidths);
            jbxxtable.setWidth(100);
            jbxxtable.setPadding(3);
            jbxxtable.setBorderWidth(1);
            jbxxtable.setAlignment(Cell.ALIGN_CENTER);

            //
            Cell jbxxTitle = new Cell(new Phrase("", tblTitleFont));
            jbxxTitle.setColspan(4);
            jbxxTitle.setHorizontalAlignment(Element.ALIGN_CENTER);
            jbxxtable.addCell(jbxxTitle);

            Map<String, String> jbxxMap = (Map<String, String>) dataMap.get("jbxxMap");

            if ("GS".equals(opetype) || "NZFR".equals(opetype) || "HHQY".equals(opetype)
                    || "GRDZ".equals(opetype) || "WZGS".equals(opetype) || "WZHH".equals(opetype)
                    || "HZS".equals(opetype) || "HZSFZ".equals(opetype)) {
                Cell jbxxName = new Cell(new Phrase(" ", contentFont));
                jbxxName.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(jbxxName);

                Cell jbxxNameValue = new Cell(
                        new Phrase(jbxxMap == null ? "" : jbxxMap.get("entname"), contentFont));
                jbxxNameValue.setColspan(3);
                jbxxtable.addCell(jbxxNameValue);

                Cell jbxxRegno = new Cell(new Phrase("/\n", contentFont));
                jbxxRegno.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(jbxxRegno);
                if ("WZGS".equals(opetype)) {
                    Cell jbxxRegnoValue = new Cell(
                            new Phrase(jbxxMap == null ? "" : jbxxMap.get("regno"), contentFont));
                    jbxxtable.addCell(jbxxRegnoValue);
                    Cell gbc = new Cell(new Phrase("", contentFont));
                    gbc.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(gbc);
                    gbc = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("country"), contentFont));
                    gbc.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(gbc);
                } else {
                    Cell jbxxRegnoValue = new Cell(
                            new Phrase(jbxxMap == null ? "" : jbxxMap.get("regno"), contentFont));
                    jbxxRegnoValue.setColspan(3);
                    jbxxtable.addCell(jbxxRegnoValue);
                }
            } else if ("FGS".equals(opetype) || "NZYY".equals(opetype) || "HHFZ".equals(opetype)
                    || "GRDZFZ".equals(opetype) || "WZFZ".equals(opetype) || "WZHHFZ".equals(opetype)) {
                String lsdw = "";
                if ("NZYY".equals(opetype) || "WZFZ".equals(opetype) || "WZHHFZ".equals(opetype)) {
                    lsdw = "";
                }
                Cell cell = null;
                if (!"HHFZ".equals(opetype) && !"GRDZFZ".equals(opetype)) {
                    cell = new Cell(new Phrase(lsdw, contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("supentname"), contentFont));
                    jbxxtable.addCell(cell);

                    cell = new Cell(new Phrase("/", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("supregno"), contentFont));
                    jbxxtable.addCell(cell);
                }

                String fgsname = "";
                if ("NZYY".equals(opetype)) {
                    fgsname = "";
                } else if ("HHFZ".equals(opetype) || "GRDZFZ".equals(opetype) || "WZFZ".equals(opetype)
                        || "WZHHFZ".equals(opetype)) {
                    fgsname = "";
                }
                cell = new Cell(new Phrase(fgsname, contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("entname"), contentFont));
                jbxxtable.addCell(cell);

                String regname = "//";
                if ("NZYY".equals(opetype)) {
                    regname = "//";
                } else if ("NZYY".equals(opetype) || "GRDZFZ".equals(opetype) || "WZFZ".equals(opetype)) {
                    regname = "//";
                }
                cell = new Cell(new Phrase(regname, contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("regno"), contentFont));
                jbxxtable.addCell(cell);
            }
            if ("WGJY".equals(opetype)) {
                Cell cell = new Cell(new Phrase(" ", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("entname"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("/", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("regno"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(" ", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("dom"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
            } else if ("WGDB".equals(opetype)) {
                Cell cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("entname"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("/", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("regno"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("dom"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
            } else {
                String domname = "";
                if ("FGS".equals(opetype) || "WZHHFZ".equals(opetype)) {
                    domname = "";
                } else if ("GRDZ".equals(opetype)) {
                    domname = "";
                } else if ("GRDZFZ".equals(opetype) || "HHFZ".equals(opetype) || "HZSFZ".equals(opetype)) {
                    domname = "";
                } else if ("WZHH".equals(opetype) || "HHQY".equals(opetype)) {
                    domname = "";
                }
                Cell jbxxDom = new Cell(new Phrase(domname, contentFont));
                jbxxDom.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(jbxxDom);

                Cell jbxxDomValue = new Cell(
                        new Phrase(jbxxMap == null ? "" : jbxxMap.get("dom"), contentFont));
                jbxxDomValue.setColspan(3);
                jbxxtable.addCell(jbxxDomValue);

                Cell jbxxOploc = new Cell(new Phrase("", contentFont));
                jbxxOploc.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(jbxxOploc);

                Cell jbxxOplocValue = new Cell(
                        new Phrase(jbxxMap == null ? "" : jbxxMap.get("oploc"), contentFont));
                jbxxOplocValue.setColspan(3);
                jbxxtable.addCell(jbxxOplocValue);
            }

            Cell jbxxTel = new Cell(new Phrase("", contentFont));
            jbxxTel.setHorizontalAlignment(Element.ALIGN_CENTER);
            jbxxtable.addCell(jbxxTel);

            Cell jbxxTelValue = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("tel"), contentFont));
            jbxxTelValue.setHorizontalAlignment(Element.ALIGN_CENTER);
            jbxxtable.addCell(jbxxTelValue);

            Cell jbxxEmail = new Cell(new Phrase("", contentFont));
            jbxxEmail.setHorizontalAlignment(Element.ALIGN_CENTER);
            jbxxtable.addCell(jbxxEmail);

            Cell jbxxEmailValue = new Cell(
                    new Phrase(jbxxMap == null ? "" : jbxxMap.get("postalcode"), contentFont));
            jbxxEmailValue.setHorizontalAlignment(Element.ALIGN_CENTER);
            jbxxtable.addCell(jbxxEmailValue);

            //
            String slname = " ";
            if ("NZFR".equals(opetype) || "NZYY".equals(opetype) || "WGJY".equals(opetype)) {
                slname = "";
            }
            Cell slTitle = new Cell(new Phrase(slname, tblTitleFont));
            slTitle.setColspan(4);
            slTitle.setHorizontalAlignment(Element.ALIGN_CENTER);
            jbxxtable.addCell(slTitle);

            if ("GS".equals(opetype) || "NZFR".equals(opetype) || "WZGS".equals(opetype)) {
                Cell jbxxLerep = new Cell(new Phrase("", contentFont));
                jbxxLerep.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(jbxxLerep);

                Cell jbxxLerepValue = new Cell(
                        new Phrase(jbxxMap == null ? "" : jbxxMap.get("lerep"), contentFont));
                jbxxLerepValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(jbxxLerepValue);

                if ("WZGS".equals(opetype)) {
                    Cell cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("country"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("position"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    cell.setColspan(3);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("congro"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("congrocur"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("congrousd"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("regcap"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("enttype"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("insform"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase("\n\n\n", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("busscope"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    cell.setColspan(3);
                    jbxxtable.addCell(cell);
                } else {
                    Cell jbxxPosition = new Cell(new Phrase(" ", contentFont));
                    jbxxPosition.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(jbxxPosition);

                    Cell jbxxPositionValue = new Cell(
                            new Phrase(jbxxMap == null ? "" : jbxxMap.get("position"), contentFont));
                    jbxxPositionValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(jbxxPositionValue);

                    String regcapname = "";
                    if ("NZFR".equals(opetype)) {
                        regcapname = "";
                    }
                    Cell jbxxRegcap = new Cell(new Phrase(regcapname, contentFont));
                    jbxxRegcap.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(jbxxRegcap);

                    Cell jbxxRegcapValue = new Cell(
                            new Phrase(jbxxMap == null ? "" : jbxxMap.get("regcap"), contentFont));
                    jbxxRegcapValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(jbxxRegcapValue);

                    String enttypename = "";
                    if ("NZFR".equals(opetype)) {
                        enttypename = "";
                    }
                    Cell jbxxEnttype = new Cell(new Phrase(enttypename, contentFont));
                    jbxxEnttype.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(jbxxEnttype);

                    Cell jbxxEnttypeValue = new Cell(
                            new Phrase(jbxxMap == null ? "" : jbxxMap.get("enttype"), contentFont));
                    jbxxEnttypeValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(jbxxEnttypeValue);
                }

                if ("GS".equals(opetype)) {
                    Cell jbxxInsform = new Cell(new Phrase("\n", contentFont));
                    jbxxInsform.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(jbxxInsform);

                    Cell jbxxInsformValue = new Cell(
                            new Phrase(jbxxMap == null ? "" : jbxxMap.get("insform"), contentFont));
                    jbxxInsformValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxInsformValue.setColspan(3);
                    jbxxtable.addCell(jbxxInsformValue);

                    Cell jbxxBusscope = new Cell(new Phrase("\n\n\n", contentFont));
                    jbxxBusscope.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(jbxxBusscope);

                    Cell jbxxBusscopeValue = new Cell(
                            new Phrase(jbxxMap == null ? "" : jbxxMap.get("busscope"), contentFont));
                    jbxxBusscopeValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxBusscopeValue.setColspan(3);
                    jbxxtable.addCell(jbxxBusscopeValue);
                }

                Cell jbxxOpfyears = new Cell(new Phrase("", contentFont));
                jbxxOpfyears.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(jbxxOpfyears);

                Cell jbxxOpfyearsValue = new Cell(
                        new Phrase(jbxxMap == null ? "" : jbxxMap.get("opfyears"), contentFont));
                jbxxOpfyearsValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(jbxxOpfyearsValue);

                Cell jbxxConum = new Cell(new Phrase("", contentFont));
                jbxxConum.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(jbxxConum);

                Cell jbxxConumValue = new Cell(
                        new Phrase(jbxxMap == null ? "" : jbxxMap.get("conum"), contentFont));
                jbxxConumValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(jbxxConumValue);

                if ("NZFR".equals(opetype)) {
                    Cell jbxxBusscope = new Cell(new Phrase("\n\n\n", contentFont));
                    jbxxBusscope.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(jbxxBusscope);

                    Cell jbxxBusscopeValue = new Cell(
                            new Phrase(jbxxMap == null ? "" : jbxxMap.get("busscope"), contentFont));
                    jbxxBusscopeValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxBusscopeValue.setColspan(3);
                    jbxxtable.addCell(jbxxBusscopeValue);
                }
            } else if ("FGS".equals(opetype) || "NZYY".equals(opetype) || "HHFZ".equals(opetype)
                    || "GRDZFZ".equals(opetype) || "WZFZ".equals(opetype) || "WZHHFZ".equals(opetype)
                    || "HZSFZ".equals(opetype)) {
                Cell cell = null;
                if ("HHFZ".equals(opetype) || "GRDZFZ".equals(opetype)) {
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("lerep"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("houseadd"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("cerno"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("empno"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("tel"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("postalcode"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("yysj"), contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    cell.setColspan(3);
                    jbxxtable.addCell(cell);
                } else {
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("lerep"), contentFont));
                    jbxxtable.addCell(cell);
                    if ("NZYY".equals(opetype)) {
                        cell = new Cell(new Phrase("", contentFont));
                        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        jbxxtable.addCell(cell);
                        cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("tel"), contentFont));
                        jbxxtable.addCell(cell);
                        cell = new Cell(new Phrase("", contentFont));
                        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        jbxxtable.addCell(cell);
                        cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("regcap"), contentFont));
                        jbxxtable.addCell(cell);
                    }
                    cell = new Cell(new Phrase("", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    jbxxtable.addCell(cell);
                    cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("conum"), contentFont));
                    jbxxtable.addCell(cell);
                }

                String bussname = "";
                if ("FGS".equals(opetype)) {
                    bussname = "";
                } else if ("HHFZ".equals(opetype) || "GRDZFZ".equals(opetype) || "WZHHFZ".equals(opetype)) {
                    bussname = "";
                }
                cell = new Cell(new Phrase(bussname, contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("busscope"), contentFont));
                cell.setColspan(3);
                jbxxtable.addCell(cell);

                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(
                        new Phrase(jbxxMap == null ? "" : jbxxMap.get("calculationmethod"), contentFont));
                cell.setColspan(3);
                jbxxtable.addCell(cell);
            } else if ("HHQY".equals(opetype)) {
                Cell hhcell = new Cell(new Phrase("", contentFont));
                hhcell.setRowspan(2);
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase("", contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                hhcell.setColspan(2);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("lerep"), contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(
                        new Phrase("", contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                hhcell.setColspan(2);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase("", contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase("", contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("hhlx"), contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                hhcell.setColspan(3);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase("", contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("hhcze"), contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                hhcell.setColspan(3);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase("\n\n\n", contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("busscope"), contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                hhcell.setColspan(3);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase("", contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase(" ______________________________________________",
                        contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                hhcell.setColspan(3);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase("", contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("parnum"), contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase("", contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("exenum"), contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase("", contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(hhcell);
                hhcell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("empnum"), contentFont));
                hhcell.setHorizontalAlignment(Element.ALIGN_CENTER);
                hhcell.setColspan(3);
                jbxxtable.addCell(hhcell);
            } else if ("GRDZ".equals(opetype)) {
                Cell cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("regcap"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("empnum"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("grczfs"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("\n\n\n", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("busscope"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
            } else if ("WZHH".equals(opetype)) {
                Cell cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("lerep"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("  ", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("country"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("regcap"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("reccap"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("regcapcur"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("enttype"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("\n\n\n", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("busscope"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("opfyears"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("conum"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
            } else if ("WGJY".equals(opetype)) {
                Cell cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("enttype"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("depincha"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("exaauth"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("sandate"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("lerep"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("busscope"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("regcap"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("regcapcur"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("yysj"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("itemofoporcpro"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("forentname"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("forentadd"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("forentscope"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
            } else if ("WGDB".equals(opetype)) {
                Cell cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("lerep"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("busscope"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("yysj"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("regorg"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("yysj"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("sandate"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("sandocno"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);

                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(4);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("forentname"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("forentforname"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(" ", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("forentadd"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("cxqx"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("forentautsign"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("forenliafor"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("forentcap"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("country"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("forentscope"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
            } else if ("HZS".equals(opetype)) {
                Cell cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("lerep"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("regcap"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
                Paragraph p1 = new Paragraph("    " + dataMap.get("cyzs") + "     ",
                        contentFont);
                Paragraph p2 = new Paragraph("    " + dataMap.get("nmcy")
                        + "          " + dataMap.get("nmcyrate") + "   %", contentFont);
                p2.setIndentationLeft(60);
                Paragraph p3 = new Paragraph("     " + dataMap.get("frcy")
                        + "          " + dataMap.get("frcyrate") + "   %", contentFont);
                p3.setIndentationLeft(120);

                cell = new Cell();
                cell.add(p1);
                cell.add(p2);
                cell.add(p3);
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(4);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase("\n\n\n", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                jbxxtable.addCell(cell);
                cell = new Cell(new Phrase(jbxxMap == null ? "" : jbxxMap.get("busscope"), contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(3);
                jbxxtable.addCell(cell);
            }

            document.add(jbxxtable);

            //
            //TABLE
            Table remarktable = new Table(6);
            int remarkwidths[] = { 15, 10, 20, 15, 20, 20 };
            remarktable.setWidths(remarkwidths);
            remarktable.setWidth(100);
            remarktable.setPadding(3);
            remarktable.setBorderWidth(1);
            remarktable.setAlignment(Cell.ALIGN_CENTER);
            if ("GS".equals(opetype) || "NZFR".equals(opetype) || "HHQY".equals(opetype)
                    || "HHFZ".equals(opetype) || "GRDZ".equals(opetype) || "GRDZFZ".equals(opetype)
                    || "WZGS".equals(opetype) || "WZHH".equals(opetype) || "HZS".equals(opetype)) {
                Cell bgTitle = new Cell(new Phrase("", tblTitleFont));
                bgTitle.setColspan(6);
                bgTitle.setHorizontalAlignment(Element.ALIGN_CENTER);
                remarktable.addCell(bgTitle);

                Cell bg1 = new Cell(new Phrase("", contentFont));
                bg1.setColspan(2);
                bg1.setHorizontalAlignment(Element.ALIGN_CENTER);
                remarktable.addCell(bg1);

                Cell bg2 = new Cell(new Phrase("", contentFont));
                bg2.setColspan(2);
                bg2.setHorizontalAlignment(Element.ALIGN_CENTER);
                remarktable.addCell(bg2);

                Cell bg3 = new Cell(new Phrase("", contentFont));
                bg3.setColspan(2);
                bg3.setHorizontalAlignment(Element.ALIGN_CENTER);
                remarktable.addCell(bg3);

                for (int i = 0; i < 5; i++) {
                    Cell bg11 = new Cell("");
                    bg11.setColspan(2);
                    remarktable.addCell(bg11);

                    Cell bg21 = new Cell(" ");
                    bg21.setColspan(2);
                    remarktable.addCell(bg21);

                    Cell bg31 = new Cell(" ");
                    bg31.setColspan(2);
                    remarktable.addCell(bg31);
                }

                if ("GS".equals(opetype) || "HHQY".equals(opetype) || "GRDZ".equals(opetype)
                        || "WZGS".equals(opetype) || "WZHH".equals(opetype) || "HZS".equals(opetype)) {
                    Cell baTitle = new Cell(new Phrase(" ", tblTitleFont));
                    baTitle.setColspan(6);
                    baTitle.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(baTitle);

                    Cell fgsCell = new Cell(new Phrase("\n", contentFont));
                    fgsCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    fgsCell.setRowspan(2);
                    remarktable.addCell(fgsCell);

                    Cell nameCell = new Cell(new Phrase("", contentFont));
                    nameCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nameCell);

                    Cell nameValueCell = new Cell(new Phrase("", contentFont));
                    remarktable.addCell(nameValueCell);

                    Cell regnoCell = new Cell(new Phrase("/", contentFont));
                    regnoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    regnoCell.setColspan(2);
                    remarktable.addCell(regnoCell);

                    Cell regnoValueCell = new Cell(new Phrase("", contentFont));
                    remarktable.addCell(regnoValueCell);

                    Cell djjgCell = new Cell(new Phrase("", contentFont));
                    djjgCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(djjgCell);

                    Cell djjgValueCell = new Cell(new Phrase("", contentFont));
                    remarktable.addCell(djjgValueCell);

                    Cell djrqCell = new Cell(new Phrase("", contentFont));
                    djrqCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    djrqCell.setColspan(2);
                    remarktable.addCell(djrqCell);

                    Cell djrqValueCell = new Cell(new Phrase("", contentFont));
                    remarktable.addCell(djrqValueCell);

                    if ("GRDZ".equals(opetype)) {
                        Cell qtc = new Cell(new Phrase("", contentFont));
                        qtc.setHorizontalAlignment(Element.ALIGN_CENTER);
                        remarktable.addCell(qtc);
                        qtc = new Cell(new Phrase("     ", contentFont));
                        qtc.setHorizontalAlignment(Element.ALIGN_CENTER);
                        qtc.setColspan(5);
                        remarktable.addCell(qtc);
                    } else {
                        Cell qszCell = new Cell(new Phrase("", contentFont));
                        qszCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        qszCell.setRowspan(2);
                        remarktable.addCell(qszCell);

                        Cell cyCell = new Cell(new Phrase("", contentFont));
                        cyCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        remarktable.addCell(cyCell);

                        Cell cyValueCell = new Cell(new Phrase("", contentFont));
                        cyValueCell.setColspan(4);
                        remarktable.addCell(cyValueCell);

                        Cell fzrCell = new Cell(new Phrase("", contentFont));
                        fzrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        remarktable.addCell(fzrCell);

                        Cell fzrValueCell = new Cell(new Phrase("", contentFont));
                        remarktable.addCell(fzrValueCell);

                        Cell lxdhCell = new Cell(new Phrase("", contentFont));
                        lxdhCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        lxdhCell.setColspan(2);
                        remarktable.addCell(lxdhCell);

                        Cell lxdhValueCell = new Cell(new Phrase("", contentFont));
                        remarktable.addCell(lxdhValueCell);
                    }

                    if ("GS".equals(opetype) || "WZGS".equals(opetype)) {
                        Cell qtCell = new Cell(new Phrase("", contentFont));
                        qtCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        remarktable.addCell(qtCell);
                        Cell qtValueCell = new Cell(new Phrase(
                                "                    ",
                                contentFont));
                        qtValueCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        qtValueCell.setColspan(5);
                        remarktable.addCell(qtValueCell);
                    } else if ("HHQY".equals(opetype)) {
                        Cell qtCell = new Cell(new Phrase("", contentFont));
                        qtCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        remarktable.addCell(qtCell);
                        Cell qtValueCell = new Cell(
                                new Phrase("        ", contentFont));
                        qtValueCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        qtValueCell.setColspan(5);
                        remarktable.addCell(qtValueCell);
                        qtCell = new Cell(new Phrase("", contentFont));
                        qtCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        remarktable.addCell(qtCell);
                        qtValueCell = new Cell(new Phrase("         ", contentFont));
                        qtValueCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        qtValueCell.setColspan(5);
                        remarktable.addCell(qtValueCell);
                    }

                } else if ("NZFR".equals(opetype)) {
                    Cell nzfrCell = new Cell(new Phrase("", contentFont));
                    nzfrCell.setRowspan(2);
                    nzfrCell.setColspan(2);
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase("", contentFont));
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase("", contentFont));
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase("", contentFont));
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase("", contentFont));
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase("  ", contentFont));
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase("  ", contentFont));
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase("", contentFont));
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase("  ", contentFont));
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);

                    nzfrCell = new Cell(new Phrase(" ", tblTitleFont));
                    nzfrCell.setColspan(6);
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);

                    nzfrCell = new Cell(new Phrase("\n", contentFont));
                    nzfrCell.setRowspan(4);
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);

                    nzfrCell = new Cell(new Phrase("", contentFont));
                    nzfrCell.setColspan(2);
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase(" ", contentFont));
                    nzfrCell.setColspan(3);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase("", contentFont));
                    nzfrCell.setColspan(2);
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase(" ", contentFont));
                    nzfrCell.setColspan(3);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase("", contentFont));
                    nzfrCell.setColspan(2);
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase(" ", contentFont));
                    nzfrCell.setColspan(3);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase("", contentFont));
                    nzfrCell.setColspan(2);
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase(" ", contentFont));
                    nzfrCell.setColspan(3);
                    remarktable.addCell(nzfrCell);

                    nzfrCell = new Cell(new Phrase("", contentFont));
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase("    ", contentFont));
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    nzfrCell.setColspan(2);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase("", contentFont));
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(nzfrCell);
                    nzfrCell = new Cell(new Phrase("     ", contentFont));
                    nzfrCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    nzfrCell.setColspan(2);
                    remarktable.addCell(nzfrCell);
                }
            } else if ("FGS".equals(opetype) || "NZYY".equals(opetype) || "WZFZ".equals(opetype)
                    || "WZHHFZ".equals(opetype) || "WGJY".equals(opetype) || "WGDB".equals(opetype)
                    || "HZSFZ".equals(opetype)) {
                Cell fgsCell = new Cell(new Phrase("/", tblTitleFont));
                fgsCell.setColspan(6);
                fgsCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                remarktable.addCell(fgsCell);

                fgsCell = new Cell(new Phrase("/", contentFont));
                fgsCell.setColspan(2);
                fgsCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                remarktable.addCell(fgsCell);

                fgsCell = new Cell(new Phrase("/", contentFont));
                fgsCell.setColspan(2);
                fgsCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                remarktable.addCell(fgsCell);

                fgsCell = new Cell(new Phrase("/", contentFont));
                fgsCell.setColspan(2);
                fgsCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                remarktable.addCell(fgsCell);

                for (int i = 0; i < 3; i++) {
                    fgsCell = new Cell("");
                    fgsCell.setColspan(2);
                    remarktable.addCell(fgsCell);

                    fgsCell = new Cell(" ");
                    fgsCell.setColspan(2);
                    remarktable.addCell(fgsCell);

                    fgsCell = new Cell(" ");
                    fgsCell.setColspan(2);
                    remarktable.addCell(fgsCell);
                }

                if ("FGS".equals(opetype) || "HZSFZ".equals(opetype)) {
                    fgsCell = new Cell(new Phrase(" ", tblTitleFont));
                    fgsCell.setColspan(6);
                    fgsCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(fgsCell);
                    fgsCell = new Cell(new Phrase("", contentFont));
                    fgsCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(fgsCell);
                    fgsCell = new Cell(new Phrase(
                            "  1;      2;\n  3;  4",
                            contentFont));
                    fgsCell.setHorizontalAlignment(Element.ALIGN_LEFT);
                    fgsCell.setColspan(5);
                    remarktable.addCell(fgsCell);

                    fgsCell = new Cell(new Phrase("", contentFont));
                    fgsCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(fgsCell);
                    fgsCell = new Cell(new Phrase("       ", contentFont));
                    fgsCell.setHorizontalAlignment(Element.ALIGN_LEFT);
                    fgsCell.setColspan(5);
                    remarktable.addCell(fgsCell);
                } else if ("NZYY".equals(opetype)) {
                    fgsCell = new Cell(new Phrase(" ", tblTitleFont));
                    fgsCell.setColspan(6);
                    fgsCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(fgsCell);
                    fgsCell = new Cell(new Phrase("", contentFont));
                    fgsCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(fgsCell);
                    fgsCell = new Cell(new Phrase(
                            "  1;     2;\n  3 3; 4",
                            contentFont));
                    fgsCell.setHorizontalAlignment(Element.ALIGN_LEFT);
                    fgsCell.setColspan(5);
                    remarktable.addCell(fgsCell);

                    fgsCell = new Cell(new Phrase("", contentFont));
                    fgsCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(fgsCell);
                    fgsCell = new Cell(
                            new Phrase("   ", contentFont));
                    fgsCell.setHorizontalAlignment(Element.ALIGN_LEFT);
                    fgsCell.setColspan(5);
                    remarktable.addCell(fgsCell);
                    fgsCell = new Cell(new Phrase("", contentFont));
                    fgsCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(fgsCell);
                    fgsCell = new Cell(new Phrase("       ", contentFont));
                    fgsCell.setHorizontalAlignment(Element.ALIGN_LEFT);
                    fgsCell.setColspan(5);
                    remarktable.addCell(fgsCell);

                    fgsCell = new Cell(new Phrase("", contentFont));
                    fgsCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(fgsCell);
                    fgsCell = new Cell(new Phrase("            ", contentFont));
                    fgsCell.setHorizontalAlignment(Element.ALIGN_LEFT);
                    fgsCell.setColspan(5);
                    remarktable.addCell(fgsCell);
                }
            }

            if ("HHFZ".equals(opetype) || "GRDZ".equals(opetype) || "GRDZFZ".equals(opetype)
                    || "WZFZ".equals(opetype) || "WZHHFZ".equals(opetype)) {
                Cell cell = null;
                cell = new Cell(new Phrase(" ", tblTitleFont));
                cell.setColspan(6);
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                remarktable.addCell(cell);

                cell = new Cell(new Phrase(" ", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                remarktable.addCell(cell);
                if ("HHFZ".equals(opetype) || "GRDZFZ".equals(opetype) || "WZFZ".equals(opetype)
                        || "WZHHFZ".equals(opetype)) {
                    cell = new Cell(new Phrase(
                            " 1.       2.\n 3.       4. ",
                            contentFont));
                } else if ("GRDZ".equals(opetype)) {
                    cell = new Cell(new Phrase(
                            " \n \n \n __________________ ",
                            contentFont));
                }
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(5);
                remarktable.addCell(cell);
                if ("GRDZ".equals(opetype)) {
                    cell = new Cell(new Phrase(" ", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    remarktable.addCell(cell);
                    cell = new Cell(new Phrase(" ", contentFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                    cell.setColspan(5);
                    remarktable.addCell(cell);
                }
                cell = new Cell(new Phrase(" ", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                remarktable.addCell(cell);
                cell = new Cell(new Phrase("      ", contentFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                cell.setColspan(5);
                remarktable.addCell(cell);
            }

            //
            Cell sqrTitle = new Cell(new Phrase("", tblTitleFont));
            sqrTitle.setColspan(6);
            sqrTitle.setHorizontalAlignment(Element.ALIGN_CENTER);
            remarktable.addCell(sqrTitle);

            String sqrtext = "";
            if ("GS".equals(opetype) || "WZGS".equals(opetype)) {
                sqrtext = "\n       \n";
            } else if ("FGS".equals(opetype)) {
                sqrtext = "\n      \n";
            } else if ("NZFR".equals(opetype)) {
                sqrtext = "\n      \n";
            } else if ("NZYY".equals(opetype)) {
                sqrtext = "\n       \n";
            } else if ("HHQY".equals(opetype) || "WZHH".equals(opetype)) {
                sqrtext = "\n      \n";
            } else if ("HHFZ".equals(opetype) || "GRDZFZ".equals(opetype) || "WZFZ".equals(opetype)
                    || "WZHHFZ".equals(opetype)) {
                sqrtext = "\n      \n";
            } else if ("GRDZ".equals(opetype)) {
                sqrtext = "\n      \n";
            } else if ("WGJY".equals(opetype)) {
                sqrtext = "\n      \n";
            } else if ("WGDB".equals(opetype)) {
                sqrtext = "\n       \n";
            } else if ("HZS".equals(opetype) || "HZSFZ".equals(opetype)) {
                sqrtext = "\n      \n";
            }
            Paragraph sqrp = new Paragraph(sqrtext, contentFont);
            String fdbdrname = "";
            if ("HHQY".equals(opetype) || "WZHH".equals(opetype)) {
                fdbdrname = "";
            } else if ("HHFZ".equals(opetype) || "GRDZFZ".equals(opetype) || "WZFZ".equals(opetype)
                    || "WZHHFZ".equals(opetype)) {
                fdbdrname = "\n  \n  ";
            } else if ("GRDZ".equals(opetype)) {
                fdbdrname = "";
            } else if ("WGJY".equals(opetype) || "WGDB".equals(opetype)) {
                fdbdrname = ":";
            }
            Paragraph fdbdr = new Paragraph("      " + fdbdrname
                    + "                                                                                                        ",
                    contentFont);
            fdbdr.setFirstLineIndent(40);
            Paragraph fzrqz = new Paragraph(
                    "    " + (("GS".equals(opetype)
                            || "HHQY".equals(opetype) || "WZHH".equals(opetype) || "GRDZ".equals(opetype)
                            || "WZGS".equals(opetype) || "HZS".equals(opetype))
                                    ? ""
                                    : "")
                            + "                                                                                                                                              ",
                    contentFont);
            fzrqz.setFirstLineIndent(40);
            Cell allCell = new Cell();
            allCell.add(sqrp);
            allCell.add(fdbdr);
            allCell.add(fzrqz);
            allCell.setColspan(6);
            remarktable.addCell(allCell);

            document.add(remarktable);

            //
            if ("GRDZ".equals(opetype)) {
                Paragraph lerepTitle = new Paragraph("\n", titleChinese);
                lerepTitle.setAlignment(Paragraph.ALIGN_CENTER);
                document.add(lerepTitle);

                //TABLE
                Table lereptable = new Table(4);
                int lerepwidths[] = { 20, 30, 20, 30 };
                lereptable.setWidths(lerepwidths);
                lereptable.setWidth(100);
                lereptable.setPadding(3);
                lereptable.setBorderWidth(1);
                lereptable.setAlignment(Cell.ALIGN_CENTER);

                Map<String, String> lerepMap = (Map<String, String>) dataMap.get("lerepMap");
                Cell lerep1 = new Cell(new Phrase(" ", contentFont));
                lerep1.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep1);
                Cell lerep2 = new Cell(new Phrase(lerepMap == null ? "" : lerepMap.get("name"), contentFont));
                lerep2.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep2);
                Cell lerep3 = new Cell(new Phrase(" ", contentFont));
                lerep3.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep3);
                Cell lerep4 = new Cell(new Phrase(lerepMap == null ? "" : lerepMap.get("sex"), contentFont));
                lerep4.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep4);

                Cell lerep5 = new Cell(new Phrase("", contentFont));
                lerep5.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep5);
                Cell lerep6 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("natdate"), contentFont));
                lerep6.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep6);
                Cell lerep7 = new Cell(new Phrase(" ", contentFont));
                lerep7.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep7);
                Cell lerep8 = new Cell(new Phrase(lerepMap == null ? "" : lerepMap.get("nation"), contentFont));
                lerep8.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep8);

                Cell lerep9 = new Cell(new Phrase("", contentFont));
                lerep9.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep9);
                Cell lerep10 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("litedeg"), contentFont));
                lerep10.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep10);
                Cell lerep11 = new Cell(new Phrase("", contentFont));
                lerep11.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep11);
                Cell lerep12 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("polstand"), contentFont));
                lerep12.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep12);

                Cell lerep13 = new Cell(new Phrase("", contentFont));
                lerep13.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep13);
                Cell lerep14 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("mobile"), contentFont));
                lerep14.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep14);
                Cell lerep15 = new Cell(new Phrase("", contentFont));
                lerep15.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep15);
                Cell lerep16 = new Cell(new Phrase(lerepMap == null ? "" : lerepMap.get("email"), contentFont));
                lerep16.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep16);

                Cell lerep17 = new Cell(new Phrase("", contentFont));
                lerep17.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep17);
                Cell lerep18 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("certype"), contentFont));
                lerep18.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep18);
                Cell lerep19 = new Cell(new Phrase("", contentFont));
                lerep19.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep19);
                Cell lerep20 = new Cell(new Phrase(lerepMap == null ? "" : lerepMap.get("cerno"), contentFont));
                lerep20.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep20);

                Cell lerep21 = new Cell(new Phrase(" ", contentFont));
                lerep21.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep21);
                Cell lerep22 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("houseadd"), contentFont));
                lerep22.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep22);
                Cell lerep23 = new Cell(new Phrase("", contentFont));
                lerep23.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep23);
                Cell lerep24 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("postalcode"), contentFont));
                lerep24.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep24);

                Cell lerep25 = new Cell(new Phrase("", contentFont));
                lerep25.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep25);
                Cell lerep26 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("occstbeapp"), contentFont));
                lerep26.setHorizontalAlignment(Element.ALIGN_CENTER);
                lerep26.setColspan(3);
                lereptable.addCell(lerep26);

                document.add(lereptable);
            } else if ("WGDB".equals(opetype)) {
                Paragraph lerepTitle1 = new Paragraph("\n", titleChinese);
                lerepTitle1.setAlignment(Paragraph.ALIGN_CENTER);
                document.add(lerepTitle1);
                Paragraph lerepTitle2 = new Paragraph("/", titleChinese);
                lerepTitle2.setAlignment(Paragraph.ALIGN_CENTER);
                document.add(lerepTitle2);

                //TABLE
                Table lereptable = new Table(4);
                int lerepwidths[] = { 20, 30, 20, 30 };
                lereptable.setWidths(lerepwidths);
                lereptable.setWidth(100);
                lereptable.setPadding(3);
                lereptable.setBorderWidth(1);
                lereptable.setAlignment(Cell.ALIGN_CENTER);

                Map<String, String> lerepMap = (Map<String, String>) dataMap.get("lerepMap");
                Cell lerep1 = new Cell(new Phrase("", contentFont));
                lerep1.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep1);
                Cell lerep2 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("entname"), contentFont));
                lerep2.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep2);
                Cell lerep3 = new Cell(new Phrase("", contentFont));
                lerep3.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep3);
                Cell lerep4 = new Cell(new Phrase(lerepMap == null ? "" : lerepMap.get("name"), contentFont));
                lerep4.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep4);

                Cell lerep5 = new Cell(new Phrase("", contentFont));
                lerep5.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep5);
                Cell lerep6 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("position"), contentFont));
                lerep6.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep6);
                Cell lerep7 = new Cell(new Phrase("", contentFont));
                lerep7.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep7);
                Cell lerep8 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("country"), contentFont));
                lerep8.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep8);

                Cell lerep9 = new Cell(new Phrase("", contentFont));
                lerep9.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep9);
                Cell lerep10 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("arrchdate"), contentFont));
                lerep10.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep10);
                Cell lerep11 = new Cell(new Phrase("", contentFont));
                lerep11.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep11);
                Cell lerep12 = new Cell(new Phrase(lerepMap == null ? "" : lerepMap.get("tel"), contentFont));
                lerep12.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep12);

                Cell lerep13 = new Cell(new Phrase("", contentFont));
                lerep13.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep13);
                Cell lerep14 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("certype"), contentFont));
                lerep14.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep14);
                Cell lerep15 = new Cell(new Phrase("", contentFont));
                lerep15.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep15);
                Cell lerep16 = new Cell(new Phrase(lerepMap == null ? "" : lerepMap.get("cerno"), contentFont));
                lerep16.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep16);

                Cell lerep17 = new Cell(new Phrase("", contentFont));
                lerep17.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep17);
                Cell lerep18 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("houaddinchina"), contentFont));
                lerep18.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep18);
                Cell lerep19 = new Cell(new Phrase("", contentFont));
                lerep19.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep19);
                Cell lerep20 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("repdate"), contentFont));
                lerep20.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep20);

                Paragraph rep1 = new Paragraph("",
                        contentFont);
                rep1.setAlignment(Paragraph.ALIGN_LEFT);
                Paragraph rep2 = new Paragraph("1",
                        contentFont);
                rep2.setAlignment(Paragraph.ALIGN_LEFT);
                Paragraph rep3 = new Paragraph(
                        "25",
                        contentFont);
                rep3.setAlignment(Paragraph.ALIGN_LEFT);
                Paragraph rep4 = new Paragraph("3", contentFont);
                rep4.setAlignment(Paragraph.ALIGN_LEFT);
                Paragraph rep5 = new Paragraph("/", contentFont);
                rep5.setAlignment(Paragraph.ALIGN_LEFT);
                rep5.setIndentationLeft(200);

                Cell lerep21 = new Cell();
                lerep21.add(rep1);
                lerep21.add(rep2);
                lerep21.add(rep3);
                lerep21.add(rep4);
                lerep21.add(rep5);
                lerep21.setColspan(4);
                lereptable.addCell(lerep21);

                document.add(lereptable);
            } else {
                Paragraph lerepTitle = null;
                if ("GS".equals(opetype) || "NZFR".equals(opetype) || "WZGS".equals(opetype)
                        || "HZS".equals(opetype)) {
                    lerepTitle = new Paragraph("\n", titleChinese);
                } else if ("FGS".equals(opetype) || "NZYY".equals(opetype) || "HHFZ".equals(opetype)
                        || "GRDZFZ".equals(opetype) || "WZFZ".equals(opetype) || "WZHHFZ".equals(opetype)
                        || "WGJY".equals(opetype) || "HZSFZ".equals(opetype)) {
                    lerepTitle = new Paragraph("\n", titleChinese);
                } else if ("HHQY".equals(opetype) || "WZHH".equals(opetype)) {
                    lerepTitle = new Paragraph("\n", titleChinese);
                }
                lerepTitle.setAlignment(Paragraph.ALIGN_CENTER);
                document.add(lerepTitle);

                //TABLE
                Table lereptable = new Table(4);
                int lerepwidths[] = { 20, 30, 20, 30 };
                lereptable.setWidths(lerepwidths);
                lereptable.setWidth(100);
                lereptable.setPadding(3);
                lereptable.setBorderWidth(1);
                lereptable.setAlignment(Cell.ALIGN_CENTER);

                Map<String, String> lerepMap = (Map<String, String>) dataMap.get("lerepMap");
                Cell lerep1 = new Cell(new Phrase(" ", contentFont));
                lerep1.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep1);
                Cell lerep2 = new Cell(new Phrase(lerepMap == null ? "" : lerepMap.get("name"), contentFont));
                lerep2.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep2);
                Cell lerep3 = new Cell(new Phrase("", contentFont));
                lerep3.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep3);
                Cell lerep4 = new Cell(new Phrase(lerepMap == null ? "" : lerepMap.get("tel"), contentFont));
                lerep4.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep4);

                Cell lerep5 = new Cell(new Phrase("", contentFont));
                lerep5.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep5);
                Cell lerep6 = new Cell(new Phrase(lerepMap == null ? "" : lerepMap.get("mobile"), contentFont));
                lerep6.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep6);
                Cell lerep7 = new Cell(new Phrase("", contentFont));
                lerep7.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep7);
                Cell lerep8 = new Cell(new Phrase(lerepMap == null ? "" : lerepMap.get("email"), contentFont));
                lerep8.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep8);

                Cell lerep9 = new Cell(new Phrase("", contentFont));
                lerep9.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep9);
                Cell lerep10 = new Cell(
                        new Phrase(lerepMap == null ? "" : lerepMap.get("certype"), contentFont));
                lerep10.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep10);
                Cell lerep11 = new Cell(new Phrase("", contentFont));
                lerep11.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep11);
                Cell lerep12 = new Cell(new Phrase(lerepMap == null ? "" : lerepMap.get("cerno"), contentFont));
                lerep12.setHorizontalAlignment(Element.ALIGN_CENTER);
                lereptable.addCell(lerep12);
                if ("HHFZ".equals(opetype) || "GRDZFZ".equals(opetype)) {
                    Cell lerep13 = new Cell(new Phrase("", contentFont));
                    lerep13.setHorizontalAlignment(Element.ALIGN_CENTER);
                    lereptable.addCell(lerep13);
                    Cell lerep14 = new Cell(
                            new Phrase(lerepMap == null ? "" : lerepMap.get("occstbeapp"), contentFont));
                    lerep14.setHorizontalAlignment(Element.ALIGN_CENTER);
                    lerep14.setColspan(3);
                    lereptable.addCell(lerep14);
                } else if ("WZFZ".equals(opetype) || "WZHH".equals(opetype) || "WZHHFZ".equals(opetype)
                        || "WGJY".equals(opetype)) {
                    Cell lerep13 = new Cell(new Phrase("", contentFont));
                    lerep13.setHorizontalAlignment(Element.ALIGN_CENTER);
                    lereptable.addCell(lerep13);
                    Cell lerep14 = new Cell(
                            new Phrase(lerepMap == null ? "" : lerepMap.get("country"), contentFont));
                    lerep14.setHorizontalAlignment(Element.ALIGN_CENTER);
                    lerep14.setColspan(3);
                    lereptable.addCell(lerep14);
                }

                document.add(lereptable);
            }

            if ("HZS".equals(opetype)) {
                Paragraph hzsp = new Paragraph(
                        "\n  ",
                        contentFont);
                document.add(hzsp);
                Paragraph hzsp1 = new Paragraph("\n", contentFont);
                hzsp1.setIndentationLeft(200);
                document.add(hzsp1);
                Paragraph hzsp2 = new Paragraph("\n                                                 ",
                        contentFont);
                hzsp2.setAlignment(Paragraph.ALIGN_RIGHT);
                document.add(hzsp2);
            }

            if ("GS".equals(opetype) || "WZGS".equals(opetype)) {
                //()
                Paragraph ryxxTitle = new Paragraph("\n", titleChinese);
                ryxxTitle.setAlignment(Paragraph.ALIGN_CENTER);
                document.add(ryxxTitle);

                //TABLE
                Table ryxxtable = new Table(1);
                int ryxxwidths[] = { 100 };
                ryxxtable.setWidths(ryxxwidths);
                ryxxtable.setWidth(100);
                ryxxtable.setPadding(3);
                ryxxtable.setBorderWidth(1);
                ryxxtable.setAlignment(Cell.ALIGN_CENTER);
                List<Map<String, String>> ryxxList = (List<Map<String, String>>) dataMap.get("ryxxList");
                if (ryxxList != null && !ryxxList.isEmpty()) {
                    for (int i = 0; i < ryxxList.size(); i++) {
                        Map<String, String> ryxxs = ryxxList.get(i);
                        Paragraph p = new Paragraph();
                        if ("GS".equals(opetype)) {
                            Phrase p1 = new Phrase(
                                    "" + (ryxxs == null ? "" : ryxxs.get("name")) + "     ", contentFont);
                            p.add(p1);
                            Phrase p2 = new Phrase(
                                    "" + (ryxxs == null ? "" : ryxxs.get("position")) + "     ",
                                    contentFont);
                            p.add(p2);
                            Phrase p3 = new Phrase(
                                    "" + (ryxxs == null ? "" : ryxxs.get("certype")) + "     ",
                                    contentFont);
                            p.add(p3);
                            Phrase p4 = new Phrase(
                                    "" + (ryxxs == null ? "" : ryxxs.get("cerno")) + "     ",
                                    contentFont);
                            p.add(p4);
                        } else if ("WZGS".equals(opetype)) {
                            Phrase p1 = new Phrase(
                                    "" + (ryxxs == null ? "" : ryxxs.get("name")) + "     ", contentFont);
                            p.add(p1);
                            Phrase p2 = new Phrase(
                                    "" + (ryxxs == null ? "" : ryxxs.get("country")) + "     ",
                                    contentFont);
                            p.add(p2);
                            Phrase p3 = new Phrase(
                                    "" + (ryxxs == null ? "" : ryxxs.get("certype")) + "     ",
                                    contentFont);
                            p.add(p3);
                            Phrase p4 = new Phrase(
                                    "" + (ryxxs == null ? "" : ryxxs.get("cerno")) + "     ",
                                    contentFont);
                            p.add(p4);
                            Phrase p5 = new Phrase(
                                    "" + (ryxxs == null ? "" : ryxxs.get("position")) + "     ",
                                    contentFont);
                            p.add(p5);
                            Phrase p6 = new Phrase(
                                    "" + (ryxxs == null ? "" : ryxxs.get("posbrform")) + "     ",
                                    contentFont);
                            p.add(p6);
                        }
                        Cell cell = new Cell(p);
                        ryxxtable.addCell(cell);
                    }
                }
                document.add(ryxxtable);
            }

            if ("GS".equals(opetype)) {
                //()
                Paragraph czxxTitle = new Paragraph("\n()", titleChinese);
                czxxTitle.setAlignment(Paragraph.ALIGN_CENTER);
                document.add(czxxTitle);

                //TABLE
                Table czxxtable = new Table(7);
                int czxxwidths[] = { 20, 20, 15, 10, 10, 15, 10 };
                czxxtable.setWidths(czxxwidths);
                czxxtable.setWidth(100);
                czxxtable.setPadding(3);
                czxxtable.setBorderWidth(1);
                czxxtable.setAlignment(Cell.ALIGN_CENTER);

                List<List<String>> czxxList = (List<List<String>>) dataMap.get("czxxList");
                if (czxxList != null && !czxxList.isEmpty()) {
                    Cell ct1 = new Cell(new Phrase("\n", contentFont));
                    ct1.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct1);
                    Cell ct2 = new Cell(new Phrase("", contentFont));
                    ct2.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct2);
                    Cell ct3 = new Cell(new Phrase("", contentFont));
                    ct3.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct3);
                    Cell ct4 = new Cell(new Phrase("", contentFont));
                    ct4.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct4);
                    Cell ct5 = new Cell(new Phrase("", contentFont));
                    ct5.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct5);
                    Cell ct6 = new Cell(new Phrase("\n", contentFont));
                    ct6.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct6);
                    Cell ct7 = new Cell(new Phrase("", contentFont));
                    ct7.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct7);
                    for (int i = 0; i < czxxList.size(); i++) {
                        List<String> czxxs = czxxList.get(i);
                        if (!czxxs.isEmpty()) {
                            for (int j = 0; j < czxxs.size(); j++) {
                                Cell czCell = new Cell(new Phrase(czxxs.get(j), contentFont));
                                czCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                                czxxtable.addCell(czCell);
                            }
                        }
                    }
                }
                document.add(czxxtable);
            } else if ("WZGS".equals(opetype) || "WZHH".equals(opetype)) {
                //()
                Paragraph czxxTitle = new Paragraph("\n/", titleChinese);
                czxxTitle.setAlignment(Paragraph.ALIGN_CENTER);
                document.add(czxxTitle);

                //TABLE
                int length = 0;
                int[] czxxwidths = null;
                if ("WZGS".equals(opetype)) {
                    length = 8;
                    czxxwidths = new int[] { 20, 10, 15, 10, 10, 15, 10, 10 };
                } else if ("WZHH".equals(opetype)) {
                    length = 9;
                    czxxwidths = new int[] { 12, 11, 11, 11, 11, 11, 11, 11, 11 };
                }
                Table czxxtable = new Table(length);
                czxxtable.setWidths(czxxwidths);
                czxxtable.setWidth(100);
                czxxtable.setPadding(3);
                czxxtable.setBorderWidth(1);
                czxxtable.setAlignment(Cell.ALIGN_CENTER);

                List<List<String>> czxxList = (List<List<String>>) dataMap.get("czxxList");
                if (czxxList != null && !czxxList.isEmpty()) {
                    String ct1text = "";
                    if ("WZGS".equals(opetype)) {
                        ct1text = "\n";
                    } else if ("WZHH".equals(opetype)) {
                        ct1text = "\n";
                    }
                    Cell ct1 = new Cell(new Phrase(ct1text, contentFont));
                    ct1.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct1);
                    Cell ct11 = new Cell(new Phrase("", contentFont));
                    ct11.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct11);
                    Cell ct2 = new Cell(new Phrase("", contentFont));
                    ct2.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct2);
                    Cell ct3 = new Cell(new Phrase("", contentFont));
                    ct3.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct3);
                    Cell ct31 = new Cell(new Phrase("", contentFont));
                    ct31.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct31);
                    Cell ct4 = new Cell(new Phrase("", contentFont));
                    ct4.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct4);
                    Cell ct5 = new Cell(new Phrase("", contentFont));
                    ct5.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct5);
                    Cell ct6 = new Cell(new Phrase("\n", contentFont));
                    ct6.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct6);
                    Cell ct7 = new Cell(new Phrase("", contentFont));
                    ct7.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct7);
                    for (int i = 0; i < czxxList.size(); i++) {
                        List<String> czxxs = czxxList.get(i);
                        if (!czxxs.isEmpty()) {
                            for (int j = 0; j < czxxs.size(); j++) {
                                Cell czCell = new Cell(new Phrase(czxxs.get(j), contentFont));
                                czCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                                czxxtable.addCell(czCell);
                            }
                        }
                    }
                }
                document.add(czxxtable);
            } else if ("HHQY".equals(opetype)) {
                //
                Paragraph czxxTitle = new Paragraph("\n", titleChinese);
                czxxTitle.setAlignment(Paragraph.ALIGN_CENTER);
                document.add(czxxTitle);

                //TABLE
                Table czxxtable = new Table(9);
                int czxxwidths[] = { 12, 11, 11, 11, 11, 11, 11, 11, 11 };
                czxxtable.setWidths(czxxwidths);
                czxxtable.setWidth(100);
                czxxtable.setPadding(3);
                czxxtable.setBorderWidth(1);
                czxxtable.setAlignment(Cell.ALIGN_CENTER);

                List<List<String>> czxxList = (List<List<String>>) dataMap.get("czxxList");
                if (czxxList != null && !czxxList.isEmpty()) {
                    Cell ct1 = new Cell(new Phrase("", contentFont));
                    ct1.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct1);
                    Cell ct2 = new Cell(new Phrase("", contentFont));
                    ct2.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct2);
                    Cell ct3 = new Cell(new Phrase("", contentFont));
                    ct3.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct3);
                    Cell ct4 = new Cell(new Phrase("", contentFont));
                    ct4.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct4);
                    Cell ct5 = new Cell(new Phrase("", contentFont));
                    ct5.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct5);
                    Cell ct6 = new Cell(new Phrase("", contentFont));
                    ct6.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct6);
                    Cell ct7 = new Cell(new Phrase("", contentFont));
                    ct7.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct7);
                    Cell ct8 = new Cell(new Phrase("", contentFont));
                    ct8.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct8);
                    Cell ct9 = new Cell(new Phrase("", contentFont));
                    ct9.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct9);
                    for (int i = 0; i < czxxList.size(); i++) {
                        List<String> czxxs = czxxList.get(i);
                        if (!czxxs.isEmpty()) {
                            for (int j = 0; j < czxxs.size(); j++) {
                                Cell czCell = new Cell(new Phrase(czxxs.get(j), contentFont));
                                czCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                                czxxtable.addCell(czCell);
                            }
                        }
                    }
                }
                document.add(czxxtable);
            } else if ("HZS".equals(opetype)) {
                //
                Paragraph czxxTitle = new Paragraph("\n", titleChinese);
                czxxTitle.setAlignment(Paragraph.ALIGN_CENTER);
                document.add(czxxTitle);

                //TABLE
                Table czxxtable = new Table(5);
                int czxxwidths[] = { 10, 30, 20, 20, 20 };
                czxxtable.setWidths(czxxwidths);
                czxxtable.setWidth(100);
                czxxtable.setPadding(3);
                czxxtable.setBorderWidth(1);
                czxxtable.setAlignment(Cell.ALIGN_CENTER);

                List<List<String>> czxxList = (List<List<String>>) dataMap.get("czxxList");
                if (czxxList != null && !czxxList.isEmpty()) {
                    Cell ct1 = new Cell(new Phrase("", contentFont));
                    ct1.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct1);
                    Cell ct2 = new Cell(new Phrase("", contentFont));
                    ct2.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct2);
                    Cell ct3 = new Cell(new Phrase("", contentFont));
                    ct3.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct3);
                    Cell ct4 = new Cell(new Phrase("", contentFont));
                    ct4.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct4);
                    Cell ct5 = new Cell(new Phrase("", contentFont));
                    ct5.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct5);
                    for (int i = 0; i < czxxList.size(); i++) {
                        List<String> czxxs = czxxList.get(i);
                        if (!czxxs.isEmpty()) {
                            for (int j = 0; j < czxxs.size(); j++) {
                                Cell czCell = new Cell(new Phrase(czxxs.get(j), contentFont));
                                czCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                                czxxtable.addCell(czCell);
                            }
                        }
                    }
                }
                document.add(czxxtable);

                Paragraph czzep = new Paragraph("\n:    " + dataMap.get("regcap") + "   ()  ",
                        contentFont);
                czzep.setAlignment(Paragraph.ALIGN_LEFT);
                czzep.setIndentationLeft(100);
                document.add(czzep);
                Paragraph czzep1 = new Paragraph("\n  ", contentFont);
                czzep1.setAlignment(Paragraph.ALIGN_LEFT);
                czzep1.setIndentationLeft(100);
                document.add(czzep1);
                Paragraph czzep2 = new Paragraph(
                        "\n                                                        ", contentFont);
                czzep2.setAlignment(Paragraph.ALIGN_RIGHT);
                document.add(czzep2);
            }

            if ("HZS".equals(opetype)) {
                //
                Paragraph czxxTitle = new Paragraph("\n", titleChinese);
                czxxTitle.setAlignment(Paragraph.ALIGN_CENTER);
                document.add(czxxTitle);

                //TABLE
                Table czxxtable = new Table(5);
                int czxxwidths[] = { 10, 20, 30, 25, 15 };
                czxxtable.setWidths(czxxwidths);
                czxxtable.setWidth(100);
                czxxtable.setPadding(3);
                czxxtable.setBorderWidth(1);
                czxxtable.setAlignment(Cell.ALIGN_CENTER);

                List<List<String>> czxxList = (List<List<String>>) dataMap.get("hzsList");
                if (czxxList != null && !czxxList.isEmpty()) {
                    Cell ct1 = new Cell(new Phrase("", contentFont));
                    ct1.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct1);
                    Cell ct2 = new Cell(new Phrase("", contentFont));
                    ct2.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct2);
                    Cell ct3 = new Cell(new Phrase("", contentFont));
                    ct3.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct3);
                    Cell ct4 = new Cell(new Phrase("", contentFont));
                    ct4.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct4);
                    Cell ct5 = new Cell(new Phrase("", contentFont));
                    ct5.setHorizontalAlignment(Element.ALIGN_CENTER);
                    czxxtable.addCell(ct5);
                    for (int i = 0; i < czxxList.size(); i++) {
                        List<String> czxxs = czxxList.get(i);
                        if (!czxxs.isEmpty()) {
                            for (int j = 0; j < czxxs.size(); j++) {
                                Cell czCell = new Cell(new Phrase(czxxs.get(j), contentFont));
                                czCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                                czxxtable.addCell(czCell);
                            }
                        }
                    }
                }
                document.add(czxxtable);

                Paragraph czzep = new Paragraph("\n:    " + dataMap.get("cyzs") + "   ()    ",
                        contentFont);
                czzep.setAlignment(Paragraph.ALIGN_LEFT);
                czzep.setIndentationLeft(40);
                document.add(czzep);
                Paragraph czzep1 = new Paragraph(" " + dataMap.get("nmcy") + "   ()  "
                        + dataMap.get("nmcyrate") + "    % ", contentFont);
                czzep1.setAlignment(Paragraph.ALIGN_LEFT);
                czzep1.setIndentationLeft(100);
                document.add(czzep1);
                Paragraph czzep2 = new Paragraph("   " + dataMap.get("frcy")
                        + "   () " + dataMap.get("frcyrate") + "  %", contentFont);
                czzep2.setAlignment(Paragraph.ALIGN_LEFT);
                czzep2.setIndentationLeft(100);
                document.add(czzep2);

                Paragraph czzep3 = new Paragraph(
                        " ",
                        contentFont);
                czzep3.setAlignment(Paragraph.ALIGN_LEFT);
                czzep3.setIndentationLeft(40);
                document.add(czzep3);

                Paragraph czzep4 = new Paragraph("\n ", contentFont);
                czzep4.setAlignment(Paragraph.ALIGN_LEFT);
                czzep4.setIndentationLeft(100);
                document.add(czzep4);

                Paragraph czzep5 = new Paragraph(
                        "\n                                                                 ",
                        contentFont);
                czzep4.setAlignment(Paragraph.ALIGN_RIGHT);
                document.add(czzep4);
            }

            //()
            Paragraph cwfzrTitle = new Paragraph("\n", titleChinese);
            cwfzrTitle.setAlignment(Paragraph.ALIGN_CENTER);
            document.add(cwfzrTitle);

            //TABLE
            Table cwfzrtable = new Table(4);
            int cwfzrwidths[] = { 20, 30, 20, 30 };
            cwfzrtable.setWidths(cwfzrwidths);
            cwfzrtable.setWidth(100);
            cwfzrtable.setPadding(3);
            cwfzrtable.setBorderWidth(1);
            cwfzrtable.setAlignment(Cell.ALIGN_CENTER);

            Map<String, String> cwfzrMap = (Map<String, String>) dataMap.get("cwfzrMap");
            Cell cwfzr1 = new Cell(new Phrase(" ", contentFont));
            cwfzr1.setHorizontalAlignment(Element.ALIGN_CENTER);
            cwfzrtable.addCell(cwfzr1);
            Cell cwfzr2 = new Cell(new Phrase(cwfzrMap == null ? "" : cwfzrMap.get("name"), contentFont));
            cwfzr2.setHorizontalAlignment(Element.ALIGN_CENTER);
            cwfzrtable.addCell(cwfzr2);
            Cell cwfzr3 = new Cell(new Phrase("", contentFont));
            cwfzr3.setHorizontalAlignment(Element.ALIGN_CENTER);
            cwfzrtable.addCell(cwfzr3);
            Cell cwfzr4 = new Cell(new Phrase(cwfzrMap == null ? "" : cwfzrMap.get("tel"), contentFont));
            cwfzr4.setHorizontalAlignment(Element.ALIGN_CENTER);
            cwfzrtable.addCell(cwfzr4);

            Cell cwfzr5 = new Cell(new Phrase("", contentFont));
            cwfzr5.setHorizontalAlignment(Element.ALIGN_CENTER);
            cwfzrtable.addCell(cwfzr5);
            Cell cwfzr6 = new Cell(new Phrase(cwfzrMap == null ? "" : cwfzrMap.get("mobile"), contentFont));
            cwfzr6.setHorizontalAlignment(Element.ALIGN_CENTER);
            cwfzrtable.addCell(cwfzr6);
            Cell cwfzr7 = new Cell(new Phrase("", contentFont));
            cwfzr7.setHorizontalAlignment(Element.ALIGN_CENTER);
            cwfzrtable.addCell(cwfzr7);
            Cell cwfzr8 = new Cell(new Phrase(cwfzrMap == null ? "" : cwfzrMap.get("email"), contentFont));
            cwfzr8.setHorizontalAlignment(Element.ALIGN_CENTER);
            cwfzrtable.addCell(cwfzr8);

            Cell cwfzr9 = new Cell(new Phrase("", contentFont));
            cwfzr9.setHorizontalAlignment(Element.ALIGN_CENTER);
            cwfzrtable.addCell(cwfzr9);
            Cell cwfzr10 = new Cell(new Phrase(cwfzrMap == null ? "" : cwfzrMap.get("certype"), contentFont));
            cwfzr10.setHorizontalAlignment(Element.ALIGN_CENTER);
            cwfzrtable.addCell(cwfzr10);
            Cell cwfzr11 = new Cell(new Phrase("", contentFont));
            cwfzr11.setHorizontalAlignment(Element.ALIGN_CENTER);
            cwfzrtable.addCell(cwfzr11);
            Cell cwfzr12 = new Cell(new Phrase(cwfzrMap == null ? "" : cwfzrMap.get("cerno"), contentFont));
            cwfzr12.setHorizontalAlignment(Element.ALIGN_CENTER);
            cwfzrtable.addCell(cwfzr12);

            document.add(cwfzrtable);

            //()
            Paragraph llrTitle = new Paragraph("\n", titleChinese);
            llrTitle.setAlignment(Paragraph.ALIGN_CENTER);
            document.add(llrTitle);

            //TABLE
            Table llrtable = new Table(4);
            int llrwidths[] = { 20, 30, 20, 30 };
            llrtable.setWidths(llrwidths);
            llrtable.setWidth(100);
            llrtable.setPadding(3);
            llrtable.setBorderWidth(1);
            llrtable.setAlignment(Cell.ALIGN_CENTER);

            Map<String, String> llrMap = (Map<String, String>) dataMap.get("llrMap");
            Cell llr1 = new Cell(new Phrase(" ", contentFont));
            llr1.setHorizontalAlignment(Element.ALIGN_CENTER);
            llrtable.addCell(llr1);
            Cell llr2 = new Cell(new Phrase(llrMap == null ? "" : llrMap.get("name"), contentFont));
            llr2.setHorizontalAlignment(Element.ALIGN_CENTER);
            llrtable.addCell(llr2);
            Cell llr3 = new Cell(new Phrase("", contentFont));
            llr3.setHorizontalAlignment(Element.ALIGN_CENTER);
            llrtable.addCell(llr3);
            Cell llr4 = new Cell(new Phrase(llrMap == null ? "" : llrMap.get("tel"), contentFont));
            llr4.setHorizontalAlignment(Element.ALIGN_CENTER);
            llrtable.addCell(llr4);

            Cell llr5 = new Cell(new Phrase("", contentFont));
            llr5.setHorizontalAlignment(Element.ALIGN_CENTER);
            llrtable.addCell(llr5);
            Cell llr6 = new Cell(new Phrase(llrMap == null ? "" : llrMap.get("mobile"), contentFont));
            llr6.setHorizontalAlignment(Element.ALIGN_CENTER);
            llrtable.addCell(llr6);
            Cell llr7 = new Cell(new Phrase("", contentFont));
            llr7.setHorizontalAlignment(Element.ALIGN_CENTER);
            llrtable.addCell(llr7);
            Cell llr8 = new Cell(new Phrase(llrMap == null ? "" : llrMap.get("email"), contentFont));
            llr8.setHorizontalAlignment(Element.ALIGN_CENTER);
            llrtable.addCell(llr8);

            Cell llr9 = new Cell(new Phrase("", contentFont));
            llr9.setHorizontalAlignment(Element.ALIGN_CENTER);
            llrtable.addCell(llr9);
            Cell llr10 = new Cell(new Phrase(llrMap == null ? "" : llrMap.get("certype"), contentFont));
            llr10.setHorizontalAlignment(Element.ALIGN_CENTER);
            llrtable.addCell(llr10);
            Cell llr11 = new Cell(new Phrase("", contentFont));
            llr11.setHorizontalAlignment(Element.ALIGN_CENTER);
            llrtable.addCell(llr11);
            Cell llr12 = new Cell(new Phrase(llrMap == null ? "" : llrMap.get("cerno"), contentFont));
            llr12.setHorizontalAlignment(Element.ALIGN_CENTER);
            llrtable.addCell(llr12);

            document.add(llrtable);

            //()
            Paragraph wtrTitle = new Paragraph("\n", titleChinese);
            wtrTitle.setAlignment(Paragraph.ALIGN_CENTER);
            document.add(wtrTitle);

            Map<String, String> wtrMap = (Map<String, String>) dataMap.get("wtrMap");

            String sqrText = "   " + (wtrMap == null ? "" : wtrMap.get("sqr"));
            Paragraph sqr = new Paragraph(sqrText, contentFont);
            sqr.setAlignment(Paragraph.ALIGN_LEFT);
            document.add(sqr);

            String wtrText = " " + (wtrMap == null ? "" : wtrMap.get("wtr"));
            Paragraph wtr = new Paragraph(wtrText, contentFont);
            wtr.setAlignment(Paragraph.ALIGN_LEFT);
            document.add(wtr);

            Paragraph wtsx = new Paragraph("\n", contentFont);
            wtsx.setAlignment(Paragraph.ALIGN_LEFT);
            document.add(wtsx);

            String wtText1 = "1    " + (wtrMap == null ? "" : wtrMap.get("entname"))
                    + "     ";
            Paragraph wt1 = new Paragraph(wtText1, contentFont);
            //
            wt1.setIndentationLeft(60);
            document.add(wt1);

            Paragraph wt2 = new Paragraph("           ",
                    contentFont);
            //
            wt2.setIndentationLeft(70);
            document.add(wt2);

            Paragraph wt3 = new Paragraph("       __________",
                    contentFont);
            //
            wt3.setIndentationLeft(70);
            document.add(wt3);

            Paragraph wt4 = new Paragraph("2." + (wtrMap == null ? "" : wtrMap.get("qx1"))
                    + " ", contentFont);
            //
            wt4.setIndentationLeft(60);
            document.add(wt4);

            Paragraph wt5 = new Paragraph(
                    "3." + (wtrMap == null ? "" : wtrMap.get("qx2")) + "  ",
                    contentFont);
            //
            wt5.setIndentationLeft(60);
            document.add(wt5);

            Paragraph wt6 = new Paragraph(
                    "4." + (wtrMap == null ? "" : wtrMap.get("qx3")) + " ",
                    contentFont);
            //
            wt6.setIndentationLeft(60);
            document.add(wt6);

            Paragraph wt7 = new Paragraph(
                    "5." + (wtrMap == null ? "" : wtrMap.get("qx4")) + "\n",
                    contentFont);
            //
            wt7.setIndentationLeft(60);
            document.add(wt7);

            Paragraph wt8 = new Paragraph(
                    "    " + (wtrMap == null ? "" : wtrMap.get("confrom"))
                            + "        " + (wtrMap == null ? "" : wtrMap.get("conto")) + " \n ",
                    contentFont);
            wt8.setAlignment(Paragraph.ALIGN_LEFT);
            document.add(wt8);

            //TABLE
            Table wtrtable = new Table(2);
            int[] wtrwidths = { 50, 50 };
            wtrtable.setWidths(wtrwidths);
            wtrtable.setWidth(100);
            wtrtable.setPadding(3);
            wtrtable.setBorderWidth(1);
            wtrtable.setAlignment(Cell.ALIGN_CENTER);

            Cell wtrc1 = new Cell(new Phrase("", contentFont));
            wtrc1.setRowspan(3);
            wtrc1.setHorizontalAlignment(Element.ALIGN_CENTER);
            wtrtable.addCell(wtrc1);

            Cell wtrc2 = new Cell(new Phrase(" ", contentFont));
            wtrc2.setHorizontalAlignment(Element.ALIGN_LEFT);
            wtrtable.addCell(wtrc2);

            String telText = "" + (wtrMap == null ? "" : wtrMap.get("tel"));
            Cell wtrc3 = new Cell(new Phrase(telText, contentFont));
            wtrc3.setHorizontalAlignment(Element.ALIGN_LEFT);
            wtrtable.addCell(wtrc3);

            String mobileText = "" + (wtrMap == null ? "" : wtrMap.get("mobile"));
            Cell wtrc4 = new Cell(new Phrase(mobileText, contentFont));
            wtrc4.setHorizontalAlignment(Element.ALIGN_LEFT);
            wtrtable.addCell(wtrc4);

            document.add(wtrtable);

            Paragraph wt9 = new Paragraph("\n ", contentFont);
            wt9.setAlignment(Paragraph.ALIGN_LEFT);
            document.add(wt9);

            Paragraph wt10 = new Paragraph("\n" + (wtrMap == null ? "" : wtrMap.get("condate")) + " ",
                    contentFont);
            wt10.setAlignment(Paragraph.ALIGN_RIGHT);
            document.add(wt10);

            //
            if ("WZGS".equals(opetype) || "WZHH".equals(opetype) || "WGJY".equals(opetype)) {
                Paragraph wtsTitle1 = new Paragraph("\n", titleChinese);
                wtsTitle1.setAlignment(Paragraph.ALIGN_CENTER);
                document.add(wtsTitle1);
                Paragraph wtsTitle2 = new Paragraph("", titleChinese);
                wtsTitle2.setAlignment(Paragraph.ALIGN_CENTER);
                document.add(wtsTitle2);

                Map<String, String> sdMap = (Map<String, String>) dataMap.get("sdMap");

                Paragraph sdsq = new Paragraph(" ", contentFont);
                sdsq.setAlignment(Paragraph.ALIGN_LEFT);
                document.add(sdsq);

                String sdbsqText = "    " + (sdMap == null ? "" : sdMap.get("name"));
                Paragraph sdbsq = new Paragraph(sdbsqText, contentFont);
                sdbsq.setAlignment(Paragraph.ALIGN_LEFT);
                document.add(sdbsq);

                String sqfwText = "   " + (sdMap == null ? "" : sdMap.get("name"))
                        + "     ";
                Paragraph sqfw = new Paragraph(sqfwText, contentFont);
                sqfw.setAlignment(Paragraph.ALIGN_LEFT);
                document.add(sqfw);

                Paragraph sqfw2 = new Paragraph(
                        "_______",
                        contentFont);
                sqfw2.setAlignment(Paragraph.ALIGN_LEFT);
                sqfw2.setIndentationLeft(60);
                document.add(sqfw2);

                //TABLE
                Table sdstable = new Table(4);
                int[] sdswidths = { 20, 30, 20, 30 };
                sdstable.setWidths(sdswidths);
                sdstable.setWidth(100);
                sdstable.setPadding(3);
                sdstable.setBorderWidth(1);
                sdstable.setAlignment(Cell.ALIGN_CENTER);

                Cell sd1 = new Cell(new Phrase("", contentFont));
                sd1.setHorizontalAlignment(Element.ALIGN_CENTER);
                sdstable.addCell(sd1);

                Cell sd2 = new Cell(new Phrase(sdMap == null ? "" : sdMap.get("addr"), contentFont));
                sd2.setHorizontalAlignment(Element.ALIGN_CENTER);
                sdstable.addCell(sd2);

                Cell sd3 = new Cell(new Phrase("", contentFont));
                sd3.setHorizontalAlignment(Element.ALIGN_CENTER);
                sdstable.addCell(sd3);

                Cell sd4 = new Cell(new Phrase(sdMap == null ? "" : sdMap.get("postalcode"), contentFont));
                sd4.setHorizontalAlignment(Element.ALIGN_CENTER);
                sdstable.addCell(sd4);

                Cell sd5 = new Cell(new Phrase("", contentFont));
                sd5.setHorizontalAlignment(Element.ALIGN_CENTER);
                sdstable.addCell(sd5);

                Cell sd6 = new Cell(new Phrase(sdMap == null ? "" : sdMap.get("linkman"), contentFont));
                sd6.setHorizontalAlignment(Element.ALIGN_CENTER);
                sdstable.addCell(sd6);

                Cell sd7 = new Cell(new Phrase("", contentFont));
                sd7.setHorizontalAlignment(Element.ALIGN_CENTER);
                sdstable.addCell(sd7);

                Cell sd8 = new Cell(new Phrase(sdMap == null ? "" : sdMap.get("email"), contentFont));
                sd8.setHorizontalAlignment(Element.ALIGN_CENTER);
                sdstable.addCell(sd8);

                Cell sd9 = new Cell(new Phrase("\n", contentFont));
                sd9.setRowspan(2);
                sd9.setHorizontalAlignment(Element.ALIGN_CENTER);
                sdstable.addCell(sd9);

                Cell sd10 = new Cell(
                        new Phrase("     " + (sdMap == null ? "" : sdMap.get("tel")), contentFont));
                sd10.setColspan(3);
                sd10.setHorizontalAlignment(Element.ALIGN_LEFT);
                sdstable.addCell(sd10);

                Cell sd11 = new Cell(
                        new Phrase("     " + (sdMap == null ? "" : sdMap.get("mobtel")), contentFont));
                sd11.setColspan(3);
                sd11.setHorizontalAlignment(Element.ALIGN_LEFT);
                sdstable.addCell(sd11);

                document.add(sdstable);

                Paragraph sds1 = new Paragraph(
                        "\n                                                                            ",
                        contentFont);
                sds1.setAlignment(Paragraph.ALIGN_LEFT);
                sds1.setIndentationLeft(100);
                document.add(sds1);

                Paragraph sds2 = new Paragraph("\n                                                      ",
                        contentFont);
                sds2.setAlignment(Paragraph.ALIGN_RIGHT);
                document.add(sds2);

                Paragraph remark = new Paragraph(
                        "  ",
                        contentFont);
                remark.setIndentationLeft(60);
                remark.setAlignment(Paragraph.ALIGN_LEFT);
                document.add(remark);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        logger.debug(e);
    }

    //PDF
    document.close();
}

From source file:com.mitchell.services.business.partialloss.assignmentdelivery.handler.ndu.util.AssignmentEmailDeliveryUtils.java

public void createPDF(final String content, final String path) throws Exception {

    // Create the PDF Document

    // step 1: creation of a document-object
    com.lowagie.text.Document document = new com.lowagie.text.Document(PageSize.LETTER, 36, 36, 36, 36);

    // step 2:/* w ww.  jav  a  2  s  .c om*/
    // we create a writer that listens to the document
    // and directs a PDF-stream to a file
    PdfWriter.getInstance(document, new java.io.FileOutputStream(path));

    // step 3: we open the document
    document.open();

    // step 4:
    document.setMargins(36, 36, 36, 36);
    Paragraph paragraph = new Paragraph();
    paragraph.setAlignment(Element.ALIGN_LEFT);
    paragraph.add(content);
    document.add(paragraph);

    // step 5: we close the document
    document.close();
}

From source file:com.nokia.s60tools.swmtanalyser.wizards.ReportCreationJob.java

License:Open Source License

private void addGeneralDetails(Document document) throws DocumentException {
    //Report Title
    Paragraph title = new Paragraph("MemSpy - System Wide Memory Tracking - Analysis Report", fontHeader);
    title.setAlignment(Element.ALIGN_CENTER);
    document.add(title);//ww  w  .  j  ava 2s . c o  m
    document.add(Chunk.NEWLINE);

    //Introduction title
    Paragraph hdng = new Paragraph("Introduction of Memspy (S60) and SWMT Analyser", fontHeading1);
    document.add(hdng);

    //About the MemSpy S60 Application
    Paragraph intro_memspy = new Paragraph(
            "The MemSpy S60 application tracks various subsystems that directly or indirectly contribute to overall system memory usage and provides information about the changes in these subsystems at specified time intervals.",
            fontNormal);
    document.add(intro_memspy);
    document.add(Chunk.NEWLINE);
    //About the SWMT Analyser
    Paragraph intro_swmt = new Paragraph(
            "A System Wide Memory Tracker log file contains information about system wide memory status changes over time. SWMT Analyser is a Carbide.c++ Extension for analyzing System Wide Memory Tracking logs produced by the MemSpy S60 application and imported to PC with the MemSpy Carbide.c++ Extension.",
            fontNormal);
    document.add(intro_swmt);
    document.add(Chunk.NEWLINE);

    //Properties heading
    Paragraph props_title = new Paragraph("Properties", fontHeading1);
    document.add(props_title);
    Chunk no_of_cycles = new Chunk("No of cycles   :   ", fontHeading2);
    document.add(no_of_cycles);
    Chunk cycles = new Chunk(ov.noOfcycles + "", fontNormal);
    document.add(cycles);
    document.add(Chunk.NEWLINE);

    Chunk time_period = new Chunk("Time period   :   ", fontHeading2);
    document.add(time_period);
    Chunk period = new Chunk(ov.fromTime + " to " + ov.toTime, fontNormal);
    document.add(period);
    document.add(Chunk.NEWLINE);

    Chunk duration = new Chunk("Time duration   :   ", fontHeading2);
    document.add(duration);
    Chunk dur = new Chunk(ov.durationString, fontNormal);
    document.add(dur);
    document.add(Chunk.NEWLINE);

    document.add(Chunk.NEWLINE);
    Paragraph rom_title = new Paragraph("ROM Details", fontHeading1);
    document.add(rom_title);
    Chunk rom_checksum = new Chunk("ROM Checksum   :   ", fontHeading2);
    document.add(rom_checksum);
    Chunk checksum = new Chunk(this.rom_checkSum_string, fontNormal);
    document.add(checksum);
    document.add(Chunk.NEWLINE);

    Chunk rom_version = new Chunk("ROM Version   :   ", fontHeading2);
    document.add(rom_version);
    Chunk version = new Chunk(this.rom_version_string, fontNormal);
    document.add(version);
    document.add(Chunk.NEWLINE);
    document.add(Chunk.NEWLINE);
}

From source file:com.orange.atk.compModel.PDFGenerator.java

License:Apache License

/**
 * @see com.orange.atk.results.logger.documentGenerator.DocumentGenerator#dumpInStream(boolean, interpreter.logger.DocumentLogger)
 *//*from   w w w .  ja  va 2s .com*/

public void dumpInStream(boolean isParseErrorHappened, /*DocumentLogger dl,*/ org.w3c.dom.Document xmlDoc,
        Model model3) {
    long endTime = new Date().getTime();
    // step 1: creation of a document-object
    Document document = new Document();
    PdfWriter writer = null;

    // step 2:
    // we create a writer that listens to the document
    // and directs a PDF-stream to the outputStream
    try {
        writer = PdfWriter.getInstance(document, outputStream);
    } catch (DocumentException e1) {
        e1.printStackTrace();
        return;
    }
    writer.setViewerPreferences(PdfWriter.PageModeUseOutlines);
    // step 3: we open the document
    document.open();
    document.addTitle("REPORT");
    document.addCreationDate();

    HeaderFooter headerPage = new HeaderFooter(new Phrase("ScreenShot report"), false);
    HeaderFooter footerPage = new HeaderFooter(new Phrase(" - "), new Phrase(" - "));
    headerPage.setAlignment(Element.ALIGN_CENTER);
    footerPage.setAlignment(Element.ALIGN_CENTER);
    document.setHeader(headerPage);
    document.setFooter(footerPage);

    // Chapter 1 : Summary
    // Section 1 : Informations

    Chunk c = new Chunk("Summary");
    c.setBackground(ORANGE_COLOR, 200, 3f, 200f, 3f);
    c.setFont(FONT_PAR_TITLE);

    Paragraph title1 = new Paragraph(c);
    title1.setAlignment("CENTER");
    title1.setLeading(20);
    Chapter chapter1 = new Chapter(title1, 1);
    chapter1.setNumberDepth(0);

    Paragraph title11 = new Paragraph("Informations");
    Section section1 = chapter1.addSection(title11);
    Paragraph pSum = new Paragraph();
    pSum.add("Author : " + author);
    pSum.add(Chunk.NEWLINE);
    pSum.add("Group : " + group);
    pSum.add(Chunk.NEWLINE);
    pSum.add("Script : " + script);
    pSum.add(Chunk.NEWLINE);
    pSum.add("Reference directory: " + model3.getRefDirectory());
    pSum.add(Chunk.NEWLINE);
    pSum.add("Test directory: " + model3.getTestDirectory());
    pSum.add(Chunk.NEWLINE);
    SimpleDateFormat formatter = new SimpleDateFormat("MMMMM dd, yyyy - hh:mm aaa");
    String dateString = formatter.format(endTime);
    pSum.add("Date : " + dateString);
    pSum.add(Chunk.NEWLINE);
    pSum.add(Chunk.NEWLINE);
    if (model3.getNbFail() > 0) {
        pSum.add(model3.getNbFail() + "/" + model3.getNbImages() + " images didn't succeed the test.");
    } else {
        pSum.add("All images (" + model3.getNbImages() + ") have succeed this comparaison.");
    }
    pSum.add(Chunk.NEWLINE);
    pSum.setIndentationLeft(20);
    section1.add(pSum);
    section1.add(new Paragraph(Chunk.NEXTPAGE));

    try {
        document.add(chapter1);
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    document.newPage();

    if (isParseErrorHappened) {
        document.close();
        return;
    }

    // Add generated pictures
    Chunk c3 = new Chunk("ScreenShots");
    c3.setBackground(ORANGE_COLOR, 200, 3f, 200f, 3f);
    c3.setFont(FONT_PAR_TITLE);
    Paragraph p3 = new Paragraph(c3);
    p3.setAlignment("CENTER");
    p3.setLeading(20);
    Chapter chapter3 = new Chapter(p3, 1);
    chapter3.setNumberDepth(0);

    NodeList imgs = xmlDoc.getElementsByTagName("img");
    for (int i = 0; i < imgs.getLength(); i++) {
        org.w3c.dom.Element eImg = (org.w3c.dom.Element) imgs.item(i);
        if (eImg.getElementsByTagName("Pass").item(0).getTextContent().equals(Model.FAIL)) {

            org.w3c.dom.Element eRef = (org.w3c.dom.Element) eImg.getElementsByTagName("Ref").item(0);
            org.w3c.dom.Element eTest = (org.w3c.dom.Element) eImg.getElementsByTagName("Test").item(0);
            Paragraph pScreen = new Paragraph(eTest.getAttributes().getNamedItem("name").getNodeValue() + " "
                    + eImg.getElementsByTagName("Pass").item(0).getTextContent());
            Section section31 = chapter3.addSection(pScreen);
            PdfPTable scTable = null;
            scTable = new PdfPTable(2);
            scTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
            scTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
            scTable.getDefaultCell().setPadding(5);
            if (new File(eRef.getTextContent()).exists()) {
                Image refImg;
                try {
                    refImg = Image.getInstance(eRef.getTextContent());
                    refImg.scaleToFit(310, 260);
                    refImg.setAlignment(Element.ALIGN_BASELINE);
                    scTable.addCell(refImg);
                } catch (BadElementException e) {
                    e.printStackTrace();
                } catch (MalformedURLException e) {
                    e.printStackTrace();
                } catch (DOMException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }

            }
            if (new File(eTest.getTextContent()).exists()) {
                Image testImg;
                try {
                    BufferedImage bi = ImageIO.read(new File(eTest.getTextContent()));
                    Graphics2D g2d = (Graphics2D) bi.getGraphics();
                    g2d.setStroke(new BasicStroke(1.5f));
                    g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f));

                    Boolean2D dif = model3.getCouplesComparaison().get(i).getDifWithMask();
                    //               if (squarable){
                    g2d.setColor(Color.red);
                    int w = bi.getWidth();
                    int h = bi.getHeight();
                    //TODO: Gurvan, Maybe we need to have the list of masks in the report?
                    Mask mask = model3.getCouplesComparaison().get(i).getMaskSum();
                    //g2d.drawRect(0, 0, mask.getWidth()*2*sampleWidth, mask.getHeight()*2*sampleHeight);
                    for (int x = 0; x < mask.getWidth(); x++) {

                        for (int y = 0; y < mask.getHeight(); y++) {

                            if (mask.getCell(x, y)) {
                                g2d.setColor(Color.blue);
                                ////Logger.getLogger(this.getClass() ).debug("grise");
                                g2d.fillRect(x * 2 * Mask.getCELL_HALF_SIZE(), y * 2 * Mask.getCELL_HALF_SIZE(),
                                        2 * Mask.getCELL_HALF_SIZE(), 2 * Mask.getCELL_HALF_SIZE());
                            }

                            if (!dif.get(x, y)) {
                                g2d.setColor(Color.green);
                                g2d.fillRect(x * 2 * Mask.getCELL_HALF_SIZE(), y * 2 * Mask.getCELL_HALF_SIZE(),
                                        2 * Mask.getCELL_HALF_SIZE(), 2 * Mask.getCELL_HALF_SIZE());
                            }
                        }
                    }
                    testImg = Image.getInstance(bi, null);
                    testImg.scaleToFit(310, 260);
                    testImg.setAlignment(Element.ALIGN_BASELINE);
                    scTable.addCell(testImg);
                    section31.add(Chunk.NEWLINE);
                    section31.add(scTable);
                } catch (BadElementException e) {
                    e.printStackTrace();
                } catch (MalformedURLException e) {
                    e.printStackTrace();
                } catch (DOMException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }

            }
            section31.add(new Paragraph("Reference screenshot description : "
                    + eImg.getElementsByTagName("RefDescription").item(0).getTextContent()));
            section31.add(Chunk.NEWLINE);

            section31
                    .add(new Paragraph("Mask : " + eImg.getElementsByTagName("Mask").item(0).getTextContent()));
            section31.add(Chunk.NEWLINE);

            section31.add(new Paragraph(
                    "Comment : " + eImg.getElementsByTagName("Comment").item(0).getTextContent()));
            section31.add(new Paragraph(Chunk.NEXTPAGE));

        }
    }
    try {
        document.add(chapter3);
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    document.newPage();

    // step 5: we close the document
    document.close();
}

From source file:com.orange.atk.results.logger.documentGenerator.PDFGenerator.java

License:Apache License

/**
 * @see com.orange.atk.results.logger.documentGenerator.DocumentGenerator#dumpInStream(boolean,
 *      com.orange.atk.results.logger.log.DocumentLogger)
 *///from  ww w  .  j  a  va 2 s .  c  o  m
public void dumpInStream(boolean isParseErrorHappened, DocumentLogger dl) {
    long endTime = new Date().getTime();
    // step 1: creation of a document-object
    Document document = new Document();
    PdfWriter writer = null;
    // step 2:
    // we create a writer that listens to the document
    // and directs a PDF-stream to the outputStream
    try {
        writer = PdfWriter.getInstance(document, outputStream);
    } catch (DocumentException e1) {
        e1.printStackTrace();
        return;
    }
    writer.setViewerPreferences(PdfWriter.PageModeUseOutlines);
    // step 3: we open the document
    document.open();
    // step 4: we add a paragraph to the document
    List<Message> msgLogged = dl.getMsgsLogged();
    Paragraph pLoggedMsg = new Paragraph();
    // logged messages
    for (int i = 0; i < msgLogged.size(); i++) {
        Message msg = msgLogged.get(i);
        SimpleDateFormat formatter = new SimpleDateFormat("H:mm:ssSSS");
        String dateString = formatter.format(msg.getTimestamp());
        switch (msg.getType()) {
        case Message.INFO_MSG:
            pLoggedMsg.add("[" + dateString + "] " + msg.getMessage());
            break;
        case Message.WARN_MSG:
            pLoggedMsg.add("[" + dateString + "] WARN : " + msg.getMessage() + " at line : " + msg.getLine());
            break;
        case Message.ERROR_MSG:
            pLoggedMsg.add("[" + dateString + "] ERROR : " + msg.getMessage() + " at line : " + msg.getLine());
            break;
        default:
            break;

        }
        pLoggedMsg.add(Chunk.NEWLINE);
    }

    Paragraph pLastLogguedLines = new Paragraph();
    int startIndex = msgLogged.size() > 5 ? msgLogged.size() - 5 : 0;
    for (int i = startIndex; i < msgLogged.size(); i++) {
        Message m = msgLogged.get(i);
        switch (m.getType()) {
        case Message.INFO_MSG:
            pLastLogguedLines.add("INFO : " + m.getMessage());
            break;
        case Message.WARN_MSG:
            pLastLogguedLines.add("WARN : " + m.getMessage());
            break;
        case Message.ERROR_MSG:
            pLastLogguedLines.add("ERROR : " + m.getMessage());
            break;
        default:
            break;

        }
        pLastLogguedLines.add(Chunk.NEWLINE);
    }
    // l.setIndentationLeft(40);
    // Min/Max/Ave values
    /*
     * PdfPTable table = new PdfPTable(4); table.addCell("");
     * table.addCell("Min"); table.addCell("Max"); table.addCell("Avg");
     * 
     * 
     * table.addCell("Battery in  %"); table.addCell(String.valueOf(dl
     * .getMinValueFromList(dl.getplt("BATTERY"))));
     * table.addCell(String.valueOf(dl
     * .getMaxValueFromList(dl.getplt("BATTERY"))));
     * table.addCell(String.valueOf(dl
     * .getAveValueFromList(dl.getplt("BATTERY"))));
     * table.addCell("Storage in bytes"); table.addCell(String.valueOf(dl
     * .getMinValueFromList(dl.getplt("Storage"))));
     * table.addCell(String.valueOf(dl
     * .getMaxValueFromList(dl.getplt("Storage"))));
     * table.addCell(String.valueOf(dl
     * .getAveValueFromList(dl.getplt("Storage"))));
     */
    document.addTitle("REPORT");
    document.addCreationDate();

    HeaderFooter headerPage = new HeaderFooter(new Phrase("Execution report"), false);
    HeaderFooter footerPage = new HeaderFooter(new Phrase(" - "), new Phrase(" - "));
    headerPage.setAlignment(Element.ALIGN_CENTER);
    footerPage.setAlignment(Element.ALIGN_CENTER);
    document.setHeader(headerPage);
    document.setFooter(footerPage);

    // Chapter 1 : Summary
    // Section 1 : Informations

    Chunk c = new Chunk("Summary");
    c.setBackground(ORANGE_COLOR, 200, 3f, 200f, 3f);
    c.setFont(FONT_PAR_TITLE);

    Paragraph title1 = new Paragraph(c);
    title1.setAlignment("CENTER");
    title1.setLeading(20);
    Chapter chapter1 = new Chapter(title1, 1);
    chapter1.setNumberDepth(0);

    Paragraph title11 = new Paragraph("Informations");
    Section section1 = chapter1.addSection(title11);
    Paragraph pSum = new Paragraph();
    pSum.add("Author : " + author);
    pSum.add(Chunk.NEWLINE);
    pSum.add("Group : " + group);
    pSum.add(Chunk.NEWLINE);
    pSum.add("Script : " + script);
    pSum.add(Chunk.NEWLINE);
    SimpleDateFormat formatter = new SimpleDateFormat("MMM d, yyyy - hh:mm aaa");
    String dateString = formatter.format(endTime);
    pSum.add("Date : " + dateString);
    pSum.add(Chunk.NEWLINE);
    pSum.setIndentationLeft(20);
    section1.add(pSum);
    section1.add(new Paragraph(Chunk.NEXTPAGE));

    Chunk c11 = new Chunk("Executive summary");
    c11.setBackground(ORANGE_COLOR, 200, 3f, 200f, 3f);
    c11.setFont(FONT_PAR_TITLE);
    Paragraph title12 = new Paragraph(c11);
    Section section12 = chapter1.addSection(title12);
    Paragraph pExecSum = new Paragraph();
    // pExecSum.add("Value : ");
    // pExecSum.add(Chunk.NEWLINE);
    // pExecSum.add(table);
    pExecSum.add(Chunk.NEWLINE);
    pExecSum.add("Last logged lines : ");
    pExecSum.add(Chunk.NEWLINE);
    pExecSum.add(pLastLogguedLines);
    pExecSum.add(Chunk.NEWLINE);
    pExecSum.setIndentationLeft(20);

    section12.add(pExecSum);

    try {
        document.add(chapter1);
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    document.newPage();

    // Chapter 2 : Log information
    Chunk c2 = new Chunk("Log information");
    c2.setBackground(ORANGE_COLOR, 200, 3f, 200f, 3f);
    c2.setFont(FONT_PAR_TITLE);
    Paragraph title2 = new Paragraph(c2);
    title2.setAlignment("CENTER");
    title2.setLeading(20);
    Chapter chapter2 = new Chapter(title2, 1);
    chapter2.setNumberDepth(0);

    Section section2 = chapter2.addSection("Log");
    // Add log information
    section2.add(pLoggedMsg);
    section2.add(Chunk.NEWLINE);

    // section2.add(table);
    try {
        document.add(chapter2);
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    document.newPage();

    if (isParseErrorHappened) {
        document.close();
        return;
    }

    // Add generated pictures
    Chunk c3 = new Chunk("Graphics");
    c3.setBackground(ORANGE_COLOR, 200, 3f, 200f, 3f);
    c3.setFont(FONT_PAR_TITLE);
    Paragraph p3 = new Paragraph(c3);
    p3.setAlignment("CENTER");
    p3.setLeading(20);
    Chapter chapter3 = new Chapter(p3, 1);
    chapter3.setNumberDepth(0);

    // add current graph
    Map<String, PlotList> mapint = dl.getMapint();
    Set<String> cles = mapint.keySet();
    Iterator<String> it = cles.iterator();
    while (it.hasNext()) {
        String cle = (String) it.next();
        Paragraph pCPUimg = new Paragraph(cle);
        Section section31 = chapter3.addSection(pCPUimg);
        if (new File(dl.getPNGpath(cle)).exists()) {
            Image jpg1 = null;
            try {
                jpg1 = Image.getInstance(dl.getPNGpath(cle));
            } catch (BadElementException e) {
                e.printStackTrace();
            } catch (MalformedURLException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }

            if (jpg1 == null) {
                Logger.getLogger(this.getClass()).warn("Error when Creating image jpg1 is null");
                return;
            }
            // jpg1.setRotationDegrees(270);
            jpg1.scalePercent(75);
            jpg1.setAlignment(Element.ALIGN_CENTER);
            section31.add(jpg1);
            PlotList plotlist = mapint.get(cle);
            DecimalFormat df = new DecimalFormat("#,###.##");

            if (plotlist.getType() == PlotList.TYPE_SUM) {
                section31.add(new Paragraph("Total : " + df.format(plotlist.getTotal() / plotlist.getScale())
                        + " " + plotlist.getunit()));
            } else { // PlotList.TYPE_AVG
                section31.add(new Paragraph("Average : "
                        + df.format(plotlist.getAverage() / plotlist.getScale()) + " " + plotlist.getunit()));
            }

        }
        section31.add(new Paragraph(Chunk.NEXTPAGE));
    }

    /*
     * // Section 3.1 : CPU data Paragraph pCPUimg = new
     * Paragraph("CPU data"); Section section31 =
     * chapter3.addSection(pCPUimg); if (new
     * File(dl.getPNGpath("CPU")).exists()) { Image jpg1 = null; try { jpg1
     * = Image.getInstance(dl.getPNGpath("CPU")); } catch
     * (BadElementException e) { e.printStackTrace(); } catch
     * (MalformedURLException e) { e.printStackTrace(); } catch (IOException
     * e) { e.printStackTrace(); } //jpg1.setRotationDegrees(270);
     * jpg1.scalePercent(75); jpg1.setAlignment(Element.ALIGN_CENTER);
     * section31.add(jpg1); } section31.add(new Paragraph(Chunk.NEXTPAGE));
     * 
     * // Section 3.2 : BAT data Paragraph pBATimg = new
     * Paragraph("Battery data"); Section section32 =
     * chapter3.addSection(pBATimg); if (new
     * File(dl.getPNGpath("BATTERY")).exists()) { Image jpg2 = null; try {
     * jpg2 = Image.getInstance(dl.getPNGpath("BATTERY")); } catch
     * (BadElementException e) { e.printStackTrace(); } catch
     * (MalformedURLException e) { e.printStackTrace(); } catch (IOException
     * e) { e.printStackTrace(); } //jpg2.setRotationDegrees(270);
     * jpg2.scalePercent(75); jpg2.setAlignment(Element.ALIGN_CENTER);
     * section32.add(jpg2); } section32.add(new Paragraph(Chunk.NEXTPAGE));
     * 
     * // Section 3.3 : MEM data Paragraph pMEMimg = new
     * Paragraph("Memory data"); Section section33 =
     * chapter3.addSection(pMEMimg); if (new
     * File(dl.getPNGpath("MEMORY")).exists()) {
     * 
     * Image jpg3 = null; try { jpg3 =
     * Image.getInstance(dl.getPNGpath("MEMORY")); } catch
     * (BadElementException e) { e.printStackTrace(); } catch
     * (MalformedURLException e) { e.printStackTrace(); } catch (IOException
     * e) { e.printStackTrace(); } //jpg3.setRotationDegrees(270);
     * jpg3.scalePercent(75); jpg3.setAlignment(Element.ALIGN_CENTER);
     * section33.add(jpg3); } section33.add(new Paragraph(Chunk.NEXTPAGE));
     * 
     * // Section 3.4 : STO data Paragraph pSTOimg = new
     * Paragraph("Storage data"); Section section34 =
     * chapter3.addSection(pSTOimg); if (new
     * File(dl.getPNGpath("Storage")).exists()) {
     * 
     * Image jpg4 = null; try { jpg4 =
     * Image.getInstance(dl.getPNGpath("Storage")); } catch
     * (BadElementException e) { e.printStackTrace(); } catch
     * (MalformedURLException e) { e.printStackTrace(); } catch (IOException
     * e) { e.printStackTrace(); } //jpg4.setRotationDegrees(270);
     * jpg4.scalePercent(75); jpg4.setAlignment(Element.ALIGN_CENTER);
     * section34.add(jpg4); }
     * 
     * 
     * // Section 3.5 : Network connection //Paragraph pNetworkimg = new
     * Paragraph("Network QoS data"); //Section section35 =
     * chapter3.addSection(pNetworkimg); // if (new
     * File(dl.getNetworkPNGfile()).exists()) {
     * 
     * // Image jpg5 = null; // try { // jpg5 =
     * Image.getInstance(dl.getNetworkPNGfile()); // } catch
     * (BadElementException e) { // e.printStackTrace(); // } catch
     * (MalformedURLException e) { // e.printStackTrace(); // } catch
     * (IOException e) { // e.printStackTrace(); // }
     * //jpg4.setRotationDegrees(270); // jpg5.scalePercent(75); //
     * jpg5.setAlignment(Element.ALIGN_CENTER); // section35.add(jpg5); //}
     */
    try {
        document.add(chapter3);
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    document.newPage();

    // if (isTableEnabled) {
    // // Add tables filled with measurement
    // // Chapter 4 : Measurement tables
    // Chunk c4 = new Chunk("Statistics tables");
    // c4.setBackground(new Color(0xFF, 0x66, 0x00), 200, 3f, 200f, 3f);
    // c4.setFont(FontFactory.getFont(BaseFont.HELVETICA,
    // BaseFont.WINANSI, BaseFont.NOT_EMBEDDED, 16));
    // Paragraph title4 = new Paragraph(c4);
    // title4.setAlignment("CENTER");
    // title4.setLeading(20);
    // Chapter chapter4 = new Chapter(title4, 1);
    // chapter4.setNumberDepth(0);
    //
    // // Section 4.1 : Battery value
    // Paragraph titleSection41 = new Paragraph("Battery value");
    // Section section41 = chapter4.addSection(titleSection41);
    // Paragraph pBatList = new Paragraph();
    // pBatList.add(Chunk.NEWLINE);
    // pBatList.add(createPDFTableFromList(dl
    // .getList(DocumentLogger.BATTERY), "Battery"));
    // pBatList.setAlignment("CENTER");
    // section41.add(pBatList);
    //
    // // Section 4.2 : CPU value
    // Paragraph titleSection42 = new Paragraph("CPU value");
    // Section section42 = chapter4.addSection(titleSection42);
    // Paragraph pCPUList = new Paragraph();
    // pCPUList.add(Chunk.NEWLINE);
    // pCPUList.add(createPDFTableFromList(dl.getList(DocumentLogger.CPU),
    // "CPU"));
    // pCPUList.setAlignment("CENTER");
    // section42.add(pCPUList);
    //
    // // Section 4.3 : Memory value
    // Paragraph titleSection43 = new Paragraph("Memory value");
    // Section section43 = chapter4.addSection(titleSection43);
    // Paragraph pMemList = new Paragraph();
    // pMemList.add(Chunk.NEWLINE);
    // pMemList.add(createPDFTableFromList(dl
    // .getList(DocumentLogger.MEMORY), "Memory"));
    // pMemList.setAlignment("CENTER");
    // section43.add(pMemList);
    //
    // // Section 4.4 : Storage value
    // Paragraph titleSection44 = new Paragraph("Storage value");
    // Section section44 = chapter4.addSection(titleSection44);
    // Paragraph pStoList = new Paragraph();
    // pStoList.add(Chunk.NEWLINE);
    // pStoList.add(createPDFTableFromList(dl
    // .getList(DocumentLogger.STORAGE), "Storage"));
    // pStoList.setAlignment("CENTER");
    // section44.add(pStoList);
    //
    // try {
    // document.add(chapter4);
    // } catch (DocumentException e) {
    // e.printStackTrace();
    // }
    // }

    // step 5: we close the document
    document.close();
    createHTMLFile(dl);
}

From source file:com.orange.atk.results.logger.documentGenerator.PDFGenerator.java

License:Apache License

public void dumpInStreamactionlogger(boolean isParseErrorHappened, ActionsLogger actionlog, DocumentLogger dl) {
    long endTime = new Date().getTime();
    // step 1: creation of a document-object
    Document document = new Document();
    PdfWriter writer = null;/* w ww. j  a  v  a2  s.c o  m*/
    Vector VectAction = actionlog.getActions();
    // step 2:
    // we create a writer that listens to the document
    // and directs a PDF-stream to the outputStream
    try {
        writer = PdfWriter.getInstance(document, outputStream);
    } catch (DocumentException e1) {
        e1.printStackTrace();
        return;
    }
    writer.setViewerPreferences(PdfWriter.PageModeUseOutlines);
    // step 3: we open the document
    document.open();
    // step 4: we add a paragraph to the document
    Paragraph pLoggedMsg = new Paragraph();
    // logged messages

    for (int i = 0; i < VectAction.size(); i++) {
        Action action = (Action) VectAction.get(i);
        SimpleDateFormat formatter = new SimpleDateFormat("H:mm:ssSSS");
        SimpleDateFormat spf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss SSS");
        String dateString = spf.format(action.getStartTime());
        pLoggedMsg.add("[" + dateString + "]  : " + action.getActionName());

        pLoggedMsg.add(Chunk.NEWLINE);

    }

    Paragraph pLastLogguedLines = new Paragraph();
    int startIndex = VectAction.size() > 5 ? VectAction.size() - 5 : 0;
    for (int i = startIndex; i < VectAction.size(); i++) {
        Action action = (Action) VectAction.get(i);
        // SimpleDateFormat formatter = new SimpleDateFormat("H:mm:ssSSS");
        SimpleDateFormat spf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss SSS");
        String dateString = spf.format(action.getStartTime());
        pLastLogguedLines.add("[" + dateString + "]  : " + action.getActionName());

        pLastLogguedLines.add(Chunk.NEWLINE);

    }

    document.addTitle("REPORT");
    document.addCreationDate();

    HeaderFooter headerPage = new HeaderFooter(new Phrase("Execution report"), false);
    HeaderFooter footerPage = new HeaderFooter(new Phrase(" - "), new Phrase(" - "));
    headerPage.setAlignment(Element.ALIGN_CENTER);
    footerPage.setAlignment(Element.ALIGN_CENTER);
    document.setHeader(headerPage);
    document.setFooter(footerPage);

    // Chapter 1 : Summary
    // Section 1 : Informations

    Chunk c = new Chunk("Summary");
    c.setBackground(ORANGE_COLOR, 200, 3f, 200f, 3f);
    c.setFont(FONT_PAR_TITLE);

    Paragraph title1 = new Paragraph(c);
    title1.setAlignment("CENTER");
    title1.setLeading(20);
    Chapter chapter1 = new Chapter(title1, 1);
    chapter1.setNumberDepth(0);

    Paragraph title11 = new Paragraph("Informations");
    Section section1 = chapter1.addSection(title11);
    Paragraph pSum = new Paragraph();
    pSum.add("Author : " + author);
    pSum.add(Chunk.NEWLINE);
    pSum.add("Group : " + group);
    pSum.add(Chunk.NEWLINE);
    pSum.add("Script : " + script);
    pSum.add(Chunk.NEWLINE);
    SimpleDateFormat formatter = new SimpleDateFormat("MMM d, yyyy - hh:mm aaa");
    String dateString = formatter.format(endTime);
    pSum.add("Date : " + dateString);
    pSum.add(Chunk.NEWLINE);
    pSum.setIndentationLeft(20);
    section1.add(pSum);
    section1.add(new Paragraph(Chunk.NEXTPAGE));

    Chunk c11 = new Chunk("Executive summary");
    c11.setBackground(ORANGE_COLOR, 200, 3f, 200f, 3f);
    c11.setFont(FONT_PAR_TITLE);
    Paragraph title12 = new Paragraph(c11);
    Section section12 = chapter1.addSection(title12);
    Paragraph pExecSum = new Paragraph();
    // pExecSum.add("Value : ");
    // pExecSum.add(Chunk.NEWLINE);
    // pExecSum.add(table);
    pExecSum.add(Chunk.NEWLINE);
    pExecSum.add("Last logged lines : ");
    pExecSum.add(Chunk.NEWLINE);
    pExecSum.add(pLastLogguedLines);
    pExecSum.add(Chunk.NEWLINE);
    pExecSum.setIndentationLeft(20);

    section12.add(pExecSum);

    try {
        document.add(chapter1);
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    document.newPage();

    // Chapter 2 : Log information
    Chunk c2 = new Chunk("Log information");
    c2.setBackground(ORANGE_COLOR, 200, 3f, 200f, 3f);
    c2.setFont(FONT_PAR_TITLE);
    Paragraph title2 = new Paragraph(c2);
    title2.setAlignment("CENTER");
    title2.setLeading(20);
    Chapter chapter2 = new Chapter(title2, 1);
    chapter2.setNumberDepth(0);

    Section section2 = chapter2.addSection("Log");
    // Add log information
    section2.add(pLoggedMsg);
    section2.add(Chunk.NEWLINE);

    // section2.add(table);
    try {
        document.add(chapter2);
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    document.newPage();

    if (isParseErrorHappened) {
        document.close();
        return;
    }

    // Add generated pictures
    Chunk c3 = new Chunk("Graphics");
    c3.setBackground(ORANGE_COLOR, 200, 3f, 200f, 3f);
    c3.setFont(FONT_PAR_TITLE);
    Paragraph p3 = new Paragraph(c3);
    p3.setAlignment("CENTER");
    p3.setLeading(20);
    Chapter chapter3 = new Chapter(p3, 1);
    chapter3.setNumberDepth(0);

    // add current graph
    Map<String, PlotList> mapint = dl.getMapint();
    Set<String> cles = mapint.keySet();
    Iterator<String> it = cles.iterator();
    while (it.hasNext()) {
        String cle = (String) it.next();
        Paragraph pCPUimg = new Paragraph(cle);
        Section section31 = chapter3.addSection(pCPUimg);
        if (new File(dl.getPNGpath(cle)).exists()) {
            Image jpg1 = null;
            try {
                jpg1 = Image.getInstance(dl.getPNGpath(cle));
            } catch (BadElementException e) {
                e.printStackTrace();
            } catch (MalformedURLException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (jpg1 == null) {
                Logger.getLogger(this.getClass()).warn("Error when Creating image jpg1 is null");
                return;
            }
            // jpg1.setRotationDegrees(270);
            jpg1.scalePercent(75);
            jpg1.setAlignment(Element.ALIGN_CENTER);
            section31.add(jpg1);
        }
        section31.add(new Paragraph(Chunk.NEXTPAGE));
    }

    try {
        document.add(chapter3);
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    document.newPage();

    document.close();
    createHTMLFileactionlog(actionlog, dl);
}

From source file:com.pureinfo.srm.patent.action.PatentPrintPdfAction.java

License:Open Source License

/**
 * @see com.pureinfo.ark.interaction.ActionBase#executeAction()
 *//*w w  w .j  a  v  a  2  s  .  c o m*/
public ActionForward executeAction() throws PureException {
    int nYear = request.getRequiredInt("year", "");

    Rectangle rectPageSize = new Rectangle(PageSize.A4);
    rectPageSize.setBackgroundColor(Color.WHITE);
    rectPageSize.setBorderColor(Color.BLACK);
    rectPageSize = rectPageSize.rotate();
    Document doc = new Document(rectPageSize, 10, 10, 10, 10);
    doc.addTitle(nYear + "");
    doc.addAuthor("PureInfo");
    try {
        BaseFont bfontTitle = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
        Font fontTitle = new Font(bfontTitle, 18, Font.NORMAL);
        Paragraph paraTitle = new Paragraph(nYear + "",
                fontTitle);
        paraTitle.setAlignment(ElementTags.ALIGN_CENTER);

        BaseFont bfontContent = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
        Font fontContent = new Font(bfontContent, 10, Font.NORMAL);

        FileFactory fileFactory = FileFactory.getInstance();
        String sPath = fileFactory.lookupPathConfigByFlag(FileFactory.FLAG_DOWNLOADTEMP, true).getLocalPath();

        FileUtil.insurePathExists(sPath);
        PdfWriter.getInstance(doc, new FileOutputStream(new File(sPath, "patent.pdf")));

        doc.open();
        doc.add(paraTitle);
        doc.add(new Paragraph("   "));

        String[] arrTitles = new String[] { "", "", "", "", "", "",
                "", "", "" };
        PdfPTable pTable = new PdfPTable(arrTitles.length);
        pTable.setWidths(new int[] { 5, 10, 9, 9, 20, 15, 12, 10, 10 });

        for (int i = 0; i < arrTitles.length; i++) {
            PdfPCell pCell = new PdfPCell();
            Paragraph para = new Paragraph(arrTitles[i], fontContent);
            para.setAlignment(ElementTags.ALIGN_CENTER);

            pCell.addElement(para);
            pTable.addCell(pCell);
        }

        /**
         * 
         */
        IPatentMgr mgr = (IPatentMgr) ArkContentHelper.getContentMgrOf(Patent.class);
        List patents = mgr.findAllAuthorizedOf(nYear);
        int i = 0;
        for (Iterator iter = patents.iterator(); iter.hasNext(); i++) {
            Patent patent = (Patent) iter.next();
            this.addPatentCell(pTable, String.valueOf(i + 1), fontContent);
            this.addPatentCell(pTable, patent.getPatentSid(), fontContent);
            this.addPatentCell(pTable, ForceConstants.DATE_FORMAT.format(patent.getApplyDate()), fontContent);
            this.addPatentCell(pTable, patent.getWarrantDate() == null ? ""
                    : ForceConstants.DATE_FORMAT.format(patent.getWarrantDate()), fontContent);
            this.addPatentCell(pTable, patent.getName(), fontContent);
            this.addPatentCell(pTable, patent.getAllAuthosName(), fontContent);
            this.addPatentCell(pTable, patent.getRightPerson(), fontContent);
            this.addPatentCell(pTable, getCollegeName(patent), fontContent);
            this.addPatentCell(pTable, patent.getPatentTypeName(), fontContent);
        }

        doc.add(pTable);
        doc.close();

    } catch (DocumentException ex) {
        // TODO Auto-generated catch block
        ex.printStackTrace(System.err);
    } catch (IOException ex) {
        // TODO Auto-generated catch block
        ex.printStackTrace(System.err);
    }

    List list = new ArrayList();
    list.add(new Pair("/download/patent.pdf", ""));
    request.setAttribute("forward", list);
    return mapping.findForward("success");
}

From source file:com.pureinfo.srm.patent.action.PatentPrintPdfAction.java

License:Open Source License

private void addPatentCell(PdfPTable _pTable, String _sValue, Font _font) {
    PdfPCell pCell = new PdfPCell();
    Paragraph para = new Paragraph(_sValue, _font);
    para.setAlignment(Align.CENTER);
    pCell.addElement(para);/*from w ww  .j a va 2s.  c  o  m*/
    _pTable.addCell(pCell);
    //        return _pTable;
}

From source file:com.qcadoo.mes.workPlans.pdf.document.WorkPlanPdfForDivision.java

License:Open Source License

private void addWorkPlanTitle(Document document, Entity workPlan, String title, Locale locale)
        throws DocumentException {

    PdfPTable headerTable = pdfHelper.createPanelTable(2);

    PdfPCell titleCell = new PdfPCell();
    titleCell.setBorder(Rectangle.NO_BORDER);
    Paragraph workPlanTitle = new Paragraph(
            new Phrase(getWorkPlanTitle(locale), FontUtils.getDejavuBold11Light()));
    workPlanTitle.add(new Phrase(" " + getWorkPlanName(workPlan), FontUtils.getDejavuBold11Dark()));
    titleCell.addElement(workPlanTitle);

    PdfPCell divisionCell = new PdfPCell();
    divisionCell.setBorder(Rectangle.NO_BORDER);
    Paragraph divisionTitle = new Paragraph(
            new Phrase(getDivisionTitle(locale), FontUtils.getDejavuBold11Light()));
    divisionTitle.add(new Phrase(" " + getDivisionFromTitle(title, locale), FontUtils.getDejavuBold11Dark()));
    divisionTitle.setAlignment(Element.ALIGN_RIGHT);
    divisionCell.addElement(divisionTitle);

    headerTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    headerTable.setTableEvent(null);//from   w  ww.ja  v  a 2s . c  o m
    headerTable.setSpacingAfter(4.0f);
    headerTable.addCell(titleCell);
    headerTable.addCell(divisionCell);
    document.add(headerTable);
}