List of usage examples for com.itextpdf.text Font BOLD
int BOLD
To view the source code for com.itextpdf.text Font BOLD.
Click Source Link
From source file:sistemacontrole.MainWindow.java
private void pararSinalBtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pararSinalBtActionPerformed //salva os grafico BufferedImage img = new BufferedImage(PainelEntrada.getWidth(), PainelEntrada.getHeight(), BufferedImage.TYPE_INT_RGB); PainelEntrada.print(img.getGraphics()); // or: panel.printAll(...); try {/*from w ww . j ava2s . com*/ ImageIO.write(img, "jpg", new File("./Raw_Data/PainelEntrada" + this.registro + ".jpg")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } BufferedImage img2 = new BufferedImage(PainelSaida.getWidth(), PainelSaida.getHeight(), BufferedImage.TYPE_INT_RGB); PainelSaida.print(img2.getGraphics()); // or: panel.printAll(...); try { ImageIO.write(img2, "jpg", new File("./Raw_Data/PainelSaida" + this.registro + ".jpg")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.registro++; Font fontTITULO2 = new Font(Font.FontFamily.TIMES_ROMAN, 13, Font.NORMAL); Font fontTITULO = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD); fontTITULO.setColor(BaseColor.RED); Font fontDADO = new Font(Font.FontFamily.TIMES_ROMAN, 9, Font.NORMAL); if (cascata) { Paragraph tipo_VALOR = new Paragraph((this.controleT1), fontDADO); Paragraph KP_VALOR = new Paragraph((this.kp_t1), fontDADO); Paragraph KD_VALOR = new Paragraph((this.kd_t1), fontDADO); Paragraph KI_VALOR = new Paragraph((this.ki_t1), fontDADO); Paragraph TI_VALOR = new Paragraph((this.ti_t1), fontDADO); Paragraph TD_VALOR = new Paragraph((this.td_t1), fontDADO); pdfTableCascata.addCell(tipo_VALOR); pdfTableCascata.addCell(KP_VALOR); pdfTableCascata.addCell(KD_VALOR); pdfTableCascata.addCell(KI_VALOR); pdfTableCascata.addCell(TI_VALOR); pdfTableCascata.addCell(TD_VALOR); } // TODO add your handling code here: }
From source file:sistemacontrole.MainWindow.java
public void GerarPDFFuncao() throws BadElementException, IOException { try {/* ww w . j a v a 2 s.c om*/ //Define as fontes Font fontOBS = new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.NORMAL); Font fontTITULO2 = new Font(Font.FontFamily.TIMES_ROMAN, 13, Font.NORMAL); Font fontTITULO = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD); fontTITULO.setColor(BaseColor.RED); Font fontDADO = new Font(Font.FontFamily.TIMES_ROMAN, 9, Font.NORMAL); Document doc = new Document(PageSize.A4.rotate()); // adiciona imagem ao pdf Image Logotipo = Image.getInstance("./src/Imagens/imagem_pdf.png"); Logotipo.scalePercent((float) 47.5); PdfPTable tabelaGrfico = new PdfPTable(2); for (int i = 1; i < this.registro; i++) { Image LogotipoI = Image.getInstance("./Raw_Data/PainelEntrada" + i + ".jpg"); Image LogotipoI2 = Image.getInstance("./Raw_Data/PainelSaida" + i + ".jpg"); tabelaGrfico.addCell(LogotipoI); tabelaGrfico.addCell(LogotipoI2); } int count = this.tabelaDetalhes.getRowCount(); PdfWriter.getInstance(doc, new FileOutputStream(TelaPDF.CampoNome.getText() + ".pdf")); doc.open(); PdfPTable pdfTable = new PdfPTable(this.tabelaDetalhes.getColumnCount()); //adding table headers for (int i = 0; i < 15; i++) { pdfTable.addCell(new Paragraph(this.tabelaDetalhes.getColumnName(i), fontTITULO)); } PdfPTable pdfTableAuxiliar = new PdfPTable(this.tabelaDetalhes.getColumnCount()); String[][] valores = new String[15][15]; for (int i = 0; i < 15; i++) { for (int j = 0; j < 15; j++) { valores[i][j] = ""; } } Object[] obj = null; int contador = 1; for (int i = 0; i < count; i++) { for (int j = 0; j < 15; j++) { try { System.out.println("Valor: " + tabelaDetalhes.getModel().getValueAt(i, j).toString() + "Contado: " + contador); valores[i][j] = tabelaDetalhes.getModel().getValueAt(i, j).toString(); } catch (Exception e) { System.out.println("ERRO DEU contador: " + contador); contador++; } } } for (int i = 0; i < count; i++) { for (int j = 0; j < 15; j++) { pdfTableAuxiliar.addCell(new Paragraph(valores[i][j], fontDADO)); } } Paragraph title = new Paragraph("Sistema de Controle de Tanques - TC Control" + "\n\n", fontTITULO2); title.setAlignment(Paragraph.ALIGN_CENTER); Calendar calendar = new GregorianCalendar(); Date trialTime = new Date(); calendar.setTime(trialTime); Paragraph DIA = new Paragraph("Data: " + calendar.get(Calendar.DATE) + "/" + (calendar.get(Calendar.MONTH) + 1) + "/" + calendar.get(Calendar.YEAR)); Paragraph HORA = new Paragraph("Hora: " + calendar.get(Calendar.HOUR_OF_DAY) + ":" + calendar.get(Calendar.MINUTE) + ":" + calendar.get(Calendar.SECOND)); DIA.setAlignment(Paragraph.ALIGN_RIGHT); HORA.setAlignment(Paragraph.ALIGN_RIGHT); Paragraph espaco = new Paragraph("\n"); Paragraph aviso = new Paragraph("\nGraficos dos Testes ordenados:"); aviso.setAlignment(Paragraph.ALIGN_CENTER); Paragraph autores = new Paragraph( "\n" + "Desenvolvedores: @AlexandeLUZ - @AndersonDIAS - @HigoBESSA - @JaimeDANTAS", fontDADO); autores.setAlignment(Paragraph.ALIGN_CENTER); Paragraph obs = new Paragraph("\n" + "Observaes: " + TelaPDF.observacoes.getText(), fontOBS); obs.setAlignment(Paragraph.ALIGN_CENTER); //PARTE DO CASCATA DO TANQUE 1 Paragraph cascataTitulo = new Paragraph("Parmetros do Tanque 1 (Escravo): ", fontTITULO2); cascataTitulo.setAlignment(Paragraph.ALIGN_CENTER); //PdfPTable pdfTableCascata = new PdfPTable(5); // if(cascata){ // // Paragraph KP = new Paragraph("\n" + // "Kp" ,fontTITULO); // pdfTableCascata.addCell(KP); // Paragraph KD = new Paragraph("\n" + // "Kd" ,fontTITULO); // pdfTableCascata.addCell(KD); // Paragraph KI = new Paragraph("\n" + // "Ki" ,fontTITULO); // pdfTableCascata.addCell(KI); // Paragraph TI = new Paragraph("\n" + // "Ti" ,fontTITULO); // pdfTableCascata.addCell(TI); // Paragraph TD = new Paragraph("\n" + // "Td" ,fontTITULO); // pdfTableCascata.addCell(TD); // Paragraph KP_VALOR = new Paragraph((this.kp_t1),fontDADO); // Paragraph KD_VALOR = new Paragraph((this.kd_t1),fontDADO); // Paragraph KI_VALOR = new Paragraph((this.ki_t1),fontDADO); // Paragraph TI_VALOR = new Paragraph((this.ti_t1),fontDADO); // Paragraph TD_VALOR = new Paragraph((this.td_t1),fontDADO); // pdfTableCascata.addCell(KP_VALOR); // pdfTableCascata.addCell(KD_VALOR); // pdfTableCascata.addCell(KI_VALOR); // pdfTableCascata.addCell(TI_VALOR); // pdfTableCascata.addCell(TD_VALOR); // // } doc.add(Logotipo); doc.add(title); doc.add(pdfTable); doc.add(pdfTableAuxiliar); if (cascata) { doc.add(cascataTitulo); doc.add(espaco); doc.add(pdfTableCascata); } doc.add(obs); doc.add(aviso); //doc.add(espaco); doc.add(tabelaGrfico); doc.add(espaco); doc.add(espaco); doc.add(DIA); doc.add(HORA); doc.add(autores); doc.close(); System.out.println("done"); mostrarAviso("Arquivo criado com sucesso!"); TelaPDF.setVisible(false); } catch (DocumentException ex) { Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); mostrarErro("Erro ao gerar PDF!"); } catch (FileNotFoundException ex) { Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); mostrarErro("Erro ao gerar PDF!"); } }
From source file:src.GUI.FONTS.java
License:Open Source License
public static Font FontHeader() { Font font = FontFactory.getFont("Helvetica", 18, Font.BOLD); return font; }
From source file:src.servlets.ManageAdmin.java
/** * Handles the HTTP <code>GET</code> method. * * @param request servlet request/*from w ww . jav a2s.com*/ * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Map m = request.getParameterMap(); if (m.containsKey("GetPDF")) { try { String Report = getServletContext().getRealPath("") + "admin\\PDF_Report.pdf"; FileOutputStream file = new FileOutputStream(Report); Document document = new Document(); document.addAuthor("K00140908"); PdfWriter.getInstance(document, file); ///////////////////////ADDING THE FILES TO PDF//////////////////// //Inserting Image in PDF String uploadPath = getServletContext().getRealPath("") + "images\\logo.gif"; Image img = Image.getInstance(uploadPath); img.scaleAbsolute(120f, 60f);// width,height of image in float // Inserting Title in PDF ORIGINAL // Font fontTitle=new Font(Font.FontFamily.HELVETICA, 16, Font.BOLD, BaseColor.WHITE); // Chunk title=new Chunk("PDF GENERATION in Java with iText", fontTitle); // title.setBackground(new BaseColor(255,102,0), 1f, 1f, 1f, 3f); // title.setLineHeight(30f); // title.setUnderline(BaseColor.BLACK,5f,0.5f,2f,0.5f,PdfContentByte.LINE_CAP_ROUND); Font fontTitle = new Font(Font.FontFamily.HELVETICA, 16, Font.BOLD, BaseColor.BLACK); Chunk title = new Chunk("Lit Realty System Report", fontTitle); title.setLineHeight(30f); //Inserting Table in PDF PdfPTable table = new PdfPTable(3); table.setWidthPercentage(100); // Sets the width percentage that the table will occupy in the page table.setSpacingAfter(10f); table.setSpacingBefore(15f); table.setWidths(new float[] { 2f, 2f, 2f }); // Sets relative width of table Font fontHeader = new Font(Font.FontFamily.HELVETICA, 15, Font.BOLD, BaseColor.BLUE); PdfPCell headercell = new PdfPCell(new Phrase("Property Photo", fontHeader)); // Creates new cell in table headercell.setBackgroundColor(new BaseColor(230, 230, 243)); headercell.setPaddingBottom(5f); table.addCell(headercell); headercell = new PdfPCell(new Phrase("Property ID", fontHeader)); headercell.setBackgroundColor(new BaseColor(233, 233, 233)); headercell.setPaddingBottom(5f); table.addCell(headercell); headercell = new PdfPCell(new Phrase("Price", fontHeader)); headercell.setBackgroundColor(new BaseColor(233, 233, 233)); headercell.setPaddingBottom(5f); table.addCell(headercell); PdfPCell cell1 = new PdfPCell(img, false); table.addCell(cell1); table.addCell("134000"); table.addCell("213445"); table.addCell("134000"); //Inserting List com.itextpdf.text.List list = new com.itextpdf.text.List(true, 30); list.add(new ListItem("Example1")); list.add(new ListItem("Example2")); list.add(new ListItem("Example3")); //Adding elements into PDF Document document.open(); document.add(img); document.add(title); document.add(Chunk.NEWLINE); document.add(table); document.newPage(); document.add(new Chunk("List of Examples").setUnderline(+1f, -5f)); document.add(list); document.newPage(); document.add(new Chunk("List of Examples").setUnderline(+1f, -5f)); document.add(list); document.newPage(); document.add(new Chunk("List of Properts By Agent X").setUnderline(+1f, -5f)); //////////////////////GET Propertys From Entity/////////////// List<Properties> allPropertiesList = PropertiesDB.getAllProperties(); PdfPTable propertyTable = new PdfPTable(3); PdfPCell propertyHeadingcell1 = new PdfPCell(new Phrase("Photo")); PdfPCell propertyHeadingcell2 = new PdfPCell(new Phrase("Property ID")); PdfPCell propertyHeadingcell3 = new PdfPCell(new Phrase("Price")); propertyHeadingcell1.setBorder(Rectangle.NO_BORDER); propertyHeadingcell2.setBorder(Rectangle.NO_BORDER); propertyHeadingcell3.setBorder(Rectangle.NO_BORDER); propertyTable.addCell(propertyHeadingcell1); propertyTable.addCell(propertyHeadingcell2); propertyTable.addCell(propertyHeadingcell3); document.add(Chunk.NEWLINE); String uploadPathforPropertyPhoto = getServletContext().getRealPath("") + "images\\properties\\thumbnails\\"; Image propertyThumbnail; img.scaleAbsolute(120f, 60f);// width,height of image in float for (Properties anProperty : allPropertiesList) { propertyThumbnail = Image.getInstance(uploadPathforPropertyPhoto + anProperty.getPhoto()); PdfPCell propertycell1 = new PdfPCell(propertyThumbnail, false); propertycell1.setPaddingBottom(20); PdfPCell propertycell2 = new PdfPCell(new Phrase(anProperty.getListingNum().toString())); PdfPCell propertycell3 = new PdfPCell(new Phrase(anProperty.getPrice().toString())); propertycell1.setBorder(Rectangle.NO_BORDER); propertycell2.setBorder(Rectangle.NO_BORDER); propertycell3.setBorder(Rectangle.NO_BORDER); propertyTable.addCell(propertycell1); propertyTable.addCell(propertycell2); propertyTable.addCell(propertycell3); } document.add(Chunk.NEWLINE); document.add(propertyTable); //////////////////////GET Propertys From Entity/////////////// document.close(); file.close(); System.out.println("Pdf created successfully ! :)"); String filePath = Report; File downloadFile = new File(filePath); FileInputStream inStream = new FileInputStream(downloadFile); // if you want to use a relative path to context root: String relativePath = getServletContext().getRealPath(""); System.out.println("relativePath = " + relativePath); // obtains ServletContext ServletContext context = getServletContext(); // gets MIME type of the file String mimeType = context.getMimeType(filePath); if (mimeType == null) { // set to binary type if MIME mapping not found mimeType = "application/octet-stream"; } System.out.println("MIME type: " + mimeType); // modifies response response.setContentType(mimeType); response.setContentLength((int) downloadFile.length()); // forces download String headerKey = "Content-Disposition"; String headerValue = String.format("attachment; filename=\"%s\"", downloadFile.getName()); response.setHeader(headerKey, headerValue); // obtains response's output stream OutputStream outStream = response.getOutputStream(); byte[] buffer = new byte[4096]; int bytesRead = -1; while ((bytesRead = inStream.read(buffer)) != -1) { outStream.write(buffer, 0, bytesRead); } inStream.close(); outStream.close(); ///////////////// processRequest(request, response); } catch (DocumentException ex) { Logger.getLogger(ManageAdmin.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:storehausimport.SaveToPdf.java
public boolean save(String inputFilePath, String outputFilePath) throws Exception { if (outputFilePath.isEmpty()) { throw new Exception("Trkst parametrs outputFilePath"); }//from w w w .ja v a 2 s . co m if (inputFilePath.isEmpty()) { throw new Exception("Trkst parametrs inputFilePath"); } File inputFile = new File(inputFilePath); Document pdfDoc = new Document(); try { PdfWriter writer = PdfWriter.getInstance(pdfDoc, new FileOutputStream(outputFilePath)); pdfDoc.open(); pdfDoc.setMarginMirroring(true); pdfDoc.setMargins(36, 72, 108, 180); pdfDoc.topMargin(); BaseFont helvetica = BaseFont.createFont("Helvetica", BaseFont.CP1257, BaseFont.NOT_EMBEDDED); Font normal_font = new Font(helvetica, 10, Font.NORMAL); Font bold_font = new Font(); bold_font.setStyle(Font.BOLD); bold_font.setSize(10); pdfDoc.add(new Paragraph("\n")); if (inputFile.exists()) { iStream = new FileInputStream(inputFile); in = new DataInputStream(iStream); is = new InputStreamReader(in); br = new BufferedReader(is); String strLine; while ((strLine = br.readLine()) != null) { Paragraph para = new Paragraph(strLine + "\n", normal_font); para.setAlignment(Element.ALIGN_LEFT); pdfDoc.add(para); } } else { pdfDoc.close(); throw new Exception("Trkst parametrs inputFilePath"); } pdfDoc.close(); } catch (Exception ex) { throw new Exception(ex); } return true; }
From source file:storybook.export.ExportPDF.java
public void open() { SbApp.trace("ExportPDF.open()"); outDoc = new Document(); Rectangle rectangle = new Rectangle(PageSize.getRectangle(parent.parent.paramExport.pdfPageSize)); if (parent.parent.paramExport.pdfLandscape) { rectangle = new Rectangle(PageSize.getRectangle(parent.parent.paramExport.pdfPageSize).rotate()); }/*from ww w.j a v a2s . c om*/ outDoc.setPageSize(rectangle); try { writer = PdfWriter.getInstance(outDoc, new FileOutputStream(fileName)); } catch (FileNotFoundException | DocumentException ex) { SbApp.error(ExportPDF.class.getName(), ex); } outDoc.open(); addMetaData(); try { outDoc.add(new Phrase(parent.bookTitle + " - " + parent.exportData.getKey() + "\n", FontFactory.getFont(FontFactory.HELVETICA, 14, Font.BOLD))); } catch (DocumentException ex) { SbApp.error("ExportPDF.open()", ex); } if (headers == null) return; float hsize[] = new float[headers.size()]; int i = 0; for (ExportHeader header : headers) { hsize[i] = header.getSize(); i++; } table = new PdfPTable(hsize); for (ExportHeader header : headers) { table.addCell(new Phrase(header.getName(), FontFactory.getFont(FontFactory.HELVETICA, 10, Font.BOLD))); } }
From source file:Subordinate.request.java
private void jLabel15MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel15MouseClicked Document document = new Document(); try {/*from ww w . j a v a 2 s. c o m*/ PdfWriter.getInstance(document, new FileOutputStream("printreq.pdf")); document.open(); SimpleDateFormat td = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date now = new Date(); String tdnow = td.format(now); Paragraph paragraph = new Paragraph(ALLBITS); paragraph.add(new Paragraph(tdnow)); paragraph.add(new Paragraph("Request : \n\n", FontFactory.getFont(FontFactory.COURIER_BOLD, 20, Font.BOLD, BaseColor.DARK_GRAY))); document.add(paragraph); PdfPTable table = new PdfPTable(2); table.addCell("ID Request :"); table.addCell(request.intGetter("idRequest") + ""); table.addCell("Request type :"); table.addCell(request.stringGetter("requestType")); table.addCell("Client name :"); table.addCell(request.stringGetter("clientName")); table.addCell("Phone number :"); table.addCell(request.stringGetter("clientTel")); table.addCell("Address 1 :"); table.addCell(request.stringGetter("address1")); table.addCell("Address 2 :"); table.addCell(request.stringGetter("address2")); document.add(table); document.close(); /* Open Pdf */ Desktop desktop = Desktop.getDesktop(); if (desktop.isSupported(Desktop.Action.OPEN)) { desktop.open(new File("printreq.pdf")); } else { System.out.println("Open is not supported"); } } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Subordoante.Sub.java
public void openPDF() { Document document = new Document(); try {/*from w w w . j a va2 s . c o m*/ PdfWriter.getInstance(document, new FileOutputStream("printreq.pdf")); document.open(); SimpleDateFormat td = new SimpleDateFormat("yyyy-MM-dd"); Date now = new Date(); String tdnow = td.format(now); Paragraph paragraph = new Paragraph(ALLBITS); paragraph.add(new Paragraph(tdnow)); paragraph.add(new Paragraph("Request : \n\n", FontFactory.getFont(FontFactory.TIMES, 20, Font.BOLD, BaseColor.DARK_GRAY))); document.add(paragraph); PdfPTable table = new PdfPTable(2); table.addCell("ID Request :"); table.addCell(request.intGetter("idRequest") + ""); table.addCell("Request type :"); table.addCell(request.stringGetter("requestNet")); table.addCell("Client name :"); table.addCell(request.stringGetter("clientName")); table.addCell("Phone number :"); table.addCell(request.stringGetter("clientTel")); table.addCell("Address :"); table.addCell(request.stringGetter("address1")); if (request.stringGetter("requestType").equalsIgnoreCase("Transfer")) { table.addCell("Transfer address:"); table.addCell(request.stringGetter("address2")); } else if (request.stringGetter("requestType").equalsIgnoreCase("Maintenance")) { table.addCell("Problem :"); table.addCell(request.stringGetter("problem")); } else ; document.add(table); document.close(); /* Open Pdf */ Desktop desktop = Desktop.getDesktop(); if (desktop.isSupported(Desktop.Action.OPEN)) { desktop.open(new File("printreq.pdf")); } else { System.out.println("Open is not supported"); } } catch (DocumentException | IOException ex) { } }
From source file:superlaskuttaja.logiikka.PdfExtractor.java
private void muodostaDokumentti(Document document, String laskunNumero, PdfWriter writer) throws DocumentException, SQLException, ParseException { document.open();/* w ww. j ava2s. c o m*/ //---------------------------------------------------------------------- PdfPTable table1 = new PdfPTable(7); Font f1 = new Font(Font.FontFamily.HELVETICA, 10); Font f2 = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD); Font f3 = new Font(Font.FontFamily.HELVETICA, 14, Font.BOLD); Font f4 = new Font(Font.FontFamily.HELVETICA, 16, Font.BOLD); ResultSet rs = lataaja.getDbc() .executeQuery("select distinct Laskuttaja.yrityksenNimi, Laskuttaja.katuosoite,\n" + "Laskuttaja.postinumero, Laskuttaja.kaupunki, Lasku.paivays, Laskuttaja.alvTunniste,\n" + "Pankkiviivakoodi.erapaiva, Lasku.viivastyskorko, Pankkiviivakoodi.viiteTarkisteella,\n" + "T.nimi, Lasku.maksuehto, T.katuosoite, Laskuttaja.tilinumeronPankki,\n" + "T.postinumero, T.kaupunki, Laskuttaja.tilinumero, T.email, Laskuttaja.tilinumeronSwiftBic,\n" + "V.nimi, V.katuosoite, V.postinumero, V.kaupunki, V.email, Lasku.lisatiedot,\n" + "T.asiakasnumero, V.asiakasnumero, Laskuttaja.nimi, Laskuttaja.puhelinnumero,\n" + "Laskuttaja.sahkopostiOsoite, Pankkiviivakoodi.pankkiviivakoodi\n" + "from Lasku, Pankkiviivakoodi, Laskuttaja, Suorite, Asiakas T, Asiakas V\n" + "where Lasku.laskunNumero = " + laskunNumero + "\n" + "and Lasku.laskuttaja = Laskuttaja.yrityksenNimi\n" + "and Lasku.laskuttajanVersio = Laskuttaja.versio\n" + "and Lasku.pankkiviivakoodi = Pankkiviivakoodi.pankkiviivakoodi\n" + "and Lasku.laskunnumero = Suorite.lasku\n" + "and Suorite.tilaaja = T.asiakasnumero\n" + "and Suorite.tilaajanVersio = T.versio\n" + "and Suorite.vastaanottaja = V.asiakasnumero\n" + "and Suorite.vastaanottajanVersio = V.versio\n" + ""); rs.first(); table1.setTotalWidth(document.right(document.rightMargin()) - document.left(document.leftMargin())); table1.setLockedWidth(true); table1.setWidths(new int[] { 370, 100, 73, 100, 73, 100, 179 }); PdfPCell cell; Paragraph p; cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph(rs.getString(1), f4); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("LASKU", f4); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(7); p = new Paragraph(rs.getString(2), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph(rs.getString(3) + " " + rs.getString(4), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("Pivys", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph(pvmFormaatti1.format(pvmFormaatti3.parse(rs.getTimestamp(5).toString())), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("Laskun numero", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph(laskunNumero, f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph("Alv-tunniste: " + rs.getString(6), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("Erpiv", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph(pvmFormaatti1.format(pvmFormaatti4.parse(rs.getDate(7).toString())), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("Viivstyskorko", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph(Integer.toString(rs.getInt(8)) + ".0%", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); table1.completeRow(); //Jos vastaanottaja on sama kuin tilaaja ei laiteta erikseen vastaanottajan tietoja nkyville. if (rs.getInt(25) == rs.getInt(26)) { cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph(rs.getString(10), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("Viitenumero", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph(rs.getString(9), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph(rs.getString(12), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("Maksuehto", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph(rs.getString(11), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph(rs.getString(14) + " " + rs.getString(15), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("Pankki", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph(rs.getString(13), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph(rs.getString(17), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("Tilinumero", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph(rs.getString(16), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("Swift/BIC", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph(rs.getString(18), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(7); p = new Paragraph(" ", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(7); p = new Paragraph("Listiedot", f2); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(7); p = new Paragraph(rs.getString(24), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(7); p = new Paragraph(" ", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); table1.completeRow(); document.add(table1); } else { cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph("Palvelun tilaaja", f2); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("Viitenumero", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph(rs.getString(9), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph(rs.getString(10), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("Maksuehto", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph(rs.getString(11), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph(rs.getString(12), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("Pankki", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph(rs.getString(13), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph(rs.getString(14) + " " + rs.getString(15), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("Tilinumero", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph(rs.getString(16), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph(rs.getString(17), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("Swift/BIC", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph(rs.getString(18), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.LIGHT_GRAY); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(7); p = new Paragraph("Palvelun vastaanottaja", f2); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(7); p = new Paragraph(rs.getString(19), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(7); p = new Paragraph(rs.getString(20), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(7); p = new Paragraph(rs.getString(21) + " " + rs.getString(22), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(7); p = new Paragraph(rs.getString(23), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(7); p = new Paragraph("Listiedot", f2); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(7); p = new Paragraph(rs.getString(24), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); table1.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(7); p = new Paragraph(" ", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table1.addCell(cell); table1.completeRow(); document.add(table1); } // Otetaan alemmas tulevia tietoja talteen. String[] alasTulevatTiedot = new String[] { rs.getString(9), rs.getString(1), rs.getString(27), rs.getString(13), rs.getString(2), rs.getString(28), rs.getString(16), rs.getString(3) + " " + rs.getString(4), rs.getString(29), rs.getString(18), rs.getString(30), }; //Muodostetaan suoritteiden taulukko. PdfPTable table2 = new PdfPTable(7); table2.setWidths(new int[] { 370, 100, 73, 100, 73, 100, 179 }); table2.setTotalWidth(document.right(document.rightMargin()) - document.left(document.leftMargin())); table2.setLockedWidth(true); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph("Kuvaus", f2); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph("Mr", f2); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph("Yks.", f2); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(" hinta", f2); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph("Alv %", f2); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph("Alv ", f2); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph("Yhteens", f2); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorder(LEFT + BOTTOM + RIGHT + TOP); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table2.addCell(cell); table2.completeRow(); rs = lataaja.getDbc().executeQuery( "select distinct kuvaus, maara, maaranYksikot, aHintaVeroton, alvProsentti, ((alvProsentti / 100.0) * aHintaVeroton * maara) as alvEuroa,\n" + "((1.0 + alvProsentti / 100.0) * aHintaVeroton * maara) as yht, alkuaika\n" + "from Suorite\n" + "where lasku = " + laskunNumero + "\n" + ""); while (rs.next()) { cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(rs.getString(1) + " " + pvmFormaatti1.format(pvmFormaatti3.parse(rs.getTimestamp(8).toString())), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(LEFT + RIGHT); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(rs.getBigDecimal(2, 2).toString(), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(LEFT + RIGHT); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(rs.getString(3), f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(LEFT + RIGHT); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(rs.getBigDecimal(4, 2).toString() + "", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(LEFT + RIGHT); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(rs.getString(5) + "%", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(LEFT + RIGHT); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(rs.getBigDecimal(6, 2).toString() + "", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(LEFT + RIGHT); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(rs.getBigDecimal(7, 2).toString() + "", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(LEFT + RIGHT); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table2.addCell(cell); table2.completeRow(); } cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(7); p = new Paragraph(" ", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(TOP); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table2.addCell(cell); table2.completeRow(); rs = lataaja.getDbc().executeQuery( "select distinct sum(aHintaVeroton * maara), sum((alvProsentti / 100.0) * aHintaVeroton * maara)\n" + "from Suorite\n" + "where lasku = " + laskunNumero + "\n" + ""); rs.first(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph("Veroton hinta yhteens", f2); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(rs.getBigDecimal(1, 2).toString() + "", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table2.addCell(cell); table2.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph("Arvonlisvero yhteens", f2); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(rs.getBigDecimal(2, 2).toString() + "", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table2.addCell(cell); table2.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(7); p = new Paragraph(" ", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table2.addCell(cell); table2.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(4); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table2.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); p = new Paragraph("Yhteens", f3); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table2.addCell(cell); rs = lataaja.getDbc() .executeQuery("select laskunSumma\n" + "from Lasku, Pankkiviivakoodi\n" + "where laskunNumero = " + laskunNumero + "\n" + "and Lasku.pankkiviivakoodi = Pankkiviivakoodi.pankkiviivakoodi\n" + ""); rs.first(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(rs.getBigDecimal(1, 2).toString() + "", f3); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table2.addCell(cell); table2.completeRow(); document.add(table2); PdfPTable table3 = new PdfPTable(3); table3.setWidths(new int[] { 1, 1, 1 }); table3.setTotalWidth(document.right(document.rightMargin()) - document.left(document.leftMargin())); table3.setLockedWidth(true); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph("Pyydmme kyttmn maksaessanne viitenumeroa: " + alasTulevatTiedot[0], f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table3.addCell(cell); table3.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph(" ", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(BOTTOM); cell.setBorderColor(BaseColor.BLACK); cell.setBorderWidth(0.2f); table3.addCell(cell); table3.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(alasTulevatTiedot[1], f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table3.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(alasTulevatTiedot[2], f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table3.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(alasTulevatTiedot[3], f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table3.addCell(cell); table3.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(alasTulevatTiedot[4], f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table3.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(alasTulevatTiedot[5], f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table3.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(alasTulevatTiedot[6], f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table3.addCell(cell); table3.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(alasTulevatTiedot[7], f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table3.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(alasTulevatTiedot[8], f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table3.addCell(cell); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(1); p = new Paragraph(alasTulevatTiedot[9], f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table3.addCell(cell); table3.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph(" ", f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table3.addCell(cell); table3.completeRow(); cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(3); p = new Paragraph("Virtuaaliviivakoodi: " + alasTulevatTiedot[10], f1); p.setLeading(0, 1); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table3.addCell(cell); table3.completeRow(); table3.writeSelectedRows(0, -1, document.left(document.leftMargin()), table3.getTotalHeight() + document.bottom(document.bottomMargin()), writer.getDirectContent()); //---------------------------------------------------------------------- document.close(); }
From source file:support.plus.reportit.export.export_pdf_class.java
License:Open Source License
public PdfPTable createFirstTable(String filenumber, String filetag, String startdate, String enddate, String TextUserNameString, String TextUserNameBossString, String mondayText1, String mondayText2, String mondayText3, String mondayText4, String mondayText5, String mondayText6, String tuesdayText1, String tuesdayText2, String tuesdayText3, String tuesdayText4, String tuesdayText5, String tuesdayText6, String wednesdayText1, String wednesdayText2, String wednesdayText3, String wednesdayText4, String wednesdayText5, String wednesdayText6, String thursdayText1, String thursdayText2, String thursdayText3, String thursdayText4, String thursdayText5, String thursdayText6, String fridayText1, String fridayText2, String fridayText3, String fridayText4, String fridayText5, String fridayText6, String mondayTextTime1, String mondayTextTime2, String mondayTextTime3, String mondayTextTime4, String mondayTextTime5, String mondayTextTime6, String tuesdayTextTime1, String tuesdayTextTime2, String tuesdayTextTime3, String tuesdayTextTime4, String tuesdayTextTime5, String tuesdayTextTime6, String wednesdayTextTime1, String wednesdayTextTime2, String wednesdayTextTime3, String wednesdayTextTime4, String wednesdayTextTime5, String wednesdayTextTime6, String thursdayTextTime1, String thursdayTextTime2, String thursdayTextTime3, String thursdayTextTime4, String thursdayTextTime5, String thursdayTextTime6, String fridayTextTime1, String fridayTextTime2, String fridayTextTime3, String fridayTextTime4, String fridayTextTime5, String fridayTextTime6) { String mon = String.valueOf(context.getResources().getText(R.string.monday_short)); String tues = String.valueOf(context.getResources().getText(R.string.tuesday_short)); String wed = String.valueOf(context.getResources().getText(R.string.wednesday_short)); String thurs = String.valueOf(context.getResources().getText(R.string.thursday_short)); String fri = String.valueOf(context.getResources().getText(R.string.friday_short)); String hours = String.valueOf(context.getResources().getText(R.string.hours)); String day = String.valueOf(context.getResources().getText(R.string.day)); String reportNr = String.valueOf(context.getResources().getText(R.string.report_nr)); String weekFrom = String.valueOf(context.getResources().getText(R.string.weekFrom)); String weekTo = String.valueOf(context.getResources().getText(R.string.weekTo)); String firmName = String.valueOf(context.getResources().getText(R.string.firmName)); String instructorName = String.valueOf(context.getResources().getText(R.string.instructorName)); PdfPTable table = new PdfPTable(3); table.setWidthPercentage(450 / 5.23f); try {//from www.j a va 2 s. co m table.setWidths(new int[] { 1, 9, 1 }); } catch (DocumentException e) { e.printStackTrace(); } PdfPCell cell; Font fontbold = FontFactory.getFont("Times-Roman", 12, Font.BOLD); cell = new PdfPCell( new Phrase(reportNr + " " + filenumber + " " + weekFrom + " " + startdate + " " + weekTo + " " + enddate, fontbold)); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Phrase(firmName + " " + TextUserNameString + " " + instructorName + " " + TextUserNameBossString)); cell.setColspan(3); table.addCell(cell); table.addCell(day); cell = new PdfPCell(new Phrase(filetag)); cell.setColspan(1); table.addCell(cell); table.addCell(hours); table.addCell(mon); cell = new PdfPCell(new Phrase(mondayText1)); cell.setColspan(1); table.addCell(cell); table.addCell(mondayTextTime1); table.addCell(" "); cell = new PdfPCell(new Phrase(mondayText2)); cell.setColspan(1); table.addCell(cell); table.addCell(mondayTextTime2); table.addCell(" "); cell = new PdfPCell(new Phrase(mondayText3)); cell.setColspan(1); table.addCell(cell); table.addCell(mondayTextTime3); table.addCell(" "); cell = new PdfPCell(new Phrase(mondayText4)); cell.setColspan(1); table.addCell(cell); table.addCell(mondayTextTime4); table.addCell(" "); cell = new PdfPCell(new Phrase(mondayText5)); cell.setColspan(1); table.addCell(cell); table.addCell(mondayTextTime5); table.addCell(" "); cell = new PdfPCell(new Phrase(mondayText6)); cell.setColspan(1); table.addCell(cell); table.addCell(mondayTextTime6); table.addCell(tues); cell = new PdfPCell(new Phrase(tuesdayText1)); cell.setColspan(1); table.addCell(cell); table.addCell(tuesdayTextTime1); table.addCell(" "); cell = new PdfPCell(new Phrase(tuesdayText2)); cell.setColspan(1); table.addCell(cell); table.addCell(tuesdayTextTime2); table.addCell(" "); cell = new PdfPCell(new Phrase(tuesdayText3)); cell.setColspan(1); table.addCell(cell); table.addCell(tuesdayTextTime3); table.addCell(" "); cell = new PdfPCell(new Phrase(tuesdayText4)); cell.setColspan(1); table.addCell(cell); table.addCell(tuesdayTextTime4); table.addCell(" "); cell = new PdfPCell(new Phrase(tuesdayText5)); cell.setColspan(1); table.addCell(cell); table.addCell(tuesdayTextTime5); table.addCell(" "); cell = new PdfPCell(new Phrase(tuesdayText6)); cell.setColspan(1); table.addCell(cell); table.addCell(tuesdayTextTime6); table.addCell(wed); cell = new PdfPCell(new Phrase(wednesdayText1)); cell.setColspan(1); table.addCell(cell); table.addCell(wednesdayTextTime1); table.addCell(" "); cell = new PdfPCell(new Phrase(wednesdayText2)); cell.setColspan(1); table.addCell(cell); table.addCell(wednesdayTextTime2); table.addCell(" "); cell = new PdfPCell(new Phrase(wednesdayText3)); cell.setColspan(1); table.addCell(cell); table.addCell(wednesdayTextTime3); table.addCell(" "); cell = new PdfPCell(new Phrase(wednesdayText4)); cell.setColspan(1); table.addCell(cell); table.addCell(wednesdayTextTime4); table.addCell(" "); cell = new PdfPCell(new Phrase(wednesdayText5)); cell.setColspan(1); table.addCell(cell); table.addCell(wednesdayTextTime5); table.addCell(" "); cell = new PdfPCell(new Phrase(wednesdayText6)); cell.setColspan(1); table.addCell(cell); table.addCell(wednesdayTextTime6); table.addCell(thurs); cell = new PdfPCell(new Phrase(thursdayText1)); cell.setColspan(1); table.addCell(cell); table.addCell(thursdayTextTime1); table.addCell(" "); cell = new PdfPCell(new Phrase(thursdayText2)); cell.setColspan(1); table.addCell(cell); table.addCell(thursdayTextTime2); table.addCell(" "); cell = new PdfPCell(new Phrase(thursdayText3)); cell.setColspan(1); table.addCell(cell); table.addCell(thursdayTextTime3); table.addCell(" "); cell = new PdfPCell(new Phrase(thursdayText4)); cell.setColspan(1); table.addCell(cell); table.addCell(thursdayTextTime4); table.addCell(" "); cell = new PdfPCell(new Phrase(thursdayText5)); cell.setColspan(1); table.addCell(cell); table.addCell(thursdayTextTime5); table.addCell(" "); cell = new PdfPCell(new Phrase(thursdayText6)); cell.setColspan(1); table.addCell(cell); table.addCell(thursdayTextTime6); table.addCell(fri); cell = new PdfPCell(new Phrase(fridayText1)); cell.setColspan(1); table.addCell(cell); table.addCell(fridayTextTime1); table.addCell(" "); cell = new PdfPCell(new Phrase(fridayText2)); cell.setColspan(1); table.addCell(cell); table.addCell(fridayTextTime2); table.addCell(" "); cell = new PdfPCell(new Phrase(fridayText3)); cell.setColspan(1); table.addCell(cell); table.addCell(fridayTextTime3); table.addCell(" "); cell = new PdfPCell(new Phrase(fridayText4)); cell.setColspan(1); table.addCell(cell); table.addCell(fridayTextTime4); table.addCell(" "); cell = new PdfPCell(new Phrase(fridayText5)); cell.setColspan(1); table.addCell(cell); table.addCell(fridayTextTime5); table.addCell(" "); cell = new PdfPCell(new Phrase(fridayText6)); cell.setColspan(1); table.addCell(cell); table.addCell(fridayTextTime6); createSecondTable(); return table; }