List of usage examples for com.lowagie.text Document add
public boolean add(Element element) throws DocumentException
Element
to the Document
. From source file:com.stratelia.webactiv.almanach.control.AlmanachPdfGenerator.java
License:Open Source License
private static void createFirstPage(AlmanachSessionController almanach, Document document) throws AlmanachException { try {//from w w w .j a v a 2s . c o m Font masterFont = new Font(Font.HELVETICA, 40, Font.BOLD, new Color(0, 0, 0)); Paragraph masterTitle = new Paragraph("\n\n\n\n" + almanach.getComponentLabel(), masterFont); masterTitle.setAlignment(Element.ALIGN_CENTER); Font secondFont = new Font(Font.HELVETICA, 14, Font.NORMAL, new Color(0, 0, 0)); Paragraph secondTitle = new Paragraph(almanach.getString("editeLe") + " " + DateUtil.getOutputDate(new Date(), almanach.getLanguage()) + almanach.getString("Silverpeas"), secondFont); secondTitle.setAlignment(Element.ALIGN_CENTER); document.add(masterTitle); document.add(secondTitle); } catch (DocumentException e) { throw new AlmanachException("AlmanachPdfGenerator.createFirstPage()", SilverpeasException.ERROR, "almanach.EX_CANT_CREATE_FIRST_PAGE", e); } }
From source file:com.stratelia.webactiv.newsEdito.control.PdfGenerator.java
License:Open Source License
/** * Method declaration//from w w w . j av a 2s . com * @param name * @param completePubList * @param langue * @throws NewsEditoException * @see */ public static void generatePubList(String name, Collection<CompletePublication> completePubList, String langue) throws NewsEditoException { SilverTrace.info("NewsEdito", "PdfGenerator.generatePubList", "NewsEdito.MSG_ENTRY_METHOD", "Pdf name = " + name); try { CompletePublication first = completePubList.iterator().next(); String fileName = FileRepositoryManager.getTemporaryPath( first.getPublicationDetail().getPK().getSpace(), first.getPublicationDetail().getPK().getComponentName()) + name; ResourceLocator message = new ResourceLocator( "com.stratelia.webactiv.newsEdito.multilang.newsEditoBundle", langue); // creation of the document with a certain size and certain margins Document document = new Document(PageSize.A4, 50, 50, 50, 50); // we add some meta information to the document document.addAuthor("Generateur de PDF Silverpeas"); document.addSubject("Compilation de publications Silverpeas"); document.addCreationDate(); PdfWriter.getInstance(document, new FileOutputStream(fileName)); document.open(); createFirstPage(document, langue); HeaderFooter header = new HeaderFooter(new Phrase(message.getString("publicationCompilation")), false); HeaderFooter footer = new HeaderFooter(new Phrase("Page "), new Phrase(".")); footer.setAlignment(Element.ALIGN_CENTER); document.setHeader(header); document.setFooter(footer); document.newPage(); Font titleFont = new Font(Font.HELVETICA, 24, Font.NORMAL, new Color(255, 255, 255)); Paragraph cTitle = new Paragraph(message.getString("listPublication"), titleFont); Chapter chapter = new Chapter(cTitle, 1); Iterator<CompletePublication> i = completePubList.iterator(); CompletePublication complete = null; while (i.hasNext()) { complete = i.next(); addPublication(chapter, complete); } document.add(chapter); document.close(); } catch (Exception e) { throw new NewsEditoException("PdfGenerator.generatePubList", NewsEditoException.WARNING, "NewsEdito.EX_PROBLEM_TO_GENERATE_PUBLI_LIST", e); } }
From source file:com.stratelia.webactiv.newsEdito.control.PdfGenerator.java
License:Open Source License
/** * Method declaration/*from www. ja v a 2s . c om*/ * @param document * @param langue * @throws NewsEditoException * @see */ public static void createFirstPage(Document document, String langue) throws NewsEditoException { try { ResourceLocator message = new ResourceLocator( "com.stratelia.webactiv.newsEdito.multilang.newsEditoBundle", langue); Font masterFont = new Font(Font.HELVETICA, 40, Font.BOLD, new Color(0, 0, 0)); Paragraph masterTitle = new Paragraph("\n\n\n\n" + message.getString("journalEditorial"), masterFont); masterTitle.setAlignment(Element.ALIGN_CENTER); Font secondFont = new Font(Font.HELVETICA, 20, Font.NORMAL, new Color(0, 0, 0)); Paragraph secondTitle = new Paragraph( message.getString("editeLe") + " " + DateUtil.getOutputDate(new Date(), langue), secondFont); secondTitle.setAlignment(Element.ALIGN_CENTER); document.add(masterTitle); document.add(secondTitle); } catch (Exception e) { throw new NewsEditoException("PdfGenerator.createFirstPage", NewsEditoException.WARNING, "NewsEdito.EX_PROBLEM_TO_GENERATE_PAGE_ONE", e); } }
From source file:com.stratelia.webactiv.newsEdito.control.PdfGenerator.java
License:Open Source License
/** * Method declaration/*from w w w . j a v a 2 s . c o m*/ * @param document * @param title * @param titleCount * @param publicationBm * @return * @throws NewsEditoException * @see */ public static Section addTitle(Document document, NodeDetail title, int titleCount, PublicationBm publicationBm) throws NewsEditoException { // we define some fonts Font titleFont = new Font(Font.HELVETICA, 24, Font.NORMAL, new Color(255, 255, 255)); Paragraph cTitle = new Paragraph(title.getName(), titleFont); Chapter chapter = new Chapter(cTitle, titleCount); if (title.getDescription() != null) { chapter.add(new Paragraph(title.getDescription())); } try { addPublications(chapter, title, publicationBm); document.add(chapter); } catch (Exception e) { throw new NewsEditoException("PdfGenerator.addTitle", NewsEditoException.WARNING, "NewsEdito.EX_NO_TITLE_ADDED", e); } return chapter; }
From source file:com.stratelia.webactiv.newsEdito.control.PdfGenerator.java
License:Open Source License
/** * Method declaration/*from w w w . ja v a 2 s .c o m*/ * @param document * @param archiveDetail * @param publicationBm * @param langue * @see */ public static void addEditorial(Document document, NodeDetail archiveDetail, PublicationBm publicationBm, String langue) throws NewsEditoException { SilverTrace.info("NewsEdito", "PdfGenerator.addEditorial", "NewsEdito.MSG_ENTRY_METHOD"); try { ResourceLocator message = new ResourceLocator( "com.stratelia.webactiv.newsEdito.multilang.newsEditoBundle", langue); Collection<PublicationDetail> pubList = publicationBm.getDetailsByFatherPK(archiveDetail.getNodePK()); Iterator<PublicationDetail> i = pubList.iterator(); if (i.hasNext()) { try { Font publicationFont = new Font(Font.HELVETICA, 18, Font.BOLD, new Color(0, 64, 64)); Font titleFont = new Font(Font.HELVETICA, 24, Font.NORMAL, new Color(255, 255, 255)); Paragraph cTitle = new Paragraph(message.getString("editorial"), titleFont); Chapter chapter = new Chapter(cTitle, 0); chapter.setNumberDepth(0); PublicationDetail detail = null; Paragraph name = null; Section subsection = null; Image img = null; while (i.hasNext()) { detail = i.next(); name = new Paragraph(detail.getName(), publicationFont); subsection = chapter.addSection(name, 0); subsection.setNumberDepth(0); if (detail.getDescription() != null) { subsection.add(new Paragraph(detail.getDescription())); } if (detail.getImage() != null) { String imagePath = FileRepositoryManager .getAbsolutePath(detail.getPK().getComponentName()) + getImagePath() + File.separator + detail.getImage(); try { SilverTrace.info("NewsEdito", "PDFGenerator.addEditorial", "root.MSG_PARAM_VALUE", "imagePath = " + imagePath); img = Image.getInstance(imagePath); } catch (Exception e) { SilverTrace.info("NewsEdito", "PDFGenerator.addEditorial", "NewsEdito.MSG_CANNOT_RETRIEVE_IMAGE", "imagePath = " + imagePath); } if (img == null) { SilverTrace.info("NewsEdito", "PdfGenerator.addEditorial", "NewsEdito.MSG_CANNOT_RETRIEVE_IMAGE"); } else { subsection.add(img); } } } document.add(chapter); } catch (DocumentException de) { SilverTrace.warn("NewsEdito", "PdfGenerator.addEditorial", "NewsEdito.EX_NO_EDITO_ADDED"); } } } catch (Exception e) { throw new NewsEditoException("PdfGenerator.addEditorial", NewsEditoException.WARNING, "NewsEdito.EX_PROBLEM_TO_ADD_EDITO", e); } }
From source file:com.sumeet.kraiglist.pdfview.PdfReportView.java
@Override protected void buildPdfDocument(Map<String, Object> model, Document pdfdoc, PdfWriter pdfwriter, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); String name = (String) session.getAttribute("firstname"); if (name == null) { name = ""; }/*w w w . j a v a2s . c o m*/ Font font_helvetica_12_normal_black = new Font(Font.HELVETICA, 12, Font.NORMAL, Color.BLACK); Font font_courier_16_italic_blue = new Font(Font.COURIER, 10, Font.ITALIC, Color.BLUE); Font font_courier_16_italic_red = new Font(Font.COURIER, 16, Font.ITALIC, Color.BLUE); Font font_times_16_bold_green = new Font(Font.TIMES_ROMAN, 10, Font.NORMAL, Color.BLACK); Paragraph prg0 = new Paragraph( " Terms of Use of MyNEU KRAIGLIST", font_helvetica_12_normal_black); Paragraph prg1 = new Paragraph( "____________________________________________________________________________________________________________", font_courier_16_italic_red); Paragraph prg2 = new Paragraph(""); Chunk c1 = new Chunk("Hello " + name + ",", font_courier_16_italic_blue); Paragraph prg3 = new Paragraph("PRODUCT SALES : " + "The GSI Products listed on this Site are offered for sale solely pursuant to GSIs standard terms and conditions of sale applicable" + "to such products. The terms and conditions are accessible for viewing by clicking on the link on each product line home page." + "GSI objects to and rejects any other terms that may be proposed by any customer or potential customer. No offers to sell or purchase" + "GSI products are valid and binding on GSI unless and until specifically accepted, in writing, by GSI.", font_times_16_bold_green); //Phrase phr2 = new Phrase("Phrase 2", font_helvetica_16_normal_blue); Paragraph prg4 = new Paragraph(""); Paragraph prg5 = new Paragraph("LICENSE TO USE THIS SITE : " + "We at the GSI Group Inc. and its subsidiaries (GSI) are happy to have you as a visitor. We have established the following" + "terms and conditions, including our Privacy Statement, as a requirement for visitors using our site. In order to use our site, you" + "must agree to these terms and conditions (Terms). BY CHOOSING TO ACCESS AND USE THIS SITE, YOU ARE EXPRESSLY" + "AGREEING TO BE LEGALLY BOUND BY THESE TERMS. IF YOU DO NOT AGREE, DO NOT USE OR VIEW THE SITE." + "These Terms apply only to the use of this Site and do not supercede any other contractual agreement between you and GSI." + "Use of Materials: Upon your agreement to the Terms, GSI grants you the right to view the site and to download materials from" + "this site for your personal, non-commercial use. You are not authorized to use the materials for any other purpose. If you do" + "download or otherwise reproduce the materials from this Site, you must reproduce all of GSIs proprietary markings, such as" + "copyright and trademark notices, in the same form and manner as the original." + "Private Pages: Some parts of this Site are not available to the general public, but only to certain business associates of GSI." + "These sections may only be accessed by authorized entities and are controlled by password-protected access. If you are not" + "authorized to use these sections, then you agree that you will not attempt to gain access. If you are authorized, then by accessing" + "those areas, you expressly agree to the supplemental terms that are posted as part of the access process." + "No Harmful Use: In exchange for our permission to use this Site, you agree that you will not do anything to harm the functioning" + "or content of the Site. You will not attempt to upload, insert or change any information or image to or on this Site, except for providing" + "information where prompted by the Site. You agree that you will not take any action that imposes an unreasonably or disproportionately" + "large load on the Site or interferes with its functioning. You also agree that you will not use any false identity" + "when interacting with the Site, or do anything that is fraudulent, obscene, libelous or legally prohibited." + "You may not use any deep-link, page-scrape, robot, spider or any other automatic device, program, algorithm or methodology" + "or any similar or equivalent manual process to access, acquire, copy or monitor any portion of the Site or any of its content," + "or in any way reproduce or circumvent the navigational structure or presentation of the Site." + "INDEMNITY: YOU AGREE THAT YOU WILL DEFEND, INDEMNIFY AND HOLD HARMLESS GSI, ITS CUSTOMERS, SUPPLIERS" + "AND JOINT VENTURE PARTNERS AND THEIR RESPECTIVE EMPLOYEES, OFFICERS, DIRECTORS, CONTRACTORS," + "VENDORS, ASSIGNEES AND AGENTS FOR AND AGAINST ANY COSTS, CLAIMS, DAMAGES, LOSSES, OR" + "OTHER LIABILITIES ARISING FROM YOUR USE OF THE SITE IN BREACH OF THESE TERMS OR IN VIOLATION OF THE" + "LAW. IF GSI TAKES ANY LEGAL ACTION AGAINST YOU AS A RESULT OF YOUR VIOLATION OF THESE TERMS, YOU" + "AGREE THAT YOU WILL BE RESPONSIBLE FOR AND WILL PAY ALL OF GSIS LEGAL FEES IN CONNECTION WITH" + "SUCH ACTION. ", font_times_16_bold_green); pdfdoc.add(c1); pdfdoc.add(prg0); pdfdoc.add(prg1); pdfdoc.add(prg2); pdfdoc.add(prg3); pdfdoc.add(prg4); pdfdoc.add(prg5); }
From source file:com.tsp.gespro.bo.DegustacionBO.java
/** * Representacin impresa PDF/*from w w w . j ava2 s. com*/ */ public ByteArrayOutputStream toPdf(UsuarioBO user) throws Exception { SimpleDateFormat fecha = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat hora = new SimpleDateFormat("HH:mm:ss"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfITextUtil obj = new PdfITextUtil(); //Tamao de documento (Tamao Carta) com.lowagie.text.Document doc = new com.lowagie.text.Document(PageSize.LETTER); //Definicin de Fuentes a usar Font letraOcho = new Font(Font.HELVETICA, 8, Font.NORMAL); Font letraOchoBold = new Font(Font.HELVETICA, 8, Font.BOLD); Font letraNueve = new Font(Font.HELVETICA, 9, Font.NORMAL); Font letraNueveBold = new Font(Font.HELVETICA, 9, Font.BOLD); Font letraNueveBoldRojo = new Font(Font.TIMES_ROMAN, 9, Font.BOLD, Color.red); Font letraNueveBoldAzul = new Font(Font.TIMES_ROMAN, 9, Font.BOLD, Color.blue); Font letraOchoVerde = new Font(Font.TIMES_ROMAN, 8, Font.NORMAL, Color.green); Font letra14Bold = new Font(Font.HELVETICA, 14, Font.BOLD); String msgError = ""; File fileImageLogo = null; try { if (user != null) fileImageLogo = new ImagenPersonalBO(this.conn) .getFileImagenPersonalByEmpresa(user.getUser().getIdEmpresa()); } catch (Exception ex) { ex.printStackTrace(); } try { //Preparamos writer de PDF PdfWriter writer = PdfWriter.getInstance(doc, baos); EventPDF eventPDF = new EventPDF(doc, user, ReportBO.DEGUSTACION_REPRESENTACION_IMPRESA, fileImageLogo); writer.setPageEvent(eventPDF); //Ajustamos margenes de pgina //doc.setMargins(50, 50, 120, 50); //doc.setMargins(20, 20, 80, 20); doc.setMargins(10, 10, 150, 40); //Iniciamos documento doc.open(); //Creamos tabla principal PdfPTable mainTable = new PdfPTable(1); mainTable.setTotalWidth(550); mainTable.setLockedWidth(true); //CONTENIDO ------------- //SALTO DE L?NEA obj.agregaCelda(mainTable, letraOcho, " ", new boolean[] { false, false, false, false }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1); //Cabecera (Datos Generales)--------------------- PdfPTable tAux = new PdfPTable(1); Cliente clienteDto = null; DatosUsuario datosUsuarioVendedor = null; try { if (this.degustacion.getIdCliente() > 0) clienteDto = new ClienteBO(this.degustacion.getIdCliente(), this.conn).getCliente(); if (this.degustacion.getIdUsuario() > 0) datosUsuarioVendedor = new UsuarioBO(this.degustacion.getIdUsuario()).getDatosUsuario(); } catch (Exception ex) { ex.printStackTrace(); } //Datos informativos generales PdfPTable tInfoGeneral = new PdfPTable(1); tInfoGeneral.setTotalWidth(160); tInfoGeneral.setLockedWidth(true); obj.agregaCelda(tInfoGeneral, letraNueveBold, Color.lightGray, "ID Degustacin", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1); obj.agregaCelda(tInfoGeneral, letraNueveBoldRojo, "" + this.degustacion.getIdDegustacion(), new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1); obj.agregaCelda(tInfoGeneral, letraNueveBold, Color.lightGray, "Fecha Degustacin", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1); obj.agregaCelda(tInfoGeneral, letraNueve, DateManage.dateToStringEspanol(this.degustacion.getFechaApertura()), new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1); obj.agregaCelda(tInfoGeneral, letraNueveBold, Color.lightGray, "Promotor", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1); obj.agregaCelda(tInfoGeneral, letraNueve, datosUsuarioVendedor != null ? (datosUsuarioVendedor.getNombre() + " " + datosUsuarioVendedor.getApellidoPat()) : "Sin vendedor asignado", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1); //Pintamos datos informativos Generales en la esquina superior derecha PdfContentByte cb = writer.getDirectContent(); tInfoGeneral.writeSelectedRows(0, -1, doc.right() - 180, doc.top() + 100, cb); //Datos de Cliente/Prospecto PdfPTable tCliente = new PdfPTable(2); tCliente.setTotalWidth(550); tCliente.setLockedWidth(true); obj.agregaCelda(tCliente, letraNueveBold, Color.lightGray, "Cliente", new boolean[] { false, false, false, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 2); tAux = new PdfPTable(1); tAux.setTotalWidth(275); tAux.setLockedWidth(true); try { obj.agregaCelda(tAux, letraOcho, "Nombre Comercial: " + (clienteDto != null ? clienteDto.getNombreComercial() : ""), new boolean[] { false, true, false, false }, Element.ALIGN_LEFT, Element.ALIGN_TOP, 0, new int[0], 1); } catch (Exception ex) { ex.printStackTrace(); } obj.agregaTabla(tCliente, tAux, new boolean[] { false, false, false, false }, Element.ALIGN_LEFT, Element.ALIGN_TOP, 0, new int[0], 1); obj.agregaCelda(tCliente, letraOcho, "" + "DOMICILIO: \n" + (clienteDto != null ? "Calle: " + clienteDto.getCalle() : "") + " " + (clienteDto != null ? clienteDto.getNumero() : "") + " " + (clienteDto != null ? clienteDto.getNumeroInterior() : "") + (clienteDto != null ? " Col: " + clienteDto.getColonia() : "") + (clienteDto != null ? " \nDeleg./Municipio: " + clienteDto.getMunicipio() : "") + (clienteDto != null ? " Estado: " + clienteDto.getEstado() : "") + (clienteDto != null ? " \nC.P. " + clienteDto.getCodigoPostal() : ""), new boolean[] { false, true, false, true }, Element.ALIGN_LEFT, Element.ALIGN_TOP, 0, new int[0], 1); obj.agregaTabla(mainTable, tCliente, new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_TOP, 0, new int[0], 1); //FIN Cabecera (Datos Generales)----------------- //DOBLE SALTO DE L?NEA obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1); obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1); int colsDetalles = 6; PdfPTable tDetalles = new PdfPTable(colsDetalles);//6); tDetalles.setTotalWidth(550); tDetalles.setWidths(new int[] { 200, 70, 70, 70, 70, 70 }); tDetalles.setLockedWidth(true); /*CABECERA*/ obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Producto Degustado", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 1); obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Hr Inicio", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 1); obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Hr Termino", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 1); obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Inventario Inicial", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 1); obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Inventario Final", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 1); obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Piezas Degustadas", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 1); /*FIN DE CABECERA*/ Degustacion[] degustacionDtos = new Degustacion[0]; try { degustacionDtos = this.findDegustaciones(this.degustacion.getIdDegustacion(), this.degustacion.getIdEmpresa(), -1, -1, ""); } catch (Exception e) { } //Listado de Productos for (Degustacion item : degustacionDtos) { if (item != null) { Concepto conceptoDto = null; try { ConceptoBO conceptoBO = new ConceptoBO(item.getIdConcepto(), this.conn); conceptoDto = conceptoBO.getConcepto(); } catch (Exception e) { } //Producto obj.agregaCelda(tDetalles, letraOcho, null, conceptoDto.getNombreDesencriptado(), new boolean[] { true, true, true, true }, Element.ALIGN_JUSTIFIED, Element.ALIGN_TOP, 15, new int[] { 5, 5, 5, 5 }, 1); //Inicio obj.agregaCelda(tDetalles, letraOcho, null, hora.format(item.getFechaApertura()), new boolean[] { true, true, true, true }, Element.ALIGN_JUSTIFIED, Element.ALIGN_TOP, 15, new int[] { 5, 5, 5, 5 }, 1); //Termino obj.agregaCelda(tDetalles, letraOcho, null, hora.format(item.getFechaCierre()), new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP, 15, new int[] { 5, 5, 5, 5 }, 1); //Inv inicial obj.agregaCelda(tDetalles, letraOcho, null, "" + (item.getCantidad()), new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP, 15, new int[] { 5, 5, 5, 5 }, 1); //inv final obj.agregaCelda(tDetalles, letraOcho, null, "" + (item.getCantidadCierre()), new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP, 15, new int[] { 5, 5, 5, 5 }, 1); //Piezas obj.agregaCelda(tDetalles, letraOcho, null, "" + (item.getCantidad() - item.getCantidadCierre()), new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP, 15, new int[] { 5, 5, 5, 5 }, 1); } } obj.agregaTabla(mainTable, tDetalles, new boolean[] { false, false, false, false }, Element.ALIGN_CENTER, Element.ALIGN_TOP, 0, new int[0], 1); //DOBLE SALTO DE L?NEA obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1); obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1); /*prods Vendidos durante degustacion*/ PdfPTable tVenta = new PdfPTable(4); tVenta.setTotalWidth(550); tVenta.setWidths(new int[] { 70, 140, 170, 120 }); tVenta.setLockedWidth(true); obj.agregaCelda(tVenta, letraNueveBold, Color.lightGray, "Producto Vendido durante Degutacin", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 4); Productosvendidos[] pedidoProductoDto = new Productosvendidos[0]; String filtroBusqueda = " ID_PEDIDO IN ( SELECT ID_PEDIDO FROM sgfens_pedido WHERE ID_EMPRESA = '" + this.degustacion.getIdEmpresa() + "' AND ID_TIPO_PEDIDO = 2 AND ID_USUARIO_VENDEDOR = " + this.degustacion.getIdUsuario() + " AND " + " ID_ESTATUS_PEDIDO<>2 AND FECHA_PEDIDO BETWEEN '" + this.degustacion.getFechaApertura() + "' AND '" + this.degustacion.getFechaCierre() + "') "; try { pedidoProductoDto = new ProductosvendidosDaoImpl().findByDynamicWhere(filtroBusqueda, null); } catch (Exception e) { } if (pedidoProductoDto.length > 0) { obj.agregaCelda(tVenta, letraOchoBold, null, "Cdigo", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 1); obj.agregaCelda(tVenta, letraOchoBold, null, "Nombre", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 1); obj.agregaCelda(tVenta, letraOchoBold, null, "Descripcin", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 1); obj.agregaCelda(tVenta, letraOchoBold, null, "Unidades Vendidas", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 1); for (Productosvendidos pedidoProd : pedidoProductoDto) { if (pedidoProd != null) { Concepto conceptoDto = null; try { ConceptoBO conceptoBO = new ConceptoBO(pedidoProd.getIdConcepto(), this.conn); conceptoDto = conceptoBO.getConcepto(); } catch (Exception e) { } //Cdigo obj.agregaCelda(tVenta, letraOcho, null, conceptoDto.getIdentificacion(), new boolean[] { true, true, true, true }, Element.ALIGN_JUSTIFIED, Element.ALIGN_TOP, 15, new int[] { 5, 5, 5, 5 }, 1); //Nombre obj.agregaCelda(tVenta, letraOcho, null, conceptoDto.getNombreDesencriptado(), new boolean[] { true, true, true, true }, Element.ALIGN_JUSTIFIED, Element.ALIGN_TOP, 15, new int[] { 5, 5, 5, 5 }, 1); //Descripcin obj.agregaCelda(tVenta, letraOcho, null, conceptoDto.getDescripcion(), new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP, 15, new int[] { 5, 5, 5, 5 }, 1); //Unidades Vendidas obj.agregaCelda(tVenta, letraOcho, null, "" + (pedidoProd.getCantidad()), new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP, 15, new int[] { 5, 5, 5, 5 }, 1); } } } else { obj.agregaCelda(tVenta, letraOcho, null, "No se registrarn datos.", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 4); } obj.agregaTabla(mainTable, tVenta, new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_TOP, 0, new int[0], 1); //DOBLE SALTO DE L?NEA obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1); obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1); /*Comentarios Adicionales*/ PdfPTable tComenst = new PdfPTable(1); tComenst.setTotalWidth(550); tComenst.setWidths(new int[] { 550 }); tComenst.setLockedWidth(true); obj.agregaCelda(tComenst, letraNueveBold, Color.lightGray, "Comentarios", new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 2); obj.agregaCelda(tComenst, letraOcho, null, this.degustacion.getComentariosCierre(), new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 2); obj.agregaTabla(mainTable, tComenst, new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_TOP, 0, new int[0], 1); //FIN DE CONTENIDO -------- //Aadimos tabla principal construida al documento doc.add(mainTable); mainTable.flushContent(); } catch (Exception ex) { msgError = "No se ha podido generar la representacin impresa de la Degustacion en formato PDF:<br/>" + ex.toString(); } finally { if (doc.isOpen()) doc.close(); } if (!msgError.equals("")) { throw new Exception(msgError); } return baos; }
From source file:com.unicornlabs.kabouter.reporting.PowerReport.java
License:Apache License
public static void GeneratePowerReport(Date startDate, Date endDate) { try {// w w w . ja v a 2s . co m Historian theHistorian = (Historian) BusinessObjectManager.getBusinessObject(Historian.class.getName()); ArrayList<String> powerLogDeviceIds = theHistorian.getPowerLogDeviceIds(); Document document = new Document(PageSize.A4, 50, 50, 50, 50); File outputFile = new File("PowerReport.pdf"); outputFile.createNewFile(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(outputFile)); document.open(); document.add(new Paragraph("Power Report for " + startDate.toString() + " to " + endDate.toString())); document.newPage(); DecimalFormat df = new DecimalFormat("#.###"); for (String deviceId : powerLogDeviceIds) { ArrayList<Powerlog> powerlogs = theHistorian.getPowerlogs(deviceId, startDate, endDate); double total = 0; double max = 0; Date maxTime = startDate; double average = 0; XYSeries series = new XYSeries(deviceId); XYDataset dataset = new XYSeriesCollection(series); for (Powerlog log : powerlogs) { total += log.getPower(); if (log.getPower() > max) { max = log.getPower(); maxTime = log.getId().getLogtime(); } series.add(log.getId().getLogtime().getTime(), log.getPower()); } average = total / powerlogs.size(); document.add(new Paragraph("\nDevice: " + deviceId)); document.add(new Paragraph("Average Power Usage: " + df.format(average))); document.add(new Paragraph("Maximum Power Usage: " + df.format(max) + " at " + maxTime.toString())); document.add(new Paragraph("Total Power Usage: " + df.format(total))); //Create a custom date axis to display dates on the X axis DateAxis dateAxis = new DateAxis("Date"); //Make the labels vertical dateAxis.setVerticalTickLabels(true); //Create the power axis NumberAxis powerAxis = new NumberAxis("Power"); //Set both axes to auto range for their values powerAxis.setAutoRange(true); dateAxis.setAutoRange(true); //Create the tooltip generator StandardXYToolTipGenerator ttg = new StandardXYToolTipGenerator("{0}: {2}", new SimpleDateFormat("yyyy/MM/dd HH:mm"), NumberFormat.getInstance()); //Set the renderer StandardXYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.LINES, ttg, null); //Create the plot XYPlot plot = new XYPlot(dataset, dateAxis, powerAxis, renderer); //Create the chart JFreeChart myChart = new JFreeChart(deviceId, JFreeChart.DEFAULT_TITLE_FONT, plot, true); PdfContentByte pcb = writer.getDirectContent(); PdfTemplate tp = pcb.createTemplate(480, 360); Graphics2D g2d = tp.createGraphics(480, 360, new DefaultFontMapper()); Rectangle2D r2d = new Rectangle2D.Double(0, 0, 480, 360); myChart.draw(g2d, r2d); g2d.dispose(); pcb.addTemplate(tp, 0, 0); document.newPage(); } document.close(); JOptionPane.showMessageDialog(null, "Report Generated."); Desktop.getDesktop().open(outputFile); } catch (FileNotFoundException fnfe) { JOptionPane.showMessageDialog(null, "Unable To Open File For Writing, Make Sure It Is Not Currently Open"); } catch (IOException ex) { Logger.getLogger(PowerReport.class.getName()).log(Level.SEVERE, null, ex); } catch (DocumentException ex) { Logger.getLogger(PowerReport.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.util.load.RecordDocCreate.java
/** * /*from w w w .ja v a2 s. com*/ * @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:com.util.tools.FeraExporter.java
public void preProcessPDF(Object document) throws IOException, BadElementException, DocumentException { Document pdf = (Document) document; pdf.open();/*from w w w . j av a 2 s.co m*/ pdf.setPageSize(PageSize.A4); ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext() .getContext(); String logo = servletContext.getRealPath("") + File.separator + "resources" + File.separator + "images" + File.separator + "Fera_Icon.png"; pdf.add(Image.getInstance(logo)); }