Example usage for com.lowagie.text Cell setColspan

List of usage examples for com.lowagie.text Cell setColspan

Introduction

In this page you can find the example usage for com.lowagie.text Cell setColspan.

Prototype

public void setColspan(int value) 

Source Link

Document

Sets the colspan.

Usage

From source file:com.centurylink.mdw.designer.pages.ExportHelper.java

License:Apache License

private Object generateElementHtml(Element element, int depth, Font font) {
    String tag = element.getName();
    Object myself;/*from ww w.java 2 s.c  o  m*/
    Object av;
    if (element instanceof HTMLDocument.RunElement) {
        HTMLDocument.RunElement re = (HTMLDocument.RunElement) element;
        int start = re.getStartOffset();
        int end = re.getEndOffset();
        try {
            String content = re.getDocument().getText(start, end - start);
            HtmlAttr htmlattr = printAttributesHtml(re);
            av = re.getAttribute(CSS.Attribute.FONT_SIZE);
            String fontsize = av == null ? null : av.toString();
            av = re.getAttribute(CSS.Attribute.FONT_FAMILY);
            String fontfamily = av == null ? null : av.toString();
            av = re.getAttribute(CSS.Attribute.COLOR);
            String fontcolor = av == null ? null : av.toString();
            if (fontcolor != null || fontsize != null || fontfamily != null) {
                if (fontfamily == null)
                    fontfamily = font.getFamilyname();
                if (fontsize != null && fontsize.endsWith("pt"))
                    fontsize = fontsize.substring(0, fontsize.indexOf("pt"));
                float size = fontsize == null ? font.getSize() : (Float.parseFloat(fontsize) + 8);
                int style = font.getStyle();
                Color color;
                if (fontcolor != null) {
                    color = Color.decode(fontcolor);
                } else
                    color = font.getColor();
                font = FontFactory.getFont(fontfamily, size, style, color);
            } else if (htmlattr.bold || htmlattr.italic) {
                String family = font.getFamilyname();
                float size = font.getSize();
                Color color = font.getColor();
                if (htmlattr.bold && htmlattr.italic)
                    font = FontFactory.getFont(family, size, Font.BOLDITALIC, color);
                else if (htmlattr.italic)
                    font = FontFactory.getFont(family, size, Font.ITALIC, color);
                else if (htmlattr.bold)
                    font = FontFactory.getFont(family, size, Font.BOLD);
            }
            myself = new Chunk(content, font);
        } catch (BadLocationException e) {
            e.printStackTrace();
            myself = null;
        }
    } else if (element instanceof HTMLDocument.BlockElement) {
        HTMLDocument.BlockElement be = (HTMLDocument.BlockElement) element;
        HtmlAttr htmlattr = printAttributesHtml(be);
        if (htmlattr.bold) {
            System.out.println("+++BOLD!!!");
        }
        av = be.getAttribute(javax.swing.text.html.HTML.Attribute.ALIGN);
        String align = av == null ? null : av.toString();
        if (htmlattr.bold || htmlattr.italic) {
            String family = font.getFamilyname();
            float size = font.getSize();
            Color color = font.getColor();
            if (htmlattr.bold && htmlattr.italic)
                font = FontFactory.getFont(family, size, Font.BOLDITALIC, color);
            else if (htmlattr.italic)
                font = FontFactory.getFont(family, size, Font.ITALIC, color);
            else if (htmlattr.bold)
                font = FontFactory.getFont(family, size, Font.BOLD, Color.blue);
        }
        if (tag.equalsIgnoreCase("html")) {
            myself = generateElementChildrenHtml(element, depth + 1, font);
        } else if (tag.equalsIgnoreCase("head")) {
            myself = null;
        } else if (tag.equalsIgnoreCase("body")) {
            myself = generateElementChildrenHtml(element, depth + 1, font);
        } else if (tag.equalsIgnoreCase("p") || tag.equalsIgnoreCase("p-implied")) {
            List<Object> children = generateElementChildrenHtml(element, depth + 1, normalFont);
            Paragraph paragraph = new Paragraph();
            paragraph.setFirstLineIndent(0F);
            for (Object child : children) {
                if (child instanceof Chunk) {
                    Chunk chunk = (Chunk) child;
                    /*if (!chunk.getContent().equals("\n"))*/ paragraph.add(chunk);
                } else
                    paragraph.add(child);
            }
            if (align != null)
                paragraph.setAlignment(align);
            myself = paragraph;
        } else if (tag.equalsIgnoreCase("h1") || tag.equalsIgnoreCase("h2") || tag.equalsIgnoreCase("h3")) {
            List<Object> children = generateElementChildrenHtml(element, depth + 1, subSectionFont);
            Paragraph title = new Paragraph();
            for (Object child : children) {
                title.add(child);
            }
            myself = new TempSectionPdf(title);
        } else if (tag.equalsIgnoreCase("ul")) {
            com.lowagie.text.List list = new com.lowagie.text.List(false, false, 20.0f);
            list.setIndentationLeft(25.0f);
            List<Object> children = generateElementChildrenHtml(element, depth + 1, normalFont);
            for (Object child : children) {
                list.add(child);
            }
            myself = list;
        } else if (tag.equalsIgnoreCase("ol")) {
            com.lowagie.text.List list = new com.lowagie.text.List(true, false, 20.0f);
            list.setIndentationLeft(25.0f);
            List<Object> children = generateElementChildrenHtml(element, depth + 1, normalFont);
            for (Object child : children) {
                list.add(child);
            }
            myself = list;
        } else if (tag.equalsIgnoreCase("li")) {
            ListItem li = new ListItem();
            li.setSpacingAfter(0.0f);
            List<Object> children = generateElementChildrenHtml(element, depth + 1, normalFont);
            for (Object child : children) {
                li.add(child);
            }
            myself = li;
        } else if (tag.equalsIgnoreCase("table")) {
            List<Object> rows = generateElementChildrenHtml(element, depth + 1, normalFont);
            try {
                int ncols = 0;
                for (Object row : rows) {
                    if (row instanceof List<?>) {
                        int n = ((List<?>) row).size();
                        if (n > ncols)
                            ncols = n;
                    }
                }
                Table table = new Table(2);
                table.setBorderWidth(1);
                table.setBorderColor(new Color(0, 128, 128));
                table.setPadding(1.0f);
                table.setSpacing(0.5f);
                Cell c = new Cell("header");
                c.setHeader(true);
                c.setColspan(ncols);
                table.addCell(c);
                table.endHeaders();
                for (Object row : rows) {
                    if (row instanceof List<?>) {
                        for (Object cell : (List<?>) row) {
                            if (cell instanceof Cell)
                                table.addCell((Cell) cell);
                        }
                    }
                }
                myself = table;
            } catch (BadElementException e) {
                e.printStackTrace();
                myself = null;
            }
        } else if (tag.equalsIgnoreCase("tr")) {
            List<Object> children = generateElementChildrenHtml(element, depth + 1, normalFont);
            myself = children;
        } else if (tag.equalsIgnoreCase("td")) {
            Cell cell = new Cell();
            List<Object> children = generateElementChildrenHtml(element, depth + 1, normalFont);
            for (Object child : children) {
                cell.add(child);
            }
            myself = cell;
        } else if (tag.equalsIgnoreCase("div")) {
            List<Object> children = generateElementChildrenHtml(element, depth + 1, normalFont);
            Paragraph paragraph = new Paragraph();
            paragraph.setFirstLineIndent(0F);
            for (Object child : children) {
                paragraph.add(child);
            }
            if (align != null)
                paragraph.setAlignment(align);
            myself = paragraph;
        } else {
            System.err.println("Unknown element " + element.getName());
            myself = null;
        }
    } else {
        myself = null; // could be BidiElement - not sure what it is
    }
    return myself;
}

From source file:com.googlecode.openmpis.action.CaseAction.java

License:Open Source License

/**
 * Writes the cases to a PDF file./*  w  ww .  j av a  2 s.c o  m*/
 *
 * @param mapping       the ActionMapping used to select this instance
 * @param form          the optional ActionForm bean for this request
 * @param request       the HTTP Request we are processing
 * @param response      the HTTP Response we are processing
 * @return              the forwarding instance
 * @throws java.lang.Exception
 */
public ActionForward printCases(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    User currentUser = null;

    // Check if there exists a session
    if (request.getSession().getAttribute("currentuser") != null) {
        currentUser = (User) request.getSession().getAttribute("currentuser");
    }

    // Set the paper size and margins
    Document document = new Document(PageSize.LETTER.rotate(), 50, 50, 50, 50);

    // Create the PDF writer
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PdfWriter.getInstance(document, baos);

    // Add some meta information to the document
    document.addTitle("Case Statistics");
    document.addAuthor("OpenMPIS");
    document.addSubject("Statistics for All Cases");
    document.addKeywords("OpenMPIS, missing, found, unidentified");
    document.addProducer();
    document.addCreationDate();
    document.addCreator("OpenMPIS version " + Constants.VERSION);

    // Set the header
    String date = simpleDateFormat.format(System.currentTimeMillis());
    document.setHeader(new HeaderFooter(new Phrase("Statistics for cases as of " + date), false));

    // Set the footer
    HeaderFooter footer = new HeaderFooter(new Phrase("Page : "), true);
    footer.setAlignment(Element.ALIGN_CENTER);
    document.setFooter(footer);

    // Open the document for writing
    document.open();
    Table table = new Table(2);
    table.setBorderWidth(1);
    table.setBorderColor(new Color(0, 0, 0));
    table.setPadding(2);
    table.setSpacing(0);
    Paragraph paragraph = new Paragraph("Cases",
            FontFactory.getFont(FontFactory.HELVETICA, 24, Font.BOLD, new Color(0, 0, 0)));
    paragraph.setAlignment(Paragraph.ALIGN_CENTER);
    Cell cell = new Cell(paragraph);
    cell.setHeader(true);
    cell.setColspan(2);
    table.addCell(cell);
    table.endHeaders();
    table.addCell("Total On-going Cases");
    table.addCell("" + personService.countOngoing());
    table.addCell("\t\t\t\t\tMissing Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countMissing());
    table.addCell("\t\t\t\t\tFamily Abductions");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countFamilyAbduction());
    table.addCell("\t\t\t\t\tNon-Family Abductions");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countNonFamilyAbduction());
    table.addCell("\t\t\t\t\tRunaway Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countRunaway());
    table.addCell("\t\t\t\t\tUnknown");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countUnknown());
    table.addCell("\t\t\t\t\tFound Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + personService.countFound());
    table.addCell("\t\t\t\t\tAbandoned Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + personService.countAbandoned());
    table.addCell("\t\t\t\t\tThrowaway Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + personService.countThrowaway());
    table.addCell("\t\t\t\t\tUnidentified");
    table.addCell(
            "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + personService.countUnidentified());
    table.addCell("Total Solved Cases");
    table.addCell("" + personService.countSolved());
    table.addCell("\t\t\t\t\tMissing Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countSolvedMissing());
    table.addCell("\t\t\t\t\tFamily Abductions");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countSolvedFamilyAbduction());
    table.addCell("\t\t\t\t\tNon-Family Abductions");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countSolvedNonFamilyAbduction());
    table.addCell("\t\t\t\t\tRunaway Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countSolvedRunaway());
    table.addCell("\t\t\t\t\tUnknown");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countSolvedUnknown());
    table.addCell("\t\t\t\t\tFound Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + personService.countSolvedFound());
    table.addCell("\t\t\t\t\tAbandoned Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + personService.countSolvedAbandoned());
    table.addCell("\t\t\t\t\tThrowaway Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + personService.countSolvedThrowaway());
    table.addCell("\t\t\t\t\tUnidentified");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
            + personService.countSolvedUnidentified());
    table.addCell("Total Unsolved Cases");
    table.addCell("" + personService.countUnsolved());
    table.addCell("\t\t\t\t\tMissing Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countUnsolvedMissing());
    table.addCell("\t\t\t\t\tFamily Abductions");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countUnsolvedFamilyAbduction());
    table.addCell("\t\t\t\t\tNon-Family Abductions");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countUnsolvedNonFamilyAbduction());
    table.addCell("\t\t\t\t\tRunaway Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countUnsolvedRunaway());
    table.addCell("\t\t\t\t\tUnknown");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countUnsolvedUnknown());
    table.addCell("\t\t\t\t\tFound Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + personService.countUnsolvedFound());
    table.addCell("\t\t\t\t\tAbandoned Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + personService.countUnsolvedAbandoned());
    table.addCell("\t\t\t\t\tThrowaway Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + personService.countUnsolvedThrowaway());
    table.addCell("\t\t\t\t\tUnidentified");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
            + personService.countUnsolvedUnidentified());
    table.addCell("Total Cases");
    table.addCell("" + personService.countAllPersons());
    table.addCell("\t\t\t\t\tTotal Missing Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + personService.countAllMissing());
    table.addCell("\t\t\t\t\tTotal Found Persons");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + personService.countAllFound());
    table.addCell("\t\t\t\t\tTotal Unidentified Persons");
    table.addCell(
            "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + personService.countUnidentified());
    table.addCell("Total Relatives");
    table.addCell("" + relativeService.countAllRelatives());
    table.addCell("Total Abductors");
    table.addCell("" + abductorService.countAllAbductors());
    document.add(table);
    if (currentUser != null) {
        // List ongoing cases
        document.setHeader(new HeaderFooter(new Phrase("List of ongoing cases as of " + date), false));
        document.newPage();
        float[] widths = { 0.05f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.05f, 0.15f, 0.1f, 0.1f, 0.05f };
        PdfPTable pdfptable = new PdfPTable(widths);
        pdfptable.setWidthPercentage(100);
        pdfptable.addCell(new Phrase("ID", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Last Name", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("First Name", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Nickname", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Middle Name", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Case Type", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Status", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Photo", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Relative", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Abductor", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Investigator", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        List<Person> personList = personService.listOngoing();
        if (personList != null) {
            for (Person person : personList) {
                // Process the photo
                String tokens[] = person.getPhoto().split("\\/");
                String defaultPhotoBasename = "";
                for (int i = 0; i < tokens.length - 1; i++) {
                    defaultPhotoBasename += tokens[i] + File.separator;
                }
                defaultPhotoBasename += tokens[tokens.length - 1];
                String absoluteDefaultPhotoFilename = getServlet().getServletContext().getRealPath("/")
                        + defaultPhotoBasename;
                Image image = Image.getInstance(absoluteDefaultPhotoFilename);
                image.scaleAbsolute(50, 75);
                image.setAlignment(Image.ALIGN_CENTER);

                pdfptable.addCell(
                        new Phrase("" + person.getId(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(person.getLastName(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(person.getFirstName(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(person.getNickname(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(person.getMiddleName(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(new Phrase(getResources(request).getMessage("type." + person.getType()),
                        FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(getResources(request).getMessage("status.case." + person.getStatus()),
                                FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(image);
                String relativeName = "";
                if (person.getRelativeId() != null) {
                    Relative relative = relativeService.getRelativeById(person.getRelativeId());
                    relativeName = relative.getFirstName() + " " + relative.getLastName();
                }
                pdfptable.addCell(new Phrase(relativeName, FontFactory.getFont(FontFactory.HELVETICA, 8)));
                String abductorName = "";
                if (person.getAbductorId() != null) {
                    Abductor abductor = abductorService.getAbductorById(person.getAbductorId());
                    abductorName = abductor.getFirstName() + " " + abductor.getLastName();
                }
                pdfptable.addCell(new Phrase(abductorName, FontFactory.getFont(FontFactory.HELVETICA, 8)));
                String investigatorUsername = "";
                if (person.getInvestigatorId() != null) {
                    User investigator = userService.getUserById(person.getInvestigatorId());
                    investigatorUsername = investigator.getUsername();
                }
                pdfptable.addCell(
                        new Phrase(investigatorUsername, FontFactory.getFont(FontFactory.HELVETICA, 8)));
            }
        }
        document.add(pdfptable);

        // List solved cases
        document.setHeader(new HeaderFooter(new Phrase("List of solved cases as of " + date), false));
        document.newPage();
        pdfptable = new PdfPTable(widths);
        pdfptable.setWidthPercentage(100);
        pdfptable.addCell(new Phrase("ID", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Last Name", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("First Name", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Nickname", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Middle Name", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Case Type", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Status", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Photo", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Relative", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Abductor", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Investigator", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        personList = personService.listSolved();
        if (personList != null) {
            for (Person person : personList) {
                // Process the photo
                String tokens[] = person.getPhoto().split("\\/");
                String defaultPhotoBasename = "";
                for (int i = 0; i < tokens.length - 1; i++) {
                    defaultPhotoBasename += tokens[i] + File.separator;
                }
                defaultPhotoBasename += tokens[tokens.length - 1];
                String absoluteDefaultPhotoFilename = getServlet().getServletContext().getRealPath("/")
                        + defaultPhotoBasename;
                Image image = Image.getInstance(absoluteDefaultPhotoFilename);
                image.scaleAbsolute(50, 75);
                image.setAlignment(Image.ALIGN_CENTER);

                pdfptable.addCell(
                        new Phrase("" + person.getId(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(person.getLastName(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(person.getFirstName(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(person.getNickname(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(person.getMiddleName(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(new Phrase(getResources(request).getMessage("type." + person.getType()),
                        FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(getResources(request).getMessage("status.case." + person.getStatus()),
                                FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(image);
                String relativeName = "";
                if (person.getRelativeId() != null) {
                    Relative relative = relativeService.getRelativeById(person.getRelativeId());
                    relativeName = relative.getFirstName() + " " + relative.getLastName();
                }
                pdfptable.addCell(new Phrase(relativeName, FontFactory.getFont(FontFactory.HELVETICA, 8)));
                String abductorName = "";
                if (person.getAbductorId() != null) {
                    Abductor abductor = abductorService.getAbductorById(person.getAbductorId());
                    abductorName = abductor.getFirstName() + " " + abductor.getLastName();
                }
                pdfptable.addCell(new Phrase(abductorName, FontFactory.getFont(FontFactory.HELVETICA, 8)));
                String investigatorUsername = "";
                if (person.getInvestigatorId() != null) {
                    User investigator = userService.getUserById(person.getInvestigatorId());
                    investigatorUsername = investigator.getUsername();
                }
                pdfptable.addCell(
                        new Phrase(investigatorUsername, FontFactory.getFont(FontFactory.HELVETICA, 8)));
            }
        }
        document.add(pdfptable);

        // List unsolved cases
        document.setHeader(new HeaderFooter(new Phrase("List of unsolved cases as of " + date), false));
        document.newPage();
        pdfptable = new PdfPTable(widths);
        pdfptable.setWidthPercentage(100);
        pdfptable.addCell(new Phrase("ID", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Last Name", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("First Name", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Nickname", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Middle Name", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Case Type", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Status", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Photo", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Relative", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Abductor", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        pdfptable.addCell(new Phrase("Investigator", FontFactory.getFont(FontFactory.HELVETICA, 12)));
        personList = personService.listUnsolved();
        if (personList != null) {
            for (Person person : personList) {
                // Process the photo
                String tokens[] = person.getPhoto().split("\\/");
                String defaultPhotoBasename = "";
                for (int i = 0; i < tokens.length - 1; i++) {
                    defaultPhotoBasename += tokens[i] + File.separator;
                }
                defaultPhotoBasename += tokens[tokens.length - 1];
                String absoluteDefaultPhotoFilename = getServlet().getServletContext().getRealPath("/")
                        + defaultPhotoBasename;
                Image image = Image.getInstance(absoluteDefaultPhotoFilename);
                image.scaleAbsolute(50, 75);
                image.setAlignment(Image.ALIGN_CENTER);

                pdfptable.addCell(
                        new Phrase("" + person.getId(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(person.getLastName(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(person.getFirstName(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(person.getNickname(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(person.getMiddleName(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(new Phrase(getResources(request).getMessage("type." + person.getType()),
                        FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(getResources(request).getMessage("status.case." + person.getStatus()),
                                FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(image);
                String relativeName = "";
                if (person.getRelativeId() != null) {
                    Relative relative = relativeService.getRelativeById(person.getRelativeId());
                    relativeName = relative.getFirstName() + " " + relative.getLastName();
                }
                pdfptable.addCell(new Phrase(relativeName, FontFactory.getFont(FontFactory.HELVETICA, 8)));
                String abductorName = "";
                if (person.getAbductorId() != null) {
                    Abductor abductor = abductorService.getAbductorById(person.getAbductorId());
                    abductorName = abductor.getFirstName() + " " + abductor.getLastName();
                }
                pdfptable.addCell(new Phrase(abductorName, FontFactory.getFont(FontFactory.HELVETICA, 8)));
                String investigatorUsername = "";
                if (person.getInvestigatorId() != null) {
                    User investigator = userService.getUserById(person.getInvestigatorId());
                    investigatorUsername = investigator.getUsername();
                }
                pdfptable.addCell(
                        new Phrase(investigatorUsername, FontFactory.getFont(FontFactory.HELVETICA, 8)));
            }
        }
        document.add(pdfptable);
    }
    document.close();

    // Set the response to return the poster (PDF file)
    response.setContentType("application/pdf");
    response.setContentLength(baos.size());
    response.setHeader("Content-disposition", "attachment; filename=Case_Statistics.pdf");

    // Close the output stream
    baos.writeTo(response.getOutputStream());
    response.getOutputStream().flush();

    return null;
}

From source file:com.googlecode.openmpis.action.UserAction.java

License:Open Source License

/**
 * Writes the users to a PDF file.//w  ww .ja  v a  2s.c o m
 *
 * @param mapping       the ActionMapping used to select this instance
 * @param form          the optional ActionForm bean for this request
 * @param request       the HTTP Request we are processing
 * @param response      the HTTP Response we are processing
 * @return              the forwarding instance
 * @throws java.lang.Exception
 */
public ActionForward printUsers(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    User currentUser = null;

    // Check if there exists a session
    if (request.getSession().getAttribute("currentuser") != null) {
        currentUser = (User) request.getSession().getAttribute("currentuser");
    }

    // Set the paper size and margins
    Document document = new Document(PageSize.LETTER.rotate(), 50, 50, 50, 50);

    // Create the PDF writer
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PdfWriter.getInstance(document, baos);

    // Add some meta information to the document
    document.addTitle("Case Statistics");
    document.addAuthor("OpenMPIS");
    document.addSubject("Statistics for All Cases");
    document.addKeywords("OpenMPIS, missing, found, unidentified");
    document.addProducer();
    document.addCreationDate();
    document.addCreator("OpenMPIS version " + Constants.VERSION);

    // Set the header
    String date = simpleDateFormat.format(System.currentTimeMillis());
    document.setHeader(new HeaderFooter(new Phrase("List of users as of " + date), false));

    // Set the footer
    HeaderFooter footer = new HeaderFooter(new Phrase("Page : "), true);
    footer.setAlignment(Element.ALIGN_CENTER);
    document.setFooter(footer);

    // Open the document for writing
    document.open();
    Table table = new Table(2);
    table.setBorderWidth(1);
    table.setPadding(2);
    table.setSpacing(0);
    Paragraph paragraph = new Paragraph("Users", FontFactory.getFont(FontFactory.HELVETICA, 24, Font.BOLD));
    paragraph.setAlignment(Paragraph.ALIGN_CENTER);
    Cell cell = new Cell(paragraph);
    cell.setHeader(true);
    cell.setColspan(2);
    table.addCell(cell);
    table.endHeaders();
    table.addCell("Total Administrators");
    table.addCell("" + userService.countAdministrators());
    table.addCell("\t\t\t\t\tActive Administrators");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + userService.countActiveAdministrators());
    table.addCell("\t\t\t\t\tSuspended Administrators");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + userService.countSuspendedAdministrators());
    table.addCell("Total Encoders");
    table.addCell("" + userService.countEncoders());
    table.addCell("\t\t\t\t\tActive Encoders");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + userService.countActiveEncoders());
    table.addCell("\t\t\t\t\tSuspended Encoders");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + userService.countSuspendedEncoders());
    table.addCell("Total Investigators");
    table.addCell("" + userService.countInvestigators());
    table.addCell("\t\t\t\t\tActive Investigators");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + userService.countActiveInvestigators());
    table.addCell("\t\t\t\t\tSuspended Investigators");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + userService.countSuspendedInvestigators());
    table.addCell("Total Users");
    table.addCell("" + userService.countAllUsers());
    table.addCell("\t\t\t\t\tTotal Active Users");
    table.addCell("\t\t\t\t\t\t\t\t\t\t" + userService.countActiveUsers());
    table.addCell("\t\t\t\t\tTotal Suspended Users");
    table.addCell("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" + userService.countSuspendedUsers());
    document.add(table);
    if (currentUser != null) {
        if ((currentUser.getGroupId() == 0) || (currentUser.getGroupId() == 1)) {
            // List administrators
            document.setHeader(new HeaderFooter(new Phrase("List of administrators as of " + date), false));
            document.newPage();
            float[] widths = { 0.03f, 0.07f, 0.1f, 0.1f, 0.1f, 0.1f, 0.2f, 0.05f };
            PdfPTable pdfptable = new PdfPTable(widths);
            pdfptable.setWidthPercentage(100);
            pdfptable.addCell(new Phrase("ID", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("Group", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("Last Name", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("First Name", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("Agency", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("Designation", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("E-mail Address", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("Status", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            List<User> administratorList = userService.listAdministrators();
            for (User administrator : administratorList) {
                pdfptable.addCell(
                        new Phrase("" + administrator.getId(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(getResources(request).getMessage("group." + administrator.getGroupId()),
                                FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(administrator.getLastName(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(new Phrase(administrator.getFirstName(),
                        FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(administrator.getAgency(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(new Phrase(administrator.getDesignation(),
                        FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(administrator.getEmail(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(getResources(request).getMessage("status.user." + administrator.getStatus()),
                                FontFactory.getFont(FontFactory.HELVETICA, 8)));
            }
            document.add(pdfptable);

            // List encoders
            document.setHeader(new HeaderFooter(new Phrase("List of encoders as of " + date), false));
            document.newPage();
            pdfptable = new PdfPTable(widths);
            pdfptable.setWidthPercentage(100);
            pdfptable.addCell(new Phrase("ID", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("Group", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("Last Name", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("First Name", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("Agency", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("Designation", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("E-mail Address", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("Status", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            List<User> encoderList = userService.listEncoders();
            for (User encoder : encoderList) {
                pdfptable.addCell(
                        new Phrase("" + encoder.getId(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(new Phrase(getResources(request).getMessage("group." + encoder.getGroupId()),
                        FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(encoder.getLastName(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(encoder.getFirstName(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(encoder.getAgency(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(encoder.getDesignation(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable
                        .addCell(new Phrase(encoder.getEmail(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(getResources(request).getMessage("status.user." + encoder.getStatus()),
                                FontFactory.getFont(FontFactory.HELVETICA, 8)));
            }
            document.add(pdfptable);

            // List investigators
            document.setHeader(new HeaderFooter(new Phrase("List of investigators as of " + date), false));
            document.newPage();
            pdfptable = new PdfPTable(widths);
            pdfptable.setWidthPercentage(100);
            pdfptable.addCell(new Phrase("ID", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("Group", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("Last Name", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("First Name", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("Agency", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("Designation", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("E-mail Address", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            pdfptable.addCell(new Phrase("Status", FontFactory.getFont(FontFactory.HELVETICA, 12)));
            List<User> investigatorList = userService.listInvestigators();
            for (User investigator : investigatorList) {
                pdfptable.addCell(
                        new Phrase("" + investigator.getId(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(getResources(request).getMessage("group." + investigator.getGroupId()),
                                FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(investigator.getLastName(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(investigator.getFirstName(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(investigator.getAgency(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(new Phrase(investigator.getDesignation(),
                        FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(investigator.getEmail(), FontFactory.getFont(FontFactory.HELVETICA, 8)));
                pdfptable.addCell(
                        new Phrase(getResources(request).getMessage("status.user." + investigator.getStatus()),
                                FontFactory.getFont(FontFactory.HELVETICA, 8)));
            }
            document.add(pdfptable);
        }
    }
    document.close();

    // Set the response to return the poster (PDF file)
    response.setContentType("application/pdf");
    response.setContentLength(baos.size());
    response.setHeader("Content-disposition", "attachment; filename=User_Statistics.pdf");

    // Close the output stream
    baos.writeTo(response.getOutputStream());
    response.getOutputStream().flush();

    return null;
}

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

License:Open Source License

private void writeBooleanQuestionStatistics(Document document, Question question,
        List<QuestionStatistic> questionStatistics, String optionLabel, String optionFrequencyLabel,
        String trueLabel, String falseLabel) throws Exception {

    NumberFormat percentFormat = NumberFormat.getPercentInstance();
    percentFormat.setMaximumFractionDigits(1);

    Table statsTable = createOptionsQuestionStatisticsTableHeader(optionLabel, optionFrequencyLabel);
    Cell cell;
    Boolean foundOption = false;//  w  ww . ja v a 2  s.  co  m

    cell = new Cell(new Paragraph(trueLabel, normalFont));
    statsTable.addCell(cell);
    if (questionStatistics != null && questionStatistics.size() > 0) {
        for (QuestionStatistic questionStatistic : questionStatistics) {
            if (questionStatistic.getEntry().equals("1")) {
                foundOption = true;
                cell = new Cell(
                        new Paragraph(percentFormat.format(questionStatistic.getFrequency()), normalFont));
                statsTable.addCell(cell);

                cell = new Cell();
                Image img = Image.getInstance(this.getClass().getResource("/chartbar.png"));
                cell.setColspan(5);
                img.scaleAbsolute((float) (questionStatistic.getFrequency() * 210), 10f);
                cell.addElement(img);
                cell.setVerticalAlignment(Cell.ALIGN_BOTTOM);
                statsTable.addCell(cell);
                break;
            }
        }
    }
    if (!foundOption) {
        cell = new Cell(new Paragraph(percentFormat.format(0), normalFont));
        statsTable.addCell(cell);

        cell = new Cell();
        cell.setColspan(5);
        statsTable.addCell(cell);
    }

    foundOption = false;
    cell = new Cell(new Paragraph(falseLabel, normalFont));
    statsTable.addCell(cell);
    if (questionStatistics != null && questionStatistics.size() > 0) {
        for (QuestionStatistic questionStatistic : questionStatistics) {
            if (questionStatistic.getEntry().equals("0")) {
                foundOption = true;
                cell = new Cell(
                        new Paragraph(percentFormat.format(questionStatistic.getFrequency()), normalFont));
                statsTable.addCell(cell);

                cell = new Cell();
                Image img = Image.getInstance(this.getClass().getResource("/chartbar.png"));
                cell.setColspan(5);
                img.scaleAbsolute((float) (questionStatistic.getFrequency() * 210), 10f);
                cell.addElement(img);
                cell.setVerticalAlignment(Cell.ALIGN_BOTTOM);
                statsTable.addCell(cell);
                break;
            }
        }
    }
    if (!foundOption) {
        cell = new Cell(new Paragraph(percentFormat.format(0), normalFont));
        statsTable.addCell(cell);

        cell = new Cell();
        cell.setColspan(5);
        statsTable.addCell(cell);
    }
    document.add(statsTable);

}

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

License:Open Source License

private void writeOptionsQuestionStatistics(Document document, Question question,
        List<QuestionStatistic> questionStatistics, String optionLabel, String optionFrequencyLabel)
        throws Exception {

    NumberFormat percentFormat = NumberFormat.getPercentInstance();
    percentFormat.setMaximumFractionDigits(1);

    Table statsTable = createOptionsQuestionStatisticsTableHeader(optionLabel, optionFrequencyLabel);
    Cell cell;

    int rowIndex = 0;
    for (QuestionOption option : question.getOptions()) {
        Boolean foundOption = false;
        cell = new Cell(new Paragraph(option.getText(), normalFont));
        //if ((rowIndex % 2) == 1) {cell.setBackgroundColor(new Color(244,244,244));}
        statsTable.addCell(cell);/*from   www. j av  a 2 s.com*/

        if (questionStatistics != null && questionStatistics.size() > 0) {
            for (QuestionStatistic questionStatistic : questionStatistics) {
                if (question.getType().getIsMultipleValue()) {
                    //multiple value question (checkboxes) match on order
                    if (questionStatistic.getOptionOrder().equals(option.getOrder())) {
                        foundOption = true;

                        cell = new Cell(new Paragraph(percentFormat.format(questionStatistic.getFrequency()),
                                normalFont));
                        statsTable.addCell(cell);

                        cell = new Cell();
                        Image img = Image.getInstance(this.getClass().getResource("/chartbar.png"));
                        cell.setColspan(5);
                        img.scaleAbsolute((float) (questionStatistic.getFrequency() * 210), 10f);
                        cell.addElement(img);
                        cell.setVerticalAlignment(Cell.ALIGN_BOTTOM);
                        statsTable.addCell(cell);
                        break;
                    }
                } else {
                    //single value question match on value
                    if (questionStatistic.getEntry() != null
                            && questionStatistic.getEntry().equals(option.getValue())) {
                        foundOption = true;
                        cell = new Cell(new Paragraph(percentFormat.format(questionStatistic.getFrequency()),
                                normalFont));
                        //if ((rowIndex % 2) == 1) {cell.setBackgroundColor(new Color(244,244,244));}
                        statsTable.addCell(cell);

                        cell = new Cell();
                        //if ((rowIndex % 2) == 1) {cell.setBackgroundColor(new Color(244,244,244));}
                        Image img = Image.getInstance(this.getClass().getResource("/chartbar.png"));
                        cell.setColspan(5);
                        img.scaleAbsolute((float) (questionStatistic.getFrequency() * 210), 10f);
                        cell.addElement(img);
                        cell.setVerticalAlignment(Cell.ALIGN_BOTTOM);
                        statsTable.addCell(cell);
                        break;
                    }

                }
            }
        }

        if (!foundOption) {

            cell = new Cell(new Paragraph(percentFormat.format(0), normalFont));
            //if ((rowIndex % 2) == 1) {cell.setBackgroundColor(new Color(244,244,244));}
            statsTable.addCell(cell);

            cell = new Cell();
            //if ((rowIndex % 2) == 1) {cell.setBackgroundColor(new Color(244,244,244));}
            cell.setColspan(5);
            statsTable.addCell(cell);
        }
        rowIndex++;
    }
    document.add(statsTable);

}

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 {//  w w w .j  a v  a2  s.c  om
        //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.sinkluge.reports.contracts.GenSubcontract.java

public void create(Info in, Image toplogo) throws Exception {

    //for the unchecked box
    Image checkbox = Image.getInstance(in.path + "/WEB-INF/images/unchecked.jpg");
    Chunk ch2 = new Chunk(checkbox, -7, -7);
    Phrase checkboxPhrase = new Phrase();
    checkboxPhrase.add(ch2);//from w ww . j a  va 2  s  .  co m

    Font tnr8 = new Font(Font.TIMES_ROMAN, 8, Font.NORMAL);

    Image iBox = Image.getInstance(in.path + "/WEB-INF/images/initialsBox.jpg");//(in.path + "/jsp/dev/images/epcologo3.jpg");
    Chunk ch3 = new Chunk(iBox, -3, -3);
    Phrase initialsBoxPhrase = new Phrase();
    initialsBoxPhrase.add(ch3);

    Phrase footerPhrase = new Phrase(
            attr.get("full_name") + ", " + attr.get("address") + ", " + attr.get("city") + ", "
                    + attr.get("state") + " " + attr.get("zip") + "\nPhone: " + attr.get("phone") + "   Fax: "
                    + attr.get("fax") + "   " + attr.get("url") + "   Page: ",
            new Font(Font.TIMES_ROMAN, 7, Font.BOLD | Font.ITALIC));

    HeaderFooter footer = new HeaderFooter(footerPhrase, true);
    footer.setBorder(0);
    footer.setAlignment(Element.ALIGN_CENTER);
    init(40, 40, 40, 40, footer);

    Phrase underLinePhrase = new Phrase(
            "  ___________________________________________________________________________________________  ",
            new Font(Font.TIMES_ROMAN, 10, Font.BOLD));
    int[] twoC = { 30, 70 };
    int[] twoD = { 5, 95 };
    int[] twoF = { 10, 90 };
    int[] twoE = { 25, 75 };
    int[] twoG = { 40, 60 };
    int[] threeD = { 4, 11, 85 };
    int[] threeB = { 70, 15, 15 };
    //int[] threeC = { 47, 5, 48 };
    int[] five = { 18, 25, 14, 18, 25 };

    //blank spacer for keeping tables apart
    Table spacer = new Table(1, 1);
    spacer.setBorderWidth(0);
    //spacer.setDefaultCellBorderWidth(0);
    spacer.setWidth(100);
    spacer.setPadding(0);
    spacer.setSpacing(0);
    Cell blank = new Cell();
    blank.add(new Chunk("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD, new Color(255, 255, 255))));
    blank.setBorderWidth(0);
    //blank.setLeading(0);
    spacer.addCell(blank);

    //start of document
    //document.setFooter(footer);

    //document.setFooter(footer);

    //add image
    Phrase p1 = new Phrase();
    Table table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(2);
    table1.setSpacing(2);
    toplogo.scalePercent(20);
    //Chunk ch1=new Chunk(toplogo, -36, -55);
    //p1.add(ch1);
    Cell cell = new Cell(toplogo);
    cell.setBorderWidth(0);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    table1.addCell(cell);

    document.add(table1);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setLeading(19);
    cell.add(
            new Phrase(title.toUpperCase() + " AGREEMENT BETWEEN CONTRACTOR AND " + cTitle.toUpperCase() + "\n",
                    new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setUseDescender(true);
    cell.setBackgroundColor(Color.lightGray);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setSpacing(0);
    cell = new Cell();
    cell.add(underLinePhrase);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("\nDOCUMENTS CONTAINED HEREIN:\n", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(3, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setWidths(threeD);
    table1.setPadding(0);
    table1.setSpacing(0);
    table1.addCell(blank);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Page 1", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Agreement Declaration", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.add(new Phrase("    Initial boxes below to indicate complete review of this agreement.",
            new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Page 2", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Articles of " + title + " Agreement and Standard Provisions", tnr8));
    cell.add(new Phrase("    Sign the concluding page.", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Exhibit \"A\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("List of Contract Documents, Plans, Specifications, Etc.", tnr8));
    cell.setBorder(0);
    //cell.add(new Phrase("    Read and initial each page.", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
    table1.addCell(cell);

    table1.addCell(blank);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Exhibit \"B\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(cTitle + "'s Scope of Work", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase("Exhibit \"C\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase(cTitle + "'s Special Provisions and Procedure Requirements", tnr8));
    cell.add(new Phrase("    Read and complete \"Release Authorization\" information.",
            new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);
    table1.addCell(blank);
    if (insure) {
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase("Exhibit \"D\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);

        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(cTitle + " Cost Breakdown", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.add(new Phrase("    Complete and return with signed contract",
                new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
        cell.setBorder(0);
        table1.addCell(cell);

        table1.addCell(blank);
    }
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.setColspan(2);
    cell.add(new Phrase("NOTE OTHERS HERE:", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);

    table1 = new Table(3);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setWidths(threeB);
    table1.addCell(blank);
    cell = new Cell();
    cell.setColspan(2);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("(Initial) Entire agreement thoroughly reviewed:\n",
            new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);

    cell = new Cell();

    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Contractor: ________", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(cTitle + ": ________", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setColspan(3);
    cell.add(underLinePhrase);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("AGREEMENT", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" made as of " + agreementDate, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("BETWEEN", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the Contractor: \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + attr.get("full_name") + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + attr.get("address") + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + attr.get("city") + ", " + attr.get("state") + " " + attr.get("zip"),
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("                (hereinafter known as \"Contractor\")\n",
            new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("AND", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the " + cTitle + ": \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + subName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + subAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + subCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("                (hereinafter known as \"" + cTitle + "\")\n",
            new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("FOR", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the the fixed sum of  " + DocHelper.numberAndText(amount) + " \n",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    //cell.add(new Phrase("     " + amountString + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("FOR", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the Project known as:\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + projectName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + projectAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + projectCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("                (hereinafter known as \"Project\")\n",
            new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("BY", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the Architect:\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + architectName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + architectAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + architectCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("                (hereinafter known as \"Architect\")\n",
            new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("FOR", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the Project owner:\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + ownerName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + ownerAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + ownerCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("                (hereinafter known as \"Owner\")\n",
            new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("WHEREFORE", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the Contractor and " + cTitle + " agree as follows:\n\n\n",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);
    /*
          table1 = new Table(1);
          table1.setBorderWidth(0); table1.setWidth(100);
          //table1.setDefaultCellBorder(0);
          table1.setPadding(0);
               
          cell = new Cell();
          cell.setHorizontalAlignment("center");
          cell.setVerticalAlignment("middle");
          //cell.add(new Phrase("\n", new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
          cell.setBorder(Rectangle.BOTTOM | Rectangle.TOP);
          cell.setBorderWidth(1.1f);
          cell.add(footerPhrase);
          cell.add(new Phrase(" 1\n ",
    new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
          //cell.add(footerPhrase2);
                  
          cell.setBorder(0); table1.addCell(cell);
            
          document.add(table1);
    */
    document.newPage();

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(title.toUpperCase() + " AGREEMENT\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setBackgroundColor(Color.lightGray);
    cell.setLeading(19);
    cell.setUseDescender(true);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    Paragraph para = new Paragraph(8, "\n\n" + text.toString(), tnr8);

    document.add(para);

    Phrase p;

    document.add(spacer);
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setWidths(twoC);
    table1.setPadding(0);
    p = new Phrase("Date:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);
    p = new Phrase("Signed:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);

    p = new Phrase("_______________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);
    p = new Phrase("_________________________________________________________________",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("            General Contractor                                               Title\n",
            tnr8));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setColspan(2);
    cell.add(new Phrase("\nThis " + title
            + " Agreement supercedes all other proposals, documents, and negotiations whether written or verbal\n\n",
            new Font(Font.TIMES_ROMAN, 8, Font.BOLDITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);

    p = new Phrase("Date:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);
    p = new Phrase("Signed:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);

    p = new Phrase("_______________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);
    p = new Phrase("_________________________________________________________________",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(
            "            " + cTitle + "                                                       Title\n", tnr8));
    cell.setBorder(0);
    table1.addCell(cell);
    table1.setCellsFitPage(true);
    table1.setTableFitsPage(true);
    document.add(table1);

    document.newPage();

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(cTitle.toUpperCase() + " INFORMATION\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setBackgroundColor(Color.lightGray);
    cell.setLeading(19);
    cell.setUseDescender(true);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    document.add(new Phrase("\n"));

    table1 = new Table(5, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(1);
    table1.setWidths(five);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase("Federal I.D. : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(federal_id, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase("(Both Required)", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)));

    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("License Number : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(license_number, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase("Contact : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.setUseDescender(true);
    cell.add(new Phrase(contactName, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Company : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(subName, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Telephone : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.setUseDescender(true);
    cell.add(new Phrase(telephone, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Fax : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(fax, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase("Mobile phone : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(mobile, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("E-mail : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(email, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    document.add(table1);

    //document.add(spacer);

    table1 = new Table(1, 1);
    //table1.setBorderWidth(4);
    //table1.setBorderColor(Color.lightGray);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setBorder(0);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    if (insure)
        cell.add(new Phrase("Please attach a COPY of your current state license to this page:",
                new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    else
        cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);
    document.add(spacer);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    if (insure)
        cell.add(new Phrase("\n\nAttach\nCopy of\nContractor's\nLicense\nHere\n(If Applicable)",
                new Font(Font.TIMES_ROMAN, 24, Font.NORMAL, Color.lightGray)));
    else
        cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 24, Font.NORMAL, Color.lightGray)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    //document.setMargins(72, 72, 36, 36);
    document.newPage();

    table1 = new Table(1, 1);
    table1.setOffset(0);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidth(100);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"A\"\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setLeading(6);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("CONTRACT DOCUMENTS, PLANS,\nSPECIFICATIONS, ADDENDUMS, ETC.\n",
            new Font(Font.TIMES_ROMAN, 16, Font.BOLD)));
    cell.setUseDescender(true);
    cell.setLeading(17);
    cell.setBackgroundColor(Color.lightGray);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("\n" + subName
            + " is responsible to verify versions, dates, and completeness of documents that were used in the preparation of the "
            + cTitle + "'s bid proposal before signing this " + title + " Agreement\n", tnr8));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("This " + title + " Agreement includes, but is not limited to the following items:",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    cell.setBorder(Rectangle.BOTTOM);
    cell.setBorderWidth(0.5f);
    table1.addCell(cell);
    document.add(table1);

    Paragraph prgh = new Paragraph("\n" + bidDocuments + "\n", tnr8);
    prgh.setLeading(10);
    document.add(prgh);

    document.add(spacer);
    /*
     p = new Phrase("\n"+bidDocuments, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
     p.setLeading(10);
     cell= new Cell(p);
     cell.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
     cell.setBorderWidth(0.5f);
     //cell.setBorderColor(Color.lightGray);
     cell.setHorizontalAlignment("left");
     cell.setVerticalAlignment("middle");
     //cell.setLeading(10);
     cell.setUseDescender(true);
     table1.addCell(cell);
     */

    table1 = new Table(1, 1);
    table1.setOffset(0);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidth(100);
    table1.setTableFitsPage(true);
    p = new Phrase("\nPlease note below all verbal conditions or instructions, if any, that the " + cTitle
            + " has received during the bid process which might affect the scope of work as required by the contract documents",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    p.setLeading(10);
    cell = new Cell(p);
    cell.setBorder(Rectangle.TOP);
    cell.setBorderWidth(0.5f);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    table1.addCell(cell);

    document.add(table1);

    document.newPage();

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setOffset(0);
    table1.setWidth(100);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"B\"\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setLeading(6);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("SCOPE OF WORK\n", new Font(Font.TIMES_ROMAN, 16, Font.BOLD)));
    cell.setBackgroundColor(Color.lightGray);
    cell.setUseDescender(true);
    cell.setLeading(17);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(
            "\nThis " + title + " Agreement includes, but is not limited to the following items:\n\n",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setBorder(Rectangle.BOTTOM);
    cell.setBorderWidth(0.5f);
    table1.addCell(cell);

    document.add(table1);

    prgh = new Paragraph("\n" + contractDescription + "\n", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL));
    prgh.setLeading(10);
    document.add(prgh);
    //cell= new Cell(prgh);
    //cell.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
    //cell.setBorderWidth(0.5f);
    //cell.setBorderColor(Color.lightGray);
    //cell.setHorizontalAlignment("left");
    //cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    //cell.setUseDescender(true);
    //table1.addCell(cell);

    document.add(spacer);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setOffset(0);
    table1.setWidth(100);
    table1.setTableFitsPage(true);

    p = new Phrase("\nAll " + cTitle
            + " bid proposal conditions that are outside of, in addition to or are limiting of conditions contained in the Contract Documents are of no effect and are invalid to the "
            + title + " Agreement unless expressly included in the description above.", tnr8);
    p.setLeading(10);
    cell = new Cell(p);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.setBorder(Rectangle.TOP);
    cell.setBorderWidth(0.5f);
    table1.addCell(cell);

    document.add(table1);

    //document.setMargins(10, 10, 30, 30);

    document.newPage();

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setOffset(0);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"C\"\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setLeading(6);
    cell.setBorder(0);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(cTitle.toUpperCase() + " SPECIAL PROVISIONS AND REQUIREMENTS\n",
            new Font(Font.TIMES_ROMAN, 16, Font.BOLD)));
    cell.setBackgroundColor(Color.lightGray);
    cell.setUseDescender(true);
    cell.setLeading(17);
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);

    int count = 1;

    if (insure) {

        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setOffset(4);
        cell = new Cell();
        cell.add(new Phrase("1.     Insurance Provisions (If Applicable)",
                new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
        //cell.setLeading(6);
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
        count++;
        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setWidths(twoD);
        table1.setOffset(0);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.setLeading(6);
        cell.add(new Phrase(
                "a.  The " + cTitle + " is required to name the following as additional Primary-Insured:",
                tnr8));
        table1.addCell(blank);
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);

        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setWidths(twoE);
        table1.setOffset(0);
        cell = new Cell();
        cell.setHorizontalAlignment("right");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase("Contractor:  ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(attr.get("full_name"), new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("right");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase("Owner:  ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(ownerName, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("right");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase("Other:  ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase("_______________________________________", tnr8));
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);

        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setWidths(twoD);
        table1.setOffset(4);
        p = new Phrase("b.  The " + cTitle
                + " must provide verification of current Worker's Compensation coverage with reference to "
                + jobName + " on the policy.", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL));
        p.setLeading(8);
        cell = new Cell(p);
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.setLeading(8);
        table1.addCell(blank);
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
    }

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setOffset(4);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(count + ".     Release Authorizations", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    count++;
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);
    table1 = new Table(2, 1);
    table1.setOffset(4);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setWidths(twoD);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    p = new Phrase(
            "List any Owners, Partners, and/or Corporate Officers who are legally authorized to sign for "
                    + subName
                    + " and who will be signing the MONTHLY REQUEST FOR PAYMENT, FINAL REQUEST FOR PAYMENT, and LIEN WAIVER documents:\n\n",
            tnr8);
    p.setLeading(8);
    p1 = new Phrase(
            "       ______________________________________________________________________          ______________________________________________________________________\n",
            new Font(Font.TIMES_ROMAN, 6, Font.ITALIC));
    //p1.setLeading(0);
    Phrase p2 = new Phrase(
            "       Printed name and title                                                                                                                   Signature\n\n",
            new Font(Font.TIMES_ROMAN, 6, Font.ITALIC));
    //cell.setLeading(8);
    cell.add(p);
    cell.add(p1);
    cell.add(p2);
    cell.add(p1);
    cell.add(p2);
    cell.add(p1);
    cell.add(p2);
    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setOffset(0);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(count + ".     Shop Drawings - Samples - Submittals",
            new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);
    count++;

    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setWidths(twoD);
    table1.setOffset(2);
    p = new Phrase(
            "All shop drawings, materials samples, and submittals shall be submitted to the Contractor within 30 days of the issuance of this "
                    + title
                    + " Agreement unless specifically noted below.  All submitted items shall be in number and type as per the contract documents including, but not limited to, the following:",
            tnr8);
    p.setLeading(8);
    cell = new Cell(p);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setWidths(twoF);
    table1.setOffset(4);

    p = new Phrase("--The number of copies of each submittal for " + jobName + " is " + submittal_copies
            + ".\n--All submittals, of any type, are due on or before " + dueDate
            + " unless specifically noted otherwise.\n", tnr8);
    p.setLeading(8);
    cell = new Cell(p);
    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    String submittals = "";
    if (!submittalVector.isEmpty()) {
        p = new Phrase("            Due Date:\n", new Font(Font.TIMES_ROMAN, 8, Font.BOLD));
        p.setLeading(8);
        cell = new Cell(p);
        cell.setColspan(2);
        cell.setBorder(0);
        table1.addCell(cell);
        for (int i = 0; i < submittalVector.size(); i++) {
            submittals += (String) submittalVector.elementAt(i) + "\n";
        }
        p = new Phrase(submittals, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL));
        p.setLeading(8);
        cell = new Cell(p);
        table1.addCell(blank);
        cell.setBorder(0);
        table1.addCell(cell);
    } else {
        p = new Phrase("\nSubmittals required per contract documents and specifications.\n",
                new Font(Font.TIMES_ROMAN, 8, Font.BOLD));
        p.setLeading(8);
        cell = new Cell(p);
        table1.addCell(blank);
        cell.setBorder(0);
        table1.addCell(cell);
    }
    p = new Phrase("\n(" + subName
            + " is responsible for all submittals required in the Contract Documents as pertaining to labor and materials included in the scope of this "
            + title + " Agreement regardless of items listed, not listed, or incorrectly listed above.)",
            new Font(Font.TIMES_ROMAN, 6, Font.ITALIC));
    p.setLeading(8);
    cell = new Cell(p);

    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(1);
    table1.setWidths(twoD);
    table1.setOffset(2);
    p = new Phrase(cTitle.toUpperCase()
            + " acknowledges that review and approval of any type of submittal which deviates from the Project Plans and Specifications does NOT relieve the "
            + cTitle
            + " from costs, penalties and all other remedies required to meet the published specifications where the "
            + cTitle
            + " failed to notify the Owner/Architect/Contractor in writing of the variations from the specifications and failed to obtain written approval for EACH variation from the published specifications.",
            tnr8);
    p.setLeading(8);
    cell = new Cell(p);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(8);
    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setOffset(2);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(count + ".     Project Close-out", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);
    count++;
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setOffset(4);
    table1.setWidths(twoD);
    p = new Phrase(
            "All project close-out documents, materials, and Owner-training required by the Contract Documents shall be submitted to the Contractor PRIOR to payment of the "
                    + cTitle
                    + "'s 90% completion payment request.  The requirements shall include, but not be limited to, the following:",
            tnr8);
    p.setLeading(8);
    cell = new Cell(p);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(8);
    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setOffset(0);
    table1.setWidths(twoG);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("\"O & M\" Submittals: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(omSubmittals, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("Full Warranty: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(fullWarranty, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("Up-to-date Lien Release(s): ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(lienReleases, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("Signed Training Form: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(signedTraining, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("Materials-Equip-Specialty Items: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(specialtyItems, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("Other Items: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(otherItems, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    if (insure) {
        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(3);
        table1.setOffset(2);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(count + ".     " + cTitle + " Safety Program (If Applicable)",
                new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setOffset(2);
        table1.setWidths(twoD);
        p = new Phrase(
                cTitle + " will submit one copy of the " + cTitle + "'s job-specific safety program to "
                        + attr.get("full_name")
                        + " before any equipment, manpower, or materials are brought onto the Project site.  ",
                tnr8);
        p.setLeading(8);
        cell = new Cell(p);
        p = new Phrase(cTitle + " will require it's " + cTitle.toLowerCase()
                + "s to have in place a job-specific safety program before they enter the Project site.", tnr8);
        p.setLeading(8);
        cell.add(p);
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        //cell.setLeading(8);

        table1.addCell(blank);
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
    }

    if (insure) {
        document.newPage();

        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(3);
        table1.setOffset(0);
        cell = new Cell();
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"D\"", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
        cell.setLeading(6);
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(cTitle.toUpperCase() + "'S COST BREAKDOWN\n",
                new Font(Font.TIMES_ROMAN, 16, Font.BOLD)));
        cell.setBackgroundColor(Color.lightGray);
        cell.setUseDescender(true);
        cell.setLeading(17);
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setOffset(2);
        p = new Phrase("The following information is to be supplied by " + subName + " for " + jobName
                + ". List all SUPPLIERS and SUBCONTRACTORS for approval and payment confirmation (attach additional pages if needed):",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
        p.setLeading(12);
        cell = new Cell(p);
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(
                "     Name                                        City                                  Phone                                                                            Estimated Dollar Amount",
                tnr8));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        p = new Phrase(
                "________________________________________________________________________  $___________________\n",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        for (int i = 0; i < 10; i++) {
            cell.add(p);
        }
        cell.setBorder(0);
        table1.addCell(cell);

        p = new Phrase(
                "Supplier accepts full responsibility for acts and omissions of his subcontractors and suppliers.  No suppliers or subcontractors are to be added or deleted without prior notification to "
                        + attr.get("full_name") + ".",
                new Font(Font.TIMES_ROMAN, 8, Font.ITALIC));
        p.setLeading(10);
        cell = new Cell(p);
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.setLeading(15);
        cell.setBorder(0);
        table1.addCell(cell);
        p = new Phrase(
                "List the primary phases of your contracted scope of work and the associated costs.  This information may be released to the Owner if disputes arise over future billings and progress payments.",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
        p.setLeading(12);
        cell = new Cell(p);
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.setLeading(15);
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(
                "Description/Phase of Work                     Labor                      Material                    Equipment/Tools       Sub-subcontractor     Total",
                tnr8));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        p = new Phrase(
                "________________________  $____________ $____________ $____________ $____________ $____________ \n",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        for (int i = 0; i < 13; i++) {
            cell.add(p);
        }
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);

        document.add(spacer);

        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setOffset(2);
        table1.setPadding(1);
        cell = new Cell();
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        //cell.setLeading(10);
        cell.add(new Phrase(subName, new Font(Font.TIMES_ROMAN, 10, Font.UNDERLINE)));
        cell.add(new Phrase("\n" + cTitle, new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
        document.add(spacer);
        document.add(spacer);

        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setOffset(0);
        cell = new Cell();
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        //cell.setLeading(10);
        cell.add(new Phrase("By:____________________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
        cell.add(new Phrase("\nPrint Name of Authorized Company Officer",
                new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
        document.add(spacer);
        document.add(spacer);
        table1 = new Table(1, 1);
        table1.setOffset(0);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        cell = new Cell();
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        //cell.setLeading(10);
        cell.add(new Phrase("By:____________________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
        cell.add(new Phrase("\nAuthorized Signature", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);

    }

}

From source file:com.util.load.RecordDocCreate.java

/**
 * //from w ww  .  j  av  a2s.  co m
 * @param unitInfo ???
 * @param systemManager ?
 * @param rank 
 * @param countTol ?
 * @param countSec ?
 * @param countThr ?
 * @param countThir?
 * @param countMay ?
 * @param fileName ??
 * @return ?   1?
 */
public static int createRecordDoc(UnitInfo unitInfo, SystemManager systemManager, Rank rank, int countTol,
        int countSec, int countThr, int countThir, int countMay, File fileName) {

    Document document = new Document(PageSize.A4, 90.0F, 90.0F, 50.0F, 40.0F);
    try {
        RtfWriter2.getInstance(document, new FileOutputStream(fileName));
        document.open();

        String songPath = "";
        String blackFontPath = "";
        String fangsongPath = "";
        String wingdings2FontPath = "";
        if (System.getProperties().getProperty("os.name").toUpperCase().indexOf("WINDOWS") == 0) {
            songPath = "c:\\windows\\fonts\\msyh.ttf";
            blackFontPath = "c:\\windows\\fonts\\simhei.ttf";
            fangsongPath = "C:\\Windows\\Fonts\\simfang.ttf";
            wingdings2FontPath = "c:\\windows\\fonts\\WINGDNG2.TTF";
        } else {
            /*songPath="/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf";
            blackFontPath="/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Bold.ttf";
            fangsongPath="/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf";
            wingdings2FontPath="/usr/share/fonts/truetype/unifont/unifont.ttf";*/
            songPath = "/usr/share/fonts/dejavu/DejaVuSansMono.ttf";
            blackFontPath = "/usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf";
            fangsongPath = "/usr/share/fonts/dejavu/DejaVuSerif.ttf";
            wingdings2FontPath = "/usr/share/fonts/dejavu/unifont.ttf";
        }

        BaseFont blackBaseFont = BaseFont.createFont(songPath, "Identity-H", false);
        BaseFont songFont = BaseFont.createFont(blackFontPath, "Identity-H", false);
        BaseFont fangsongFont = BaseFont.createFont(fangsongPath, "Identity-H", false);
        BaseFont wingdings2Font = BaseFont.createFont(wingdings2FontPath, "Identity-H", false);

        Font songfont_11 = new Font(songFont, 11.0F, 0);
        Font songfontUnderLine_11 = new Font(songFont, 11.0F, 4);

        Chunk rightSign = new Chunk("R", new Font(wingdings2Font, 16.0F, 0));
        Chunk blankSign = new Chunk("*", new Font(wingdings2Font, 20.0F, 0));

        Paragraph p = new Paragraph();
        //p.setFont(new Font(songFont, 14.0F, 0));
        p.add("  2");
        document.add(p);

        Paragraph p1 = new Paragraph();
        p1.add(new Chunk("?"));
        Table numTable = new Table(12, 1);
        numTable.setLeft(0);
        numTable.setWidth(50.0F);
        numTable.addCell("");
        p1.add(numTable);
        document.add(p1);
        /*String docName="";
        if("1".equals(rank.getRankOrganType())){
        docName="??";
        }
        if("2".equals(rank.getRankOrganType())){
        docName="??";
        }
        if("3".equals(rank.getRankOrganType())){
        docName="??";
        }
        if("4".equals(rank.getRankOrganType())){
        docName="???";
        }
        if("5".equals(rank.getRankOrganType())){
        docName="?";
        }
        if("6".equals(rank.getRankOrganType())){
        docName="?";
        }*/
        p = new Paragraph(rank.getSysInfoName() + "?");
        p.setFont(new Font(songFont, 36.0F, 1));
        p.setAlignment(1);
        document.add(p);

        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("  ? ?", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("__________", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("()", new Font(fangsongFont, 16.0F, 4)));
        p.add(new Chunk("__________", new Font(fangsongFont, 16.0F, 0)));
        document.add(p);

        document.add(Chunk.NEWLINE);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("   ", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("__________________________", new Font(fangsongFont, 16.0F, 0)));
        document.add(p);

        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("   ", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("__________", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("()", new Font(fangsongFont, 16.0F, 4)));
        p.add(new Chunk("__________", new Font(fangsongFont, 16.0F, 0)));
        document.add(p);

        document.add(Chunk.NEWLINE);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("   ", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("__________________________", new Font(fangsongFont, 16.0F, 0)));
        document.add(p);

        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("????", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("__________", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("()", new Font(fangsongFont, 16.0F, 4)));
        p.add(new Chunk("__________", new Font(fangsongFont, 16.0F, 0)));
        document.add(p);

        document.add(Chunk.NEWLINE);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("? ?  ", new Font(fangsongFont, 16.0F, 0)));
        p.add(new Chunk("__________________________", new Font(fangsongFont, 16.0F, 0)));
        document.add(p);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);
        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("?", new Font(songFont, 20.0F, 1)));
        document.add(p);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("", new Font(songFont, 16.0F, 1)));
        document.add(p);

        Chapter chapter = new Chapter(1);
        com.lowagie.text.List list = new com.lowagie.text.List(true, false, 20.0F);

        //1
        ListItem listItem = new ListItem();
        Chunk itemChunk = new Chunk("??", new Font(blackBaseFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "????[2007]43?");
        listItem.add(itemChunk);
        list.add(listItem);

        //2
        listItem = new ListItem();
        itemChunk = new Chunk("", new Font(blackBaseFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "???????????????????????????????????????????????");
        listItem.add(itemChunk);
        list.add(listItem);

        //3
        listItem = new ListItem();
        itemChunk = new Chunk("??", new Font(blackBaseFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "??????");
        listItem.add(itemChunk);
        list.add(listItem);

        //4
        listItem = new ListItem("",
                new Font(songFont, 11.0F, 0));
        listItem.add(blankSign);
        listItem.add(new Chunk("?", songfont_11));
        listItem.add(rightSign);
        listItem.add(new Chunk("???",
                songfont_11));
        list.add(listItem);

        //5
        listItem = new ListItem();
        itemChunk = new Chunk("???", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "??11?6????????GA380-20025???????");
        listItem.add(itemChunk);
        list.add(listItem);

        //6
        listItem = new ListItem();
        itemChunk = new Chunk("????", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk("?????");
        listItem.add(itemChunk);
        list.add(listItem);

        //7
        listItem = new ListItem();
        itemChunk = new Chunk("??", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk("??");
        listItem.add(itemChunk);
        list.add(listItem);
        //8
        listItem = new ListItem();
        itemChunk = new Chunk("??????", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "???????");
        listItem.add(itemChunk);
        list.add(listItem);

        //9
        listItem = new ListItem();
        itemChunk = new Chunk("04?", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk("??(???)?");
        listItem.add(itemChunk);
        list.add(listItem);

        //10
        listItem = new ListItem();
        itemChunk = new Chunk("05??", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk("???");
        listItem.add(itemChunk);
        list.add(listItem);

        //11
        listItem = new ListItem();
        itemChunk = new Chunk("06", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk("???");
        listItem.add(itemChunk);
        list.add(listItem);

        //12
        listItem = new ListItem();
        itemChunk = new Chunk("08", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "????????GB/T124041997");
        listItem.add(itemChunk);
        list.add(listItem);

        //13
        listItem = new ListItem();
        itemChunk = new Chunk("02?", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk("????????");
        listItem.add(itemChunk);
        list.add(listItem);

        //14
        listItem = new ListItem();
        itemChunk = new Chunk("05?", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk("");
        listItem.add(itemChunk);
        list.add(listItem);

        //15
        listItem = new ListItem();
        itemChunk = new Chunk("07?", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "??????????");
        listItem.add(itemChunk);
        list.add(listItem);

        //16
        listItem = new ListItem();
        itemChunk = new Chunk("08?", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "?????????");
        listItem.add(itemChunk);
        list.add(listItem);

        //17
        listItem = new ListItem();
        itemChunk = new Chunk("", new Font(songFont, 11.0F, 0));
        listItem.add(itemChunk);
        itemChunk = new Chunk(
                "??????");
        listItem.add(itemChunk);
        list.add(listItem);
        document.add(list);

        document.add(Chunk.NEXTPAGE);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("  ??", new Font(songFont, 16.0F, 0)));
        document.add(p);

        Table table1 = new Table(16);
        table1.setWidth(110.0F);
        table1.setWidths(new int[] { 20, 5, 5, 5, 5, 5, 5, 10, 25, 5, 5, 5, 5, 5, 5, 10 });
        Cell cell = new Cell(new Phrase(new Chunk("01????", songfont_11)));
        setLocal(cell);
        table1.addCell(cell);
        cell = new Cell(unitInfo.getUnitName() == null ? " " : unitInfo.getUnitName());
        setLocal(cell);
        cell.setColspan(15);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("02???", songfont_11)));
        setLocal(cell);
        table1.addCell(cell);
        cell = new Cell();
        Font underLineFont = new Font(songFont, 11.0F, 4);
        cell.add(new Chunk(unitInfo.getProvince() == null ? "" : unitInfo.getProvince(), underLineFont));
        cell.add(new Chunk("?(?) ", songfont_11));
        cell.add(new Chunk(unitInfo.getCity() == null ? "" : unitInfo.getCity(), underLineFont));
        cell.add(new Chunk(" (???) ", songfont_11));
        cell.add(new Chunk(unitInfo.getCounty() == null ? "" : unitInfo.getCounty(), underLineFont));
        cell.add(new Chunk("(??)", songfont_11));
        cell.setColspan(15);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("03?", songfont_11)));
        setLocal(cell);
        table1.addCell(cell);

        table1.addCell(
                new Phrase(new Chunk(unitInfo.getPostcode() == null || "".equals(unitInfo.getPostcode()) ? ""
                        : unitInfo.getPostcode().charAt(0) + "", songfont_11)));
        table1.addCell(
                new Phrase(new Chunk(unitInfo.getPostcode() == null || "".equals(unitInfo.getPostcode()) ? ""
                        : unitInfo.getPostcode().charAt(1) + "", songfont_11)));
        table1.addCell(
                new Phrase(new Chunk(unitInfo.getPostcode() == null || "".equals(unitInfo.getPostcode()) ? ""
                        : unitInfo.getPostcode().charAt(2) + "", songfont_11)));
        table1.addCell(
                new Phrase(new Chunk(unitInfo.getPostcode() == null || "".equals(unitInfo.getPostcode()) ? ""
                        : unitInfo.getPostcode().charAt(3) + "", songfont_11)));
        table1.addCell(
                new Phrase(new Chunk(unitInfo.getPostcode() == null || "".equals(unitInfo.getPostcode()) ? ""
                        : unitInfo.getPostcode().charAt(4) + "", songfont_11)));
        table1.addCell(
                new Phrase(new Chunk(unitInfo.getPostcode() == null || "".equals(unitInfo.getPostcode()) ? ""
                        : unitInfo.getPostcode().charAt(5) + "", songfont_11)));
        table1.addCell("");
        table1.addCell(new Phrase(new Chunk("04?", songfont_11)));
        table1.addCell(new Phrase(
                new Chunk(unitInfo.getDivisionCode() == null || "".equals(unitInfo.getDivisionCode()) ? ""
                        : unitInfo.getDivisionCode().charAt(0) + "", songfont_11)));
        table1.addCell(new Phrase(
                new Chunk(unitInfo.getDivisionCode() == null || "".equals(unitInfo.getDivisionCode()) ? ""
                        : unitInfo.getDivisionCode().charAt(1) + "", songfont_11)));
        table1.addCell(new Phrase(
                new Chunk(unitInfo.getDivisionCode() == null || "".equals(unitInfo.getDivisionCode()) ? ""
                        : unitInfo.getDivisionCode().charAt(2) + "", songfont_11)));
        table1.addCell(new Phrase(
                new Chunk(unitInfo.getDivisionCode() == null || "".equals(unitInfo.getDivisionCode()) ? ""
                        : unitInfo.getDivisionCode().charAt(3) + "", songfont_11)));
        table1.addCell(new Phrase(
                new Chunk(unitInfo.getDivisionCode() == null || "".equals(unitInfo.getDivisionCode()) ? ""
                        : unitInfo.getDivisionCode().charAt(4) + "", songfont_11)));
        table1.addCell(new Phrase(
                new Chunk(unitInfo.getDivisionCode() == null || "".equals(unitInfo.getDivisionCode()) ? ""
                        : unitInfo.getDivisionCode().charAt(5) + "", songfont_11)));
        table1.addCell("");

        cell = new Cell(new Chunk("05??", new Font(songFont, 11.0F, 0)));
        setLocal(cell);
        cell.setRowspan(2);
        table1.addCell(cell);

        cell = new Cell(new Chunk("   ??", new Font(songFont, 11.0F, 0)));
        cell.setColspan(3);
        table1.addCell(cell);
        cell = new Cell(new Chunk(unitInfo.getUnitLeader() == null ? "" : unitInfo.getUnitLeader(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(4);
        table1.addCell(cell);

        table1.addCell(new Phrase(new Chunk("?/?", new Font(songFont, 11.0F, 0))));
        cell = new Cell(new Phrase(
                new Chunk(unitInfo.getDuty() == null ? "" : unitInfo.getDuty(), new Font(songFont, 11.0F, 0))));
        cell.setColspan(7);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", new Font(songFont, 11.0F, 0))));
        cell.setColspan(3);
        table1.addCell(cell);
        cell = new Cell(new Chunk(unitInfo.getUnitTel() == null ? "" : unitInfo.getUnitTel(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(4);
        table1.addCell(cell);

        table1.addCell(new Phrase(new Chunk("?", new Font(songFont, 11.0F, 0))));
        cell = new Cell(new Phrase(new Chunk(unitInfo.getUnitEmail() == null ? "" : unitInfo.getUnitEmail(),
                new Font(songFont, 11.0F, 0))));
        cell.setColspan(7);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("06", new Font(songFont, 11.0F, 0))));
        setLocal(cell);
        table1.addCell(cell);
        cell = new Cell(new Chunk(unitInfo.getUnitDep() == null ? "" : unitInfo.getUnitDep(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(15);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("07?", new Font(songFont, 11.0F, 0))));
        setLocal(cell);
        cell.setRowspan(3);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("   ??", new Font(songFont, 11.0F, 0))));
        cell.setColspan(3);
        table1.addCell(cell);
        cell = new Cell(new Chunk(unitInfo.getDepContact() == null ? "" : unitInfo.getDepContact(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(4);
        table1.addCell(cell);

        table1.addCell(new Phrase(new Chunk("?/?", new Font(songFont, 11.0F, 0))));
        cell = new Cell(new Chunk(unitInfo.getDepDuty() == null ? "" : unitInfo.getDepDuty(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(7);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", new Font(songFont, 11.0F, 0))));
        cell.setColspan(3);
        table1.addCell(cell);
        cell = new Cell(new Chunk(unitInfo.getDepTel() == null ? "" : unitInfo.getDepTel(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(4);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", new Font(songFont, 11.0F, 0))));
        cell.setRowspan(2);
        table1.addCell(cell);
        cell = new Cell(new Chunk(unitInfo.getDepEmail() == null ? "" : unitInfo.getDepEmail(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(7);
        cell.setRowspan(2);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", new Font(songFont, 11.0F, 0))));
        cell.setColspan(3);
        table1.addCell(cell);
        cell = new Cell(new Chunk(unitInfo.getDepMobile() == null ? "" : unitInfo.getDepMobile(),
                new Font(songFont, 11.0F, 0)));
        cell.setColspan(4);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("08", new Font(songFont, 11.0F, 0))));
        setLocal(cell);
        table1.addCell(cell);
        cell = new Cell("".equals(unitInfo.getSubordinate()) ? rightSign : blankSign);
        cell.add(new Chunk("1\t", new Font(songFont, 11.0F, 0)));
        cell.add("?".equals(unitInfo.getSubordinate()) ? rightSign : blankSign);
        cell.add(new Chunk("2?(?)\t", new Font(songFont, 11.0F, 0)));
        cell.add("".equals(unitInfo.getSubordinate()) ? rightSign : blankSign);
        cell.add(new Chunk("3(???)\t", new Font(songFont, 11.0F, 0)));
        cell.add(Chunk.NEWLINE);
        cell.add("".equals(unitInfo.getSubordinate()) ? rightSign : blankSign);
        cell.add(new Chunk("4(??)\t", new Font(songFont, 11.0F, 0)));
        cell.add("".equals(unitInfo.getSubordinate()) ? rightSign : blankSign);
        cell.add(new Chunk("9", new Font(songFont, 11.0F, 0)));
        cell.add(new Chunk(unitInfo.getOtherSub() != null ? unitInfo.getOtherSub() : "________",
                new Font(songFont, 11.0F, 4)));
        cell.setColspan(15);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("09??", new Font(songFont, 11.0F, 0))));
        setLocal(cell);
        table1.addCell(cell);
        cell = new Cell("".equals(unitInfo.getUnitType()) ? rightSign : blankSign);
        cell.add(new Chunk("1\t\t", songfont_11));
        cell.add("".equals(unitInfo.getUnitType()) ? rightSign : blankSign);
        cell.add(new Chunk("2\t\t", songfont_11));
        cell.add("??".equals(unitInfo.getUnitType()) ? rightSign : blankSign);
        cell.add(new Chunk("3??\t\t", songfont_11));
        cell.add("?".equals(unitInfo.getUnitType()) ? rightSign : blankSign);
        cell.add(new Chunk("4?", songfont_11));
        cell.add(Chunk.NEWLINE);
        cell.add("".equals(unitInfo.getUnitType()) ? rightSign : blankSign);
        cell.add(new Chunk("9", songfont_11));
        cell.add(new Chunk(unitInfo.getOtherUnitType() != null ? unitInfo.getOtherUnitType() : "________",
                new Font(songFont, 11.0F, 4)));
        cell.setColspan(15);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("10", songfont_11)));
        setLocal(cell);
        table1.addCell(cell);
        cell = new Cell("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("11\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("12\t", songfont_11));

        cell.add("???".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("13???", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("21?\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("22\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("23\t\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("24", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("25\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("26\t", songfont_11));

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("27?\t\t\t", songfont_11));

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("28?", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("31\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("32\t", songfont_11));

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("33?\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("34", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("35\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("36\t", songfont_11));

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("37?\t\t\t", songfont_11));

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("38?", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("39\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("40\t", songfont_11));

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("41?\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("42", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("43\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("44\t", songfont_11));

        cell.add("?".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("45?\t\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("46", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("47\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("48\t", songfont_11));

        cell.add("??".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("49??\t\t\t", songfont_11));

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("50", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("51\t\t", songfont_11));

        cell.add("??".equals(unitInfo.getEmployment()) ? rightSign : blankSign);
        cell.add(new Chunk("52??\t", songfont_11));
        cell.add(Chunk.NEWLINE);

        cell.add("".equals(unitInfo.getOtherEmp()) ? rightSign : blankSign);
        cell.add(new Chunk("99", songfont_11));
        cell.add(new Chunk("".equals(unitInfo.getOtherEmp()) ? unitInfo.getOtherEmp() : "________"));
        cell.setColspan(15);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("11?", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        table1.addCell(cell);
        cell = new Cell(new Phrase(new Chunk(countTol + "", songfont_11)));
        setLocal(cell);
        cell.setColspan(2);
        cell.setRowspan(2);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("12?", songfont_11)));
        cell.setColspan(5);
        table1.addCell(cell);
        cell = new Cell(new Phrase(new Chunk(countSec + "", songfont_11)));
        setLocal(cell);
        cell.setColspan(1);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("13?", songfont_11)));
        cell.setColspan(6);
        table1.addCell(cell);
        cell = new Cell(new Phrase(new Chunk(countThr + "", songfont_11)));
        cell.setColspan(1);
        setLocal(cell);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("14?", songfont_11)));
        cell.setColspan(5);
        table1.addCell(cell);
        cell = new Cell(new Phrase(new Chunk(countThir + "", songfont_11)));
        cell.setColspan(1);
        setLocal(cell);
        table1.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("15?", songfont_11)));
        cell.setColspan(6);
        table1.addCell(cell);
        cell = new Cell(new Phrase(new Chunk("0", songfont_11)));
        cell.setColspan(1);
        setLocal(cell);
        table1.addCell(cell);

        document.add(table1);

        document.add(Chunk.NEXTPAGE);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk(" (" + rank.getSysInfoName() + ")?",
                new Font(songFont, 16.0F, 0)));
        document.add(p);

        Table table2 = new Table(14);
        table2.setWidth(120.0F);
        table2.setWidths(new int[] { 8, 13, 5, 12, 3, 8, 5, 5, 5, 13, 5, 5, 5, 5 });

        cell = new Cell(new Phrase(new Chunk("01??", songfont_11)));
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell(new Chunk(rank.getSysInfoName() == null ? "" : rank.getSysInfoName(), songfont_11));
        cell.setColspan(7);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("02?", songfont_11)));
        cell = new Cell(new Chunk(rank.getSysInfoId() == null ? "" : rank.getSysInfoId(), songfont_11));
        cell.setColspan(4);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("03", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("", songfont_11)));
        setLocal(cell);
        table2.addCell(cell);
        cell = new Cell("1".equals(systemManager.getBusType()) ? rightSign : blankSign);
        cell.add(new Chunk("1\t", songfont_11));
        cell.add("2".equals(systemManager.getBusType()) ? rightSign : blankSign);
        cell.add(new Chunk("2\t", songfont_11));
        cell.add("3".equals(systemManager.getBusType()) ? rightSign : blankSign);
        cell.add(new Chunk("3?\t", songfont_11));
        cell.add("4".equals(systemManager.getBusType()) ? rightSign : blankSign);
        cell.add(new Chunk("4\t\n", songfont_11));
        cell.add("5".equals(systemManager.getBusType()) ? rightSign : blankSign);
        cell.add(new Chunk("5?\t", songfont_11));
        cell.add("9".equals(systemManager.getBusType()) ? rightSign : blankSign);
        cell.add(new Chunk("9", songfont_11));
        cell.add(new Chunk(
                systemManager.getOtherBusType() != null ? systemManager.getOtherBusType() : "________",
                songfontUnderLine_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("??", songfont_11)));
        setLocal(cell);
        table2.addCell(cell);
        cell = new Cell(new Chunk(systemManager.getBusDescription(), songfont_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("04?", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        table2.addCell(cell);
        cell = new Cell("10".equals(systemManager.getSerArea()) ? rightSign : blankSign);
        cell.add(new Chunk("10\t", songfont_11));

        cell.add(new Chunk("11".equals(systemManager.getSerArea()) ? rightSign : blankSign));
        cell.add(new Chunk("11??", songfont_11));
        cell.add(new Chunk(systemManager.getProTotal() != null ? systemManager.getProTotal() + "" : "________",
                songfontUnderLine_11));
        cell.add(new Chunk("\t", songfont_11));

        cell.add("20".equals(systemManager.getSerArea()) ? rightSign : blankSign);
        cell.add(new Chunk("20??\t\n", songfont_11));

        cell.add("21".equals(systemManager.getSerArea()) ? rightSign : blankSign);
        cell.add(new Chunk("21? ", songfont_11));
        cell.add(
                new Chunk(systemManager.getCityTotal() != null ? systemManager.getCityTotal() + "" : "________",
                        songfontUnderLine_11));
        cell.add(new Chunk("\t", songfont_11));

        cell.add("30".equals(systemManager.getSerArea()) ? rightSign : blankSign);
        cell.add(new Chunk("30?\t", songfont_11));

        cell.add(new Chunk("99".equals(systemManager.getSerArea()) ? rightSign : blankSign));
        cell.add(new Chunk("99", songfont_11));
        cell.add(new Chunk(systemManager.getOtherArea() != null ? systemManager.getOtherArea() : "________",
                songfontUnderLine_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        table2.addCell(cell);
        cell = new Cell("1".equals(systemManager.getSerObj()) ? rightSign : blankSign);
        cell.add(new Chunk("1??   ", songfont_11));
        cell.add("2".equals(systemManager.getSerObj()) ? rightSign : blankSign);
        cell.add(new Chunk("2   ", songfont_11));
        cell.add("3".equals(systemManager.getSerObj()) ? rightSign : blankSign);
        cell.add(new Chunk("3?   ", songfont_11));
        cell.add("9".equals(systemManager.getSerObj()) ? rightSign : blankSign);
        cell.add(new Chunk("9", songfont_11));
        cell.add(new Chunk(systemManager.getOtherObj() != null ? systemManager.getOtherObj() : "________",
                songfontUnderLine_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("05?", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("", songfont_11)));
        setLocal(cell);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankCoveArea()) ? rightSign : blankSign);
        cell.add(new Chunk("1\t", songfont_11));
        cell.add("2".equals(rank.getRankCoveArea()) ? rightSign : blankSign);
        cell.add(new Chunk("2\t", songfont_11));
        cell.add("3".equals(rank.getRankCoveArea()) ? rightSign : blankSign);
        cell.add(new Chunk("3\t", songfont_11));
        cell.add("4".equals(rank.getRankCoveArea()) ? rightSign : blankSign);
        cell.add(new Chunk("9", songfont_11));
        cell.add(new Chunk(rank.getRankOthArea() != null ? rank.getRankOthArea() : "________",
                songfontUnderLine_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("", songfont_11)));
        setLocal(cell);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankNetworkProp()) ? rightSign : blankSign);
        cell.add(new Chunk("1\t", songfont_11));
        cell.add("2".equals(rank.getRankNetworkProp()) ? rightSign : blankSign);
        cell.add(new Chunk("2?\t", songfont_11));
        cell.add("3".equals(rank.getRankNetworkProp()) ? rightSign : blankSign);
        cell.add(new Chunk("9", songfont_11));
        cell.add(new Chunk(rank.getRankOthNetworkProp() != null ? rank.getRankOthNetworkProp() : "________",
                songfontUnderLine_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("06?", songfont_11)));
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell("1".equals(rank.getRankSysConn()) ? rightSign : blankSign);
        cell.add(new Chunk("1\t", songfont_11));
        cell.add("2".equals(rank.getRankSysConn()) ? rightSign : blankSign);
        cell.add(new Chunk("2??\t\n", songfont_11));
        cell.add("3".equals(rank.getRankSysConn()) ? rightSign : blankSign);
        cell.add(new Chunk("3??\t", songfont_11));
        cell.add("4".equals(rank.getRankSysConn()) ? rightSign : blankSign);
        cell.add(new Chunk("9", songfont_11));
        cell.add(new Chunk(rank.getRankOtherSysConn() != null ? rank.getRankOtherSysConn() : "________",
                songfontUnderLine_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("07?", songfont_11)));
        cell.setColspan(2);
        cell.setRowspan(8);
        setLocal(cell);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("??", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        cell.setColspan(8);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk(" ", songfont_11)));
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk(" ", songfont_11)));
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?  ", songfont_11)));
        setLocal(cell);
        cell.setColspan(4);
        table2.addCell(cell);

        for (int i = 1; i <= 6; i++) {

            table2.addCell(new Phrase(new Chunk(i + "", songfont_11)));
            switch (i) {

            case 1:
                cell = new Cell(new Chunk("?", songfont_11));
                cell.setColspan(2);
                table2.addCell(cell);
                table2.addCell(new Phrase(new Chunk(rank.getRankSecCount(), songfont_11)));
                cell = new Cell(("100".equals(rank.getRankSecUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("0".equals(rank.getRankSecUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("3".equals(rank.getRankSecUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.add(new Chunk(
                        (rank.getPartRankSecUse() != null ? rank.getPartRankSecUse() : "________") + "%",
                        songfontUnderLine_11));
                cell.setColspan(4);
                table2.addCell(cell);
                break;

            case 2:
                cell = new Cell(new Chunk("?", songfont_11));
                cell.setColspan(2);
                table2.addCell(cell);
                table2.addCell(new Phrase(new Chunk(rank.getRankNetCount(), songfont_11)));
                cell = new Cell(("100".equals(rank.getRankNetUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("0".equals(rank.getRankNetUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("3".equals(rank.getRankNetUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.add(new Chunk(
                        (rank.getPartRankNetUse() != null ? rank.getPartRankNetUse() : "________") + "%",
                        songfontUnderLine_11));
                cell.setColspan(4);
                table2.addCell(cell);
                break;
            case 3:
                cell = new Cell(new Chunk("?", songfont_11));
                cell.setColspan(2);
                table2.addCell(cell);
                table2.addCell(new Phrase(new Chunk(rank.getRankSysCount(), songfont_11)));
                cell = new Cell(("100".equals(rank.getRankSysUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("0".equals(rank.getRankSysUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("3".equals(rank.getRankSysUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.add(new Chunk(
                        (rank.getPartRankSysUse() != null ? rank.getPartRankSysUse() : "________") + "%",
                        songfontUnderLine_11));
                cell.setColspan(4);
                table2.addCell(cell);
                break;
            case 4:
                cell = new Cell(new Chunk("?", songfont_11));
                cell.setColspan(2);
                table2.addCell(cell);
                table2.addCell(new Phrase(new Chunk(rank.getRankSqlCount(), songfont_11)));
                cell = new Cell(("100".equals(rank.getRankSqlUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("0".equals(rank.getRankSqlUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("3".equals(rank.getRankSqlUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.add(new Chunk(
                        (rank.getPartRankSqlUse() != null ? rank.getPartRankSqlUse() : "________") + "%",
                        songfontUnderLine_11));
                cell.setColspan(4);
                table2.addCell(cell);
                break;
            case 5:
                cell = new Cell(new Chunk("?", songfont_11));
                cell.setColspan(2);
                table2.addCell(cell);
                table2.addCell(new Phrase(new Chunk(rank.getRankSerCount(), songfont_11)));
                cell = new Cell(("100".equals(rank.getRankSerUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("0".equals(rank.getRankSerUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("3".equals(rank.getRankSerUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.add(new Chunk(
                        (rank.getPartRankSerUse() != null ? rank.getPartRankSerUse() : "________") + "%",
                        songfontUnderLine_11));
                cell.setColspan(4);
                table2.addCell(cell);
                break;
            case 6:
                cell = new Cell(new Chunk("", songfont_11));
                cell.add(new Chunk((rank.getRankOthProd() != null ? rank.getRankOthProd() : "________"),
                        songfontUnderLine_11));
                cell.setColspan(2);
                table2.addCell(cell);
                table2.addCell(new Phrase(new Chunk(rank.getRankOthProdCount(), songfont_11)));
                cell = new Cell(("100".equals(rank.getRankOthProdUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("0".equals(rank.getRankOthProdUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.setColspan(2);
                table2.addCell(cell);
                cell = new Cell(("3".equals(rank.getRankOthProdUse())) ? rightSign : blankSign);
                setLocal(cell);
                cell.add(new Chunk(
                        (rank.getPartRankOthProdUse() != null ? rank.getPartRankOthProdUse() : "________")
                                + "%",
                        songfontUnderLine_11));
                cell.setColspan(4);
                table2.addCell(cell);
                break;

            }

        }

        cell = new Cell(new Phrase(new Chunk("08?", songfont_11)));
        cell.setColspan(2);
        cell.setRowspan(10);
        setLocal(cell);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("??", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        cell.setRowspan(2);
        cell.setColspan(3);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        cell.setColspan(8);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("??", songfont_11)));
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("? ", songfont_11)));
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("?", songfont_11)));
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("1", songfont_11)));
        table2.addCell(new Phrase(new Chunk("", songfont_11)));
        cell = new Cell("1".equals(rank.getRankIfGradeEval()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfGradeEval())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankSerGradeType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankSerGradeType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankSerGradeType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("2", songfont_11)));
        table2.addCell(new Phrase(new Chunk("", songfont_11)));
        cell = new Cell("1".equals(rank.getRankIfRiskEval()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfRiskEval())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankSerRiskType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankSerRiskType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankSerRiskType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("3", songfont_11)));
        table2.addCell(new Phrase(new Chunk("???", songfont_11)));
        cell = new Cell("1".equals(rank.getRankIfSuffReco()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfSuffReco())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankIfSuffRecoType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankIfSuffRecoType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankIfSuffRecoType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("4", songfont_11)));
        table2.addCell(new Phrase(new Chunk("?", songfont_11)));
        cell = new Cell("1".equals(rank.getRankIfResponse()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfResponse())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankResponseType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankResponseType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankResponseType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("5", songfont_11)));
        table2.addCell(new Phrase(new Chunk("?", songfont_11)));
        cell = new Cell("1".equals(rank.getRankIfSysInte()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfSysInte())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankSysInteType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankSysInteType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankSysInteType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("6", songfont_11)));
        table2.addCell(new Phrase(new Chunk("", songfont_11)));
        cell = new Cell("1".equals(rank.getRankIfSecCon()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfSecCon())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankSecConypeType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankSecConypeType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankSecConypeType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("7", songfont_11)));
        table2.addCell(new Phrase(new Chunk("", songfont_11)));
        cell = new Cell("1".equals(rank.getRankIfSecTrain()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfSecTrain())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankSecTrainType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankSecTrainType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankSecTrainType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        table2.addCell(new Phrase(new Chunk("8", songfont_11)));
        cell = new Cell(new Chunk("", songfont_11));
        cell.add(new Chunk((rank.getRankOthSerName() != null ? rank.getRankOthSerName() : "________"),
                songfontUnderLine_11));
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankIfOthSer()) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.add(("0".equals(rank.getRankIfOthSer())) ? rightSign : blankSign);
        setLocal(cell);
        cell.add(new Chunk("", new Font(songFont, 9.0F, 0)));
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("1".equals(rank.getRankOthUseType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);
        cell = new Cell("2".equals(rank.getRankOthUseType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(2);
        table2.addCell(cell);
        cell = new Cell("3".equals(rank.getRankOthUseType()) ? rightSign : blankSign);
        setLocal(cell);
        cell.setColspan(3);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("09????", songfont_11)));
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk(rank.getRankEvalUnitName(), songfont_11)));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("10?", songfont_11)));
        cell.setColspan(2);
        table2.addCell(cell);

        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
        cell = new Cell(new Phrase(new Chunk(format.format(rank.getRankUseDate()), songfont_11)));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("11?", songfont_11)));
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell("1".equals(rank.getRankFlag()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        cell.add("0".equals(rank.getRankFlag()) ? rightSign : blankSign);
        cell.add(new Chunk("?", songfont_11));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("12??", songfont_11)));
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk(rank.getRankParentSysName(), songfont_11)));
        cell.setColspan(12);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("13????", songfont_11)));
        cell.setColspan(2);
        table2.addCell(cell);

        cell = new Cell(new Phrase(new Chunk(rank.getRankParentUnitName(), songfont_11)));
        cell.setColspan(12);
        table2.addCell(cell);

        document.add(table2);
        document.add(Chunk.NEXTPAGE);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk("(" + systemManager.getSysName() + ")?",
                new Font(songFont, 16.0F, 0)));
        document.add(p);

        Table table3 = new Table(2);
        table3.setWidth(110.0F);
        table3.setWidths(new int[] { 40, 70 });

        cell = new Cell(new Phrase(new Chunk("01??", songfont_11)));
        table3.addCell(cell);

        cell = new Cell("".equals(rank.getRankGrade()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        cell.add("".equals(rank.getRankGrade()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        cell.add("".equals(rank.getRankGrade()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        cell.add("".equals(rank.getRankGrade()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        cell.add("".equals(rank.getRankGrade()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        table3.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("02", songfont_11)));
        table3.addCell(cell);
        cell = new Cell(new Chunk(format.format(rank.getRankTime()), songfont_11));
        table3.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("03", songfont_11)));
        table3.addCell(cell);
        cell = new Cell(new Phrase(
                new Chunk("1".equals(rank.getRankJudge()) ? "" : "", songfont_11)));
        table3.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("04?", songfont_11)));
        table3.addCell(cell);
        cell = new Cell("1".equals(rank.getRankIsDep()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        cell.add("0".equals(rank.getRankIsDep()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        table3.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("05??", songfont_11)));
        table3.addCell(cell);
        cell = new Cell(
                new Phrase(new Chunk(rank.getRankDepName() == null ? "" : rank.getRankDepName(), songfont_11)));
        table3.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("06", songfont_11)));
        table3.addCell(cell);
        cell = new Cell("1".equals(rank.getRankDepJudge()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        cell.add("0".equals(rank.getRankDepJudge()) ? rightSign : blankSign);
        cell.add(new Chunk("", songfont_11));
        table3.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("07", songfont_11)));
        table3.addCell(cell);
        cell = new Cell(new Phrase(new Chunk("1".equals(rank.getRankDoc()) ? rightSign : blankSign)));
        cell.add(new Chunk("", songfont_11));
        cell.add("0".equals(rank.getRankDoc()) ? rightSign : blankSign);
        cell.add(new Chunk("\t", songfont_11));
        cell.add(new Chunk("??" + (rank.getRankAccess() == null ? "" : rank.getRankAccess()),
                songfont_11));
        table3.addCell(cell);

        cell = new Cell(new Phrase(new Chunk("", songfont_11)));
        cell.add(new Chunk(rank.getRankInformant()));
        table3.addCell(cell);
        cell = new Cell(new Phrase(new Chunk("", songfont_11)));
        cell.add(new Chunk(format.format(rank.getRankDate())));
        table3.addCell(cell);

        document.add(table3);
        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk(
                "                                           ",
                songfont_11));
        document.add(p);
        document.add(Chunk.NEXTPAGE);

        p = new Paragraph();
        p.setAlignment(1);
        p.add(new Chunk(" " + systemManager.getSysName()
                + " ??????", songfont_11));
        document.add(p);
        if (null == null) {
            Table table4 = new Table(2);
            table4.setWidth(110.0F);
            table4.setWidths(new int[] { 40, 70 });

            table4.addCell(new Phrase(new Chunk("01?", songfont_11)));
            cell = new Cell("1".equals(rank.getRankTopStruct()) ? rightSign : blankSign);
            cell.add(new Chunk("", songfont_11));
            cell.add("0".equals(rank.getRankTopStruct()) ? rightSign : blankSign);
            cell.add(new Chunk("\t??", songfont_11));
            cell.add(new Chunk(rank.getRankTopRelAcc() != null ? rank.getRankTopRelAcc() : "________",
                    songfont_11));
            table4.addCell(cell);

            table4.addCell(new Phrase(new Chunk("02??", songfont_11)));

            cell = new Cell("1".equals(rank.getRankSysManage()) ? rightSign : blankSign);
            cell.add(new Chunk("", songfont_11));
            cell.add("0".equals(rank.getRankSysManage()) ? rightSign : blankSign);
            cell.add(new Chunk("\t??", songfont_11));
            cell.add(new Chunk(rank.getRankSysManRel() != null ? rank.getRankSysManRel() : "________",
                    songfont_11));
            table4.addCell(cell);

            table4.addCell(new Phrase(new Chunk(
                    "03?", songfont_11)));
            cell = new Cell("1".equals(rank.getRankSysPlan()) ? rightSign : blankSign);
            cell.add(new Chunk("", songfont_11));
            cell.add("0".equals(rank.getRankSysPlan()) ? rightSign : blankSign);
            cell.add(new Chunk("\t??", songfont_11));
            cell.add(new Chunk(rank.getRankSysPlanRel() != null ? rank.getRankSysPlanRel() : "________",
                    songfont_11));

            table4.addCell(cell);

            table4.addCell(new Phrase(new Chunk(
                    "04???????", songfont_11)));
            cell = new Cell("1".equals(rank.getRankSysLicense()) ? rightSign : blankSign);
            cell.add(new Chunk("", songfont_11));
            cell.add("0".equals(rank.getRankSysLicense()) ? rightSign : blankSign);
            cell.add(new Chunk("\t??", songfont_11));
            cell.add(new Chunk(rank.getRankSysLiceRel() != null ? rank.getRankSysLiceRel() : "________",
                    songfont_11));
            table4.addCell(cell);

            table4.addCell(new Phrase(new Chunk("05", songfont_11)));
            cell = new Cell("1".equals(rank.getRankSysReport()) ? rightSign : blankSign);
            cell.add(new Chunk("", songfont_11));
            cell.add("0".equals(rank.getRankSysReport()) ? rightSign : blankSign);
            cell.add(new Chunk("\t??", songfont_11));
            cell.add(new Chunk(rank.getRankSysReportRel() != null ? rank.getRankSysReportRel() : "________",
                    songfont_11));
            table4.addCell(cell);

            table4.addCell(new Phrase(new Chunk("06", songfont_11)));
            cell = new Cell("1".equals(rank.getRankPeerRev()) ? rightSign : blankSign);
            cell.add(new Chunk("", songfont_11));
            cell.add("0".equals(rank.getRankPeerRev()) ? rightSign : blankSign);
            cell.add(new Chunk("\t??", songfont_11));
            cell.add(new Chunk(rank.getRankPeerRevRel() != null ? rank.getRankPeerRevRel() : "________",
                    songfont_11));
            table4.addCell(cell);

            table4.addCell(new Phrase(new Chunk("07??", songfont_11)));
            cell = new Cell("1".equals(rank.getRankSuperOpin()) ? rightSign : blankSign);
            cell.add(new Chunk("", songfont_11));
            cell.add("0".equals(rank.getRankSuperOpin()) ? rightSign : blankSign);
            cell.add(new Chunk("\t??", songfont_11));
            cell.add(new Chunk(rank.getRankSuperOpinRel() != null ? rank.getRankSuperOpinRel() : "________",
                    songfont_11));
            table4.addCell(cell);

            document.add(table4);
            document.close();
        }
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (DocumentException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    return 1;

}

From source file:ispyb.client.mx.collection.PdfRtfExporter.java

License:Open Source License

/**
 * set a table for a sessionDataObject/* w  ww . jav  a  2s  . c  o m*/
 * 
 * @param document
 * @param sessionDataObject
 * @param mRequest
 */
private void setDetailSessionObjectTable(Document document, SessionDataObjectInformation sessionDataObject,
        HttpServletRequest mRequest) {
    try {
        int nbCol = 6;
        int nbRows = 5;
        List<Param> listParam = sessionDataObject.getListParameters();
        int idParam = 0;
        int nbParam = listParam.size();
        nbRows = Math.max(nbRows, nbParam);
        boolean secondGraph = sessionDataObject.getGraph2Path() != null
                && !sessionDataObject.getGraph2Path().isEmpty();
        if (secondGraph)
            nbCol += 1;

        Table table = new Table(nbCol);

        int l = 0;

        int[] headersWidth = new int[nbCol];

        headersWidth[l++] = 10; // def
        headersWidth[l++] = 6; // parameters title
        headersWidth[l++] = 6; // parameters value
        headersWidth[l++] = 12; // Thumbnail
        headersWidth[l++] = 12; // Snapshot
        headersWidth[l++] = 22; // Graph
        if (secondGraph)
            headersWidth[l++] = 22; // Graph2
        table.setWidths(headersWidth);

        table.setWidth(100); // percentage
        table.setPadding(1);
        table.setCellsFitPage(true);
        table.setTableFitsPage(true);
        table.setBorderWidth(1);
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        // no header
        // first Row
        // firstCell: def : date
        SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
        String collectTime = formatter.format(sessionDataObject.getDataTime());
        Cell c = getCellValue(collectTime);
        c.setBorderWidthBottom(0);
        table.addCell(c);
        // second Cell param
        setCellParam(table, listParam, idParam++, 1);
        // third Cell : thumbnail
        Cell cellThumbnail = getCellImage(sessionDataObject.getImageThumbnailPath());
        cellThumbnail.setRowspan(nbRows);
        cellThumbnail.setBorderWidth(0);
        table.addCell(cellThumbnail);
        // 4 Cell : snapshot
        Cell cellSnapshot = getCellImage(sessionDataObject.getCrystalSnapshotPath());
        cellSnapshot.setRowspan(nbRows);
        cellSnapshot.setBorderWidth(0);
        table.addCell(cellSnapshot);
        // 5 Cell : graph
        Cell cellGraph = getCellGraph(sessionDataObject);
        cellGraph.setRowspan(nbRows);
        cellGraph.setBorderWidth(0);
        table.addCell(cellGraph);
        // 6 Cell : graph2
        if (secondGraph) {
            Cell cellGraph2 = getCellImage(sessionDataObject.getGraph2Path());
            cellGraph2.setRowspan(nbRows);
            cellGraph2.setBorderWidth(0);
            table.addCell(cellGraph2);
        }

        // second row
        Cell c2 = getCellValue(sessionDataObject.getImagePrefix() + " " + sessionDataObject.getRunNumber());
        c2.setBorderWidth(0);
        table.addCell(c2);
        // param2
        setCellParam(table, listParam, idParam++, 1);

        // third row
        Cell c3 = getCellValue(sessionDataObject.getExperimentType());
        c3.setBorderWidth(0);
        table.addCell(c3);
        // param3
        setCellParam(table, listParam, idParam++, 1);

        // 4 row
        Cell c4 = getCellValue(sessionDataObject.getSampleNameProtein());
        c4.setBorderWidth(0);
        table.addCell(c4);
        // param4
        setCellParam(table, listParam, idParam++, 1);

        // 5 row
        Cell c5 = new Cell();
        c5.setHorizontalAlignment(Element.ALIGN_LEFT);
        c5.add(new Paragraph(sessionDataObject.getComments(), FONT_DOC_ITALIC));
        c5.setBorderWidth(0);
        c5.setRowspan(nbRows - 4);
        table.addCell(c5);
        // param4
        setCellParam(table, listParam, idParam++, 1);

        for (int i = 5; i < nbRows; i++) {
            setCellParam(table, listParam, idParam++, 1);
        }

        // results
        // workflow result status
        if (sessionDataObject.isWorkflow()) {
            Cell resultCell = getWorkflowResult(sessionDataObject.getWorkflow(), mRequest);
            resultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
            resultCell.setColspan(nbCol);
            table.addCell(resultCell);
        }
        // collect OSC
        if ((sessionDataObject.isDataCollection()
                && !sessionDataObject.getDataCollection().getDataCollectionGroupVO().getExperimentType()
                        .equals(Constants.EXPERIMENT_TYPE_CHARACTERIZATION))) {
            DataCollectionExporter dcExporter = new DataCollectionExporter(df2, df3, proposalCode,
                    proposalNumber, mRequest);
            DataCollection3VO dataCollection = sessionDataObject.getDataCollection();
            DataCollectionInformation dcInfo = dcExporter.getDataCollectionInformation(dataCollection,
                    getSampleRankingVO(dataCollection.getDataCollectionId()),
                    getAutoProcRankingVO(dataCollection.getDataCollectionId()));
            Cell resultCell = getAutoProcResultStatus(dcInfo);
            resultCell.setColspan(nbCol);
            resultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
            table.addCell(resultCell);
            document.add(table);
            document.add(new Paragraph(" ", VERY_SMALL_FONT));

            setAutoProcResultsTable(document, dcInfo);
        } else if (sessionDataObject.isWorkflow() && sessionDataObject.getWorkflow().isMXPressEOIA()) { // MXPRESS
            // wf
            DataCollectionExporter dcExporter = new DataCollectionExporter(df2, df3, proposalCode,
                    proposalNumber, mRequest);
            DataCollection3VO dataCollection = sessionDataObject.getListDataCollection().get(0);
            DataCollectionInformation dcInfo = dcExporter.getDataCollectionInformation(dataCollection,
                    getSampleRankingVO(dataCollection.getDataCollectionId()),
                    getAutoProcRankingVO(dataCollection.getDataCollectionId()));
            Cell resultCell = getAutoProcResultStatus(dcInfo);
            resultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
            resultCell.setColspan(nbCol);
            table.addCell(resultCell);

            document.add(table);
            document.add(new Paragraph(" ", VERY_SMALL_FONT));

            setAutoProcResultsTable(document, dcInfo);
        } else if ((sessionDataObject.isDataCollection()
                && sessionDataObject.getDataCollection().getDataCollectionGroupVO().getExperimentType()
                        .equals(Constants.EXPERIMENT_TYPE_CHARACTERIZATION))) { // Characterization
            DataCollectionExporter dcExporter = new DataCollectionExporter(df2, df3, proposalCode,
                    proposalNumber, mRequest);
            DataCollection3VO dataCollection = sessionDataObject.getDataCollection();
            DataCollectionInformation dcInfo = dcExporter.getDataCollectionInformation(dataCollection,
                    getSampleRankingVO(dataCollection.getDataCollectionId()),
                    getAutoProcRankingVO(dataCollection.getDataCollectionId()));
            Cell resultCell = getCharacterizationResultStatus(dcInfo, mRequest);
            resultCell.setColspan(nbCol);
            resultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
            table.addCell(resultCell);
            document.add(table);
            document.add(new Paragraph(" ", VERY_SMALL_FONT));

            setStrategyTable2(document, dcInfo);
        } else {
            List<Param> listResults = sessionDataObject.getListResults();
            if (listResults != null) {
                int nbResults = listResults.size();
                for (int j = 0; j < nbResults; j++) {
                    setCellParam(table, listResults, j, 2);
                    Cell eCell = getEmptyCell(nbCol - 3);
                    eCell.setBorderWidth(0);
                    table.addCell(eCell);
                }
            }
            document.add(table);
            document.add(new Paragraph(" ", FONT_SPACE));
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:ispyb.client.mx.collection.PdfRtfExporter.java

License:Open Source License

/**
 * set a cell for a param or empty cell if no more param in the list
 * // w ww . j  a v  a2  s  .  c o m
 * @param table
 * @param listParam
 * @param id
 * @param colSpanTitle
 * @throws Exception
 */
private void setCellParam(Table table, List<Param> listParam, int id, int colSpanTitle) throws Exception {
    if (id < listParam.size()) {
        Param param = listParam.get(id);
        Cell cellTitle = new Cell();
        cellTitle.setBorderWidth(0);
        cellTitle.setColspan(colSpanTitle);
        cellTitle.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cellTitle.add(new Paragraph(param.getText(), FONT_DOC_PARAM_TITLE));
        table.addCell(cellTitle);

        Cell cellValue = new Cell();
        cellValue.setBorderWidth(0);
        cellValue.setHorizontalAlignment(Element.ALIGN_LEFT);
        cellValue.add(new Paragraph(param.getValue(), FONT_DOC));
        table.addCell(cellValue);
    } else {
        Cell cellTitle = getEmptyCell(1);
        cellTitle.setBorderWidth(0);
        cellTitle.setColspan(colSpanTitle);
        table.addCell(cellTitle);

        Cell cellValue = getEmptyCell(1);
        cellValue.setBorderWidth(0);
        table.addCell(cellValue);
    }
}