Examples of LwgPdfPTable


Examples of com.lowagie.text.pdf.LwgPdfPTable

        // TODO Auto-generated catch block
        e.printStackTrace();
      }
        }
        // does it have table info?
        LwgPdfPTable table = cell.getTable();
        if(table != null) {
          this.add(table);
//            try {
//        RtfBasicElement[] rtfElements = this.document.getMapper().mapElement(table);
//        for (int i = 0; i < rtfElements.length; i++) {
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

      PdfWriter.getInstance(document,
          new GfrFileOutputStream("com.lowagie.examples.objects.tables.TableSpacing.pdf"));
      // step3
      document.open();
      // step4
      LwgPdfPTable table = new LwgPdfPTable(3);
      LwgPdfPCell cell = new LwgPdfPCell(new Paragraph("header with colspan 3"));
      cell.setColspan(3);
      table.add(cell);
      table.add("1.1");
      table.add("2.1");
      table.add("3.1");
      table.add("1.2");
      table.add("2.2");
      table.add("3.2");
      cell = new LwgPdfPCell(new Paragraph("cell test1"));
      cell.setBorderColor(new Color(255, 0, 0));
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("cell test2"));
      cell.setColspan(2);
      cell.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0));
      table.add(cell);
      table.setWidthPercentage(50);
      document.add(new Paragraph("We add 2 tables:"));
      document.add(table);
      document.add(table);
      document.add(new Paragraph("They are glued to eachother"));
      document.add(table);
      document.add(new Paragraph("This is not very nice. Turn to the next page to see how we solved this"));
      document.newPage();
      document.add(new Paragraph("We add 2 tables, but with a certain 'SpacingBefore':"));
      table.setSpacingBefore(15f);
      document.add(table);
      document.add(table);
      document.add(new Paragraph("Unfortunately, there was no spacing after."));
      table.setSpacingAfter(15f);
      document.add(table);
      document.add(new Paragraph("This is much better, don't you think so?"));
    } catch (Exception de) {
      de.printStackTrace();
    }
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

      PdfWriter.getInstance(document,
          new GfrFileOutputStream("com.lowagie.examples.objects.tables.TableWidthAlignment.pdf"));
      // step3
      document.open();
      // step4
      LwgPdfPTable table = new LwgPdfPTable(3);
      LwgPdfPCell cell = new LwgPdfPCell(new Paragraph("header with colspan 3"));
      cell.setColspan(3);
      table.add(cell);
      table.add("1.1");
      table.add("2.1");
      table.add("3.1");
      table.add("1.2");
      table.add("2.2");
      table.add("3.2");
      cell = new LwgPdfPCell(new Paragraph("cell test1"));
      cell.setBorderColor(new Color(255, 0, 0));
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("cell test2"));
      cell.setColspan(2);
      cell.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0));
      table.add(cell);
      document.add(table);
      table.setWidthPercentage(100);
      document.add(table);
      table.setWidthPercentage(50);
      table.setHorizontalAlignment(LwgElement.ALIGN_RIGHT);
      document.add(table);
      table.setHorizontalAlignment(LwgElement.ALIGN_LEFT);
      document.add(table);
    } catch (Exception de) {
      de.printStackTrace();
    }
    // step5
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

                else
                    tb = DINGBATS_TABLE;
                BaseFont bf;
                bf = BaseFont.createFont(file, file, true);
                LwgFont f = new LwgFont(bf, 12);
                LwgPdfPTable table = new LwgPdfPTable(16);
                table.setWidthPercentage(100);
                table.getDefaultCell().setBorderWidth(1);
                table.getDefaultCell().setHorizontalAlignment(LwgElement.ALIGN_CENTER);
                for (int k = 0; k < tb.length; ++k) {
                    char c = tb[k];
                    if (bf.charExists(c)) {
                        LwgPhrase ph = new LwgPhrase(12, new String(new char[]{c}), f);
                        ph.add(new LwgPhrase(12, "\n\n" + cst(c), hex));
                        table.add(ph);
                    }
                    else {
                        LwgPhrase ph = new LwgPhrase("\u00a0");
                        ph.add(new LwgPhrase(12, "\n\n" + cst(c), hex));
                        table.add(ph);
                    }
                }
                document.add(table);
                document.newPage();
            }
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

      PdfWriter.getInstance(document,
          new GfrFileOutputStream("com.lowagie.examples.objects.tables.CellAlignment.pdf"));
      // step3
      document.open();
      // step4
      LwgPdfPTable table = new LwgPdfPTable(2);
      LwgPdfPCell cell;
      Paragraph p = new Paragraph("Quick brown fox jumps over the lazy dog. Quick brown fox jumps over the lazy dog.");
      table.add("default alignment");
      cell = new LwgPdfPCell(p);
      table.add(cell);
      table.add("centered alignment");
      cell = new LwgPdfPCell(p);
      cell.setHorizontalAlignment(LwgElement.ALIGN_CENTER);
      table.add(cell);
      table.add("right alignment");
      cell = new LwgPdfPCell(p);
      cell.setHorizontalAlignment(LwgElement.ALIGN_RIGHT);
      table.add(cell);
      table.add("justified alignment");
      cell = new LwgPdfPCell(p);
      cell.setHorizontalAlignment(LwgElement.ALIGN_JUSTIFIED);
      table.add(cell);
      table.add("blah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\n");
      table.getDefaultCell().setVerticalAlignment(LwgElement.ALIGN_BASELINE);
      table.add("baseline");
      table.add("blah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\n");
      table.getDefaultCell().setVerticalAlignment(LwgElement.ALIGN_BOTTOM);
      table.add("bottom");
      table.add("blah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\n");
      table.getDefaultCell().setVerticalAlignment(LwgElement.ALIGN_MIDDLE);
      table.add("middle");
      table.add("blah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\n");
      table.getDefaultCell().setVerticalAlignment(LwgElement.ALIGN_TOP);
      table.add("top");
      document.add(table);
    } catch (Exception de) {
      de.printStackTrace();
    }
    // step5
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

      String[] bogusData = { "M0065920", "SL", "FR86000P", "PCGOLD",
          "119000", "96 06", "2001-08-13", "4350", "6011648299",
          "FLFLMTGP", "153", "119000.00" };
      int NumColumns = 12;

      LwgPdfPTable datatable = new LwgPdfPTable(NumColumns);
      int headerwidths[] = { 9, 4, 8, 10, 8, 11, 9, 7, 9, 10, 4, 10 }; // percentage
      datatable.setWidths(headerwidths);
      datatable.setWidthPercentage(100); // percentage
      datatable.getDefaultCell().setPadding(3);
      datatable.getDefaultCell().setBorderWidth(2);
      datatable.getDefaultCell().setHorizontalAlignment(
          LwgElement.ALIGN_CENTER);
      datatable.add("Clock #");
      datatable.add("Trans Type");
      datatable.add("Cusip");
      datatable.add("Long Name");
      datatable.add("Quantity");
      datatable.add("Fraction Price");
      datatable.add("Settle Date");
      datatable.add("Portfolio");
      datatable.add("ADP Number");
      datatable.add("Account ID");
      datatable.add("Reg Rep ID");
      datatable.add("Amt To Go ");

      datatable.setHeaderRows(1); // this is the end of the table header

      datatable.getDefaultCell().setBorderWidth(1);
      for (int i = 1; i < 750; i++) {
        if (i % 2 == 1) {
          datatable.getDefaultCell().setGrayFill(0.9f);
        }
        for (int x = 0; x < NumColumns; x++) {
          datatable.add(bogusData[x]);
        }
        if (i % 2 == 1) {
          datatable.getDefaultCell().setGrayFill(1);
        }
      }
      document.add(datatable);
    } catch (Exception de) {
      de.printStackTrace();
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

      // step 3: we open the document
      document.open();
      LwgImage image = LwgImage.getInstance("otsoe.jpg");
      float[] widths = {1f, 4f};
      LwgPdfPTable table = new LwgPdfPTable(widths);
      table.add("This is my dog");
      table.add(image);
      table.add("This two");
      table.add(new LwgPdfPCell(image, true));
      table.add("This three");
      table.add(new LwgPdfPCell(image, false));
      document.add(table);
    } catch (DocumentException de) {
      System.err.println(de.getMessage());
    } catch (IOException ioe) {
      System.err.println(ioe.getMessage());
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

      PdfWriter.getInstance(document,
          new GfrFileOutputStream("com.lowagie.examples.objects.tables.CellColors.pdf"));
      // step3
      document.open();
      // step4
      LwgPdfPTable table = new LwgPdfPTable(4);
      LwgPdfPCell cell;
      cell = new LwgPdfPCell(new Paragraph("test colors:"));
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("red"));
      cell.setBorder(LwgRectangle.NO_BORDER);
      cell.setBackgroundColor(Color.red);
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("green"));
      cell.setBorder(LwgRectangle.BOTTOM);
      cell.setBorderColorBottom(Color.magenta);
      cell.setBorderWidthBottom(10f);
      cell.setBackgroundColor(Color.green);
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("blue"));
      cell.setBorder(LwgRectangle.TOP);
          cell.setUseBorderPadding(true);
      cell.setBorderWidthTop(5f);
      cell.setBorderColorTop(Color.cyan);
      cell.setBackgroundColor(Color.blue);
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("test GrayFill:"));
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("0.25"));
      cell.setBorder(LwgRectangle.NO_BORDER);
      cell.setGrayFill(0.25f);
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("0.5"));
      cell.setBorder(LwgRectangle.NO_BORDER);
      cell.setGrayFill(0.5f);
      table.add(cell);
      cell = new LwgPdfPCell(new Paragraph("0.75"));
      cell.setBorder(LwgRectangle.NO_BORDER);
      cell.setGrayFill(0.75f);
      table.add(cell);
      document.add(table);
    } catch (Exception de) {
      de.printStackTrace();
    }
    // step5
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

         document.add(pghTitleB);
        
         document.add(new Paragraph("\n\n", font9));

         LwgPdfPTable tableBeg = new LwgPdfPTable(3);
         tableBeg.setWidthPercentage(100);
         tableBeg.getDefaultCell().setHorizontalAlignment(LwgElement.ALIGN_LEFT);
         tableBeg.getDefaultCell().setVerticalAlignment(LwgElement.ALIGN_MIDDLE);


         tableBeg.add(new LwgPhrase("Contractor:", font9));
         tableBeg.add(new LwgPhrase("Job number:", font9));
         tableBeg.add(new LwgPhrase("Enclosure:", font9));

         document.add(tableBeg);


         float[] columnDefinitionSizePrj =
         {
            15f, 40f,
         };

         LwgPdfPTable tablePrj = new LwgPdfPTable(columnDefinitionSizePrj);
         tablePrj.setWidthPercentage(100);
         tablePrj.getDefaultCell().setHorizontalAlignment(LwgElement.ALIGN_LEFT);
         tablePrj.getDefaultCell().setVerticalAlignment(LwgElement.ALIGN_MIDDLE);

         tablePrj.add(new LwgPhrase("Client/name of project:", font9));
         tablePrj.add(new LwgPhrase("", font9));

         tablePrj.add(new LwgPhrase("Dynamic probing test NÂș:", font9));
         tablePrj.add(new LwgPhrase("", font9));

         tablePrj.add(new LwgPhrase("Date:", font9));
         tablePrj.add(new LwgPhrase("", font9));

         tablePrj.add(new LwgPhrase("Type of dynamic probing test:", font9));
         tablePrj.add(new LwgPhrase(strKind, font9));

         tablePrj.add(new LwgPhrase("Lost/fixed cone", font9));
         tablePrj.add(new LwgPhrase("Fixed/loose anvil", font9));



         document.add(tablePrj);

         float fltWidthDepth = 13f;
         float fltWidthBlowCount = 17f;

         float[] columnDefinitionSize =
         {
            fltWidthDepth, fltWidthBlowCount,
            fltWidthDepth, fltWidthBlowCount,
            fltWidthDepth, fltWidthBlowCount,
            fltWidthDepth, fltWidthBlowCount,
            fltWidthDepth, fltWidthBlowCount
         };

         LwgPdfPTable table = new LwgPdfPTable(columnDefinitionSize);

         table.setWidthPercentage(100);
         table.getDefaultCell().setHorizontalAlignment(LwgElement.ALIGN_CENTER);
         table.getDefaultCell().setVerticalAlignment(LwgElement.ALIGN_MIDDLE);



         String strNBlowcount = "N" + Integer.toString(intZStep);
         LwgPhrase phrDepth = new LwgPhrase("Depth (m)", font9);
         LwgPhrase phrBlowcount = new LwgPhrase(strNBlowcount, font9);
         LwgPhrase phrTorque = new LwgPhrase("Torque :", font9);


         //--
         for (int i = 0; i < 5; i++)
         {
            table.add(phrDepth);
            table.add(phrBlowcount);
         }



         int rowPack = (int) (100 / intZStep);

         for (int j = 0; j < rowPack; j++)
         {
            for (int i = 0; i < 5; i++)
            {
               double dblDepth = (double) (intZStep * (j + 1)) / 100d + (double) 2 * i;
               String strDepth = Double.toString(dblDepth);

               table.add(new LwgPhrase(strDepth, font9));
               table.add("");
            }
         }

         for (int i = 0; i < 5; i++)
         {
            table.add(phrTorque);
            table.add(new LwgPhrase("xxx Nm", font9));
         }

         for (int j = 0; j < rowPack; j++)
         {
            for (int i = 0; i < 5; i++)
            {
               double dblDepth = (double) (intZStep * (j + 1)) / 100d + (double) 2 * i + 1d;
               String strDepth = Double.toString(dblDepth);

               table.add(new LwgPhrase(strDepth, font9));
               table.add("");
            }
         }

         for (int i = 0; i < 5; i++)
         {
            table.add(phrTorque);
            table.add(new LwgPhrase("xxx Nm", font9));
         }


         document.add(table);

         String str = "\n"
                 + "Other dataName" + "\n" + "\n"
                 + "Groundwater: ....... m below starting point "
                 + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n"
                 + "\n" + "\n" + "\n" + "\n"
                 + "Name and signature of the operator in charge:" + "\n" + "\n";



         LwgPdfPTable tableEnd = new LwgPdfPTable(1);
         tableEnd.setWidthPercentage(100);
         tableEnd.add(new Paragraph(str, font9));

         document.add(tableEnd);



View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

            ct.setYLine(currentY);
            ct.addText(new Chunk("Key Data:", font14B));
            ct.go();
            currentY = ct.getYLine();
            currentY -= 4;
            LwgPdfPTable ptable = new LwgPdfPTable(2);
            ptable.getDefaultCell().setPaddingLeft(4);
            ptable.getDefaultCell().setPaddingTop(0);
            ptable.getDefaultCell().setPaddingBottom(4);
            ptable.add(new LwgPhrase("Imprint Name:", font9));
            ptable.add(new LwgPhrase("Prentice Hall", font9));
            ptable.add(new LwgPhrase("Series Name:", font9));
            ptable.add(new LwgPhrase("", font9));
            ptable.add(new LwgPhrase("ISBN:", font9));
            ptable.add(new LwgPhrase("Hall", font9));
            ptable.add(new LwgPhrase("UPC Code:", font9));
            ptable.add(new LwgPhrase("0789718103", font9));
            ptable.add(new LwgPhrase("EAN #", font9));
            ptable.add(new LwgPhrase("0786718103", font9));
            ptable.add(new LwgPhrase("Price:", font9));
            ptable.add(new LwgPhrase("49.99", font9));
            ptable.add(new LwgPhrase("Page Count:", font9));
            ptable.add(new LwgPhrase("500", font9));
            ptable.add(new LwgPhrase("Discount:", font9));
            ptable.add(new LwgPhrase("10%", font9));
            ptable.add(new LwgPhrase("Trim Size:", font9));
            ptable.add(new LwgPhrase("420x340", font9));
            ptable.add(new LwgPhrase("Cover:", font9));
            ptable.add(new LwgPhrase("Hard", font9));
            ptable.add(new LwgPhrase("Interior Color:", font9));
            ptable.add(new LwgPhrase("none", font9));
            ptable.add(new LwgPhrase("Media with book:", font9));
            ptable.add(new LwgPhrase("CD", font9));
            ptable.add(new LwgPhrase("Author(s):", font9));
            ptable.add(new LwgPhrase("Ben Forta", font9));
            ptable.add(new LwgPhrase("Editor:", font9));
            ptable.add(new LwgPhrase("Ben Forta", font9));
            ptable.add(new LwgPhrase("Pub Date:", font9));
            ptable.add(new LwgPhrase("06/05/1998", font9));
            ptable.setTotalWidth(columnWidth);

            currentY = ptable.writeSelectedRows(0, -1, document.left(), currentY, cb) - 20;
            for (int k = 0; k < headings.length; ++k) {
                ct.addText(new Chunk(headings[k] + "\n", font14B));
                ct.addText(new Chunk(texts[k] + "\n\n", font11));
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.