Advertisement
Guest User

Untitled

a guest
May 20th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.26 KB | None | 0 0
  1.  PdfPTable table = new PdfPTable(6);
  2.         table.setWidthPercentage(100);
  3.        
  4.         PdfPCell cell;
  5.         cell = new PdfPCell (new Phrase ("prenom" ,FontFactory.getFont("Cosmic Sans Ms",12)));
  6.         cell.setHorizontalAlignement(Element.ALIGN_CENTER);
  7.         cell.setBackgroundColor(BaseColor .GRAY);
  8.         table.addcell(cell);
  9.        
  10.          cell = new PdfPCell (new Phrase ("nom" ,FontFactory.getFont("Cosmic Sans Ms",12)));
  11.         cell.setHorizontalAlignement(Element.ALIGN_CENTER);
  12.         cell.setBackgroundColor(BaseColor .GRAY);
  13.         table.addcell(cell);
  14.        
  15.          cell = new PdfPCell (new Phrase ("email" ,FontFactory.getFont("Cosmic Sans Ms",12)));
  16.         cell.setHorizontalAlignement(Element.ALIGN_CENTER);
  17.         cell.setBackgroundColor(BaseColor .GRAY);
  18.         table.addcell(cell);
  19.        
  20.          cell = new PdfPCell (new Phrase ("age" ,FontFactory.getFont("Cosmic Sans Ms",12)));
  21.         cell.setHorizontalAlignement(Element.ALIGN_CENTER);
  22.         cell.setBackgroundColor(BaseColor .GRAY);
  23.         table.addcell(cell);
  24.        
  25.          cell = new PdfPCell (new Phrase ("codepostal" ,FontFactory.getFont("Cosmic Sans Ms",12)));
  26.         cell.setHorizontalAlignement(Element.ALIGN_CENTER);
  27.         cell.setBackgroundColor(BaseColor .GRAY);
  28.         table.addcell(cell);
  29.        
  30.          cell = new PdfPCell (new Phrase ("adresse" ,FontFactory.getFont("Cosmic Sans Ms",12)));
  31.         cell.setHorizontalAlignement(Element.ALIGN_CENTER);
  32.         cell.setBackgroundColor(BaseColor .GRAY);
  33.         table.addcell(cell);
  34.        
  35.        
  36.        
  37.        
  38.        
  39.        
  40.        
  41.            cell = new PdfPCell (new Phrase (pfield.getText().toString(),FontFactory.getFont("Cosmic Sans Ms",12)));
  42.         cell.setHorizontalAlignement(Element.ALIGN_CENTER);
  43.         cell.setBackgroundColor(BaseColor .GRAY);
  44.         table.addcell(cell);
  45.        
  46.          cell = new PdfPCell (new Phrase (nfield.getText().toString(),FontFactory.getFont("Cosmic Sans Ms",12)));
  47.         cell.setHorizontalAlignement(Element.ALIGN_CENTER);
  48.         cell.setBackgroundColor(BaseColor .GRAY);
  49.         table.addcell(cell);
  50.        
  51.          cell = new PdfPCell (new Phrase (emailfield.getText().toString(),FontFactory.getFont("Cosmic Sans Ms",12)));
  52.         cell.setHorizontalAlignement(Element.ALIGN_CENTER);
  53.         cell.setBackgroundColor(BaseColor .GRAY);
  54.         table.addcell(cell);
  55.        
  56.          cell = new PdfPCell (new Phrase (agefield.getText().toString() ,FontFactory.getFont("Cosmic Sans Ms",12)));
  57.         cell.setHorizontalAlignement(Element.ALIGN_CENTER);
  58.         cell.setBackgroundColor(BaseColor .GRAY);
  59.         table.addcell(cell);
  60.        
  61.          cell = new PdfPCell (new Phrase (cpfield.getText().toString(),FontFactory.getFont("Cosmic Sans Ms",12)));
  62.         cell.setHorizontalAlignement(Element.ALIGN_CENTER);
  63.         cell.setBackgroundColor(BaseColor .GRAY);
  64.         table.addcell(cell);
  65.        
  66.          cell = new PdfPCell (new Phrase (adrfield.getText().toString(),FontFactory.getFont("Cosmic Sans Ms",12)));
  67.         cell.setHorizontalAlignement(Element.ALIGN_CENTER);
  68.         cell.setBackgroundColor(BaseColor .GRAY);
  69.         table.addcell(cell);      
  70.        
  71.         doc.add(table);
  72.         doc.close();
  73.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement