Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void addTable(Document document) throws DocumentException{
- String uno = "Cat1";
- String due = "Cat2";
- ArrayList<String> ChosenCategories = new ArrayList<String>();
- ChosenCategories.add(uno);
- ChosenCategories.add(due);
- int NumberOfCategories = ChosenCategories.size();
- int i = 0;
- for (i = 0; i < NumberOfCategories ; i++);
- document.add(new Paragraph(ChosenCategories.get(i)));
- createTable(document);
- }
- private static void createTable(Document document) throws DocumentException{
- PdfPTable table = new PdfPTable(3);
- PdfPCell c1 = new PdfPCell(new Phrase("Price"));
- c1.setHorizontalAlignment(Element.ALIGN_CENTER);
- table.addCell(c1);
- c1 = new PdfPCell(new Phrase("Date"));
- c1.setHorizontalAlignment(Element.ALIGN_CENTER);
- table.addCell(c1);
- c1 = new PdfPCell(new Phrase("Comment"));
- c1.setHorizontalAlignment(Element.ALIGN_CENTER);
- table.addCell(c1);
- int[] Prizes = new int[3];
- String[] Dates = new String[3];
- String[] Comments = new String[3];
- Prizes[0] = 11;
- Prizes[1] = 22;
- Prizes[2] = 33;
- Dates[0] = "date1";
- Dates[1] = "date2";
- Dates[2] = "date3";
- Comments[0] = "comment1";
- Comments[1] = "comment2";
- Comments[2] = "comment3";
- int x = 0;
- for(x = 0; x < Prizes.length; x++){
- table.addCell(toString(Prizes[x]));
- table.addCell("1.0");
- table.addCell("1.0");
- }
- table.addCell("1.0");
- document.add(table);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement