Eerder begon Peking ook al over de topic IText.
[rml][ Java] IText[/rml]
echter mij is het ook niet gelukt om een variabele uit te lezen
ik lees dus een JComboBox uit, uit een JPanel, echter bij de combobox selecteer ik iets anders dan chocolate maar toch krijg ik die op de pdf te zien, en de textfield geeft helemaal geen resultaat!?!?
ben ik nou kippig aan het worden, zie ik iets over het hoofd of is het gewoon een gebrek of bug in IText??
[rml][ Java] IText[/rml]
echter mij is het ook niet gelukt om een variabele uit te lezen
Java:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
| package kaleidoscope; import java.io.FileOutputStream; import java.io.IOException; import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.Paragraph; import com.lowagie.text.pdf.PdfPCell; import com.lowagie.text.pdf.PdfPTable; import com.lowagie.text.pdf.PdfWriter; import com.lowagie.text.Font; import com.lowagie.text.FontFactory; public class PDF { private OrderPaneelCons pnOrderPaneelCons; public PDF() { // step 1: creation of a document-object Document document = new Document(); try { pnOrderPaneelCons = new OrderPaneelCons(""); // step 2: // we create a writer that listens to the document // and directs a PDF-stream to a file PdfWriter.getInstance(document, new FileOutputStream("klantnummer.pdf")); // step 3: we open the document document.open(); float[] widths = {0.25f, 0.02f, 0.23f, 0.25f, 0.02f, 0.23f}; PdfPTable table = new PdfPTable(widths); PdfPCell cell = new PdfPCell(new Paragraph("Orderformulier Convertering")); cell.setColspan(6); table.addCell(cell); table.addCell("Klant"); table.addCell(":"); table.addCell( pnOrderPaneelCons.cmbKlant.getSelectedItem().toString() ); table.addCell("Ordernummer"); table.addCell(":"); table.addCell( pnOrderPaneelCons.tfOrderNr.getText() ); table.addCell("Artikelnr."); table.addCell(":"); table.addCell(""); table.addCell("Voorbereider"); table.addCell(":"); table.addCell(""); table.addCell("Aantal"); table.addCell(":"); table.addCell(""); table.addCell("Machine"); table.addCell(":"); table.addCell(""); table.addCell("L x B in CM"); table.addCell(":"); table.addCell(""); table.addCell("Omschrijving"); table.addCell(":"); table.addCell(""); table.addCell("Aantal Pallets"); table.addCell(":"); table.addCell(""); table.addCell("Koker"); table.addCell(":"); table.addCell(""); table.addCell("Inschiet"); table.addCell(":"); table.addCell(""); table.addCell("Doos"); table.addCell(":"); table.addCell(""); table.addCell("Formaat Doos"); table.addCell(":"); table.addCell(""); table.addCell("Aantal per doos"); table.addCell(":"); table.addCell(""); table.addCell("Soort Pallet"); table.addCell(":"); table.addCell(""); table.addCell("Aantal doos per pallet"); table.addCell(":"); table.addCell(""); table.addCell("Opslag"); table.addCell(":"); table.addCell(""); table.addCell("Leverdatum"); table.addCell(":"); table.addCell(""); table.addCell("Prodcutiedatum"); table.addCell(":"); table.addCell(""); table.addCell(""); table.addCell(""); table.addCell(""); document.add(table); document.add(new Paragraph("\n")); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } // step 5: we close the document document.close(); } } |
ik lees dus een JComboBox uit, uit een JPanel, echter bij de combobox selecteer ik iets anders dan chocolate maar toch krijg ik die op de pdf te zien, en de textfield geeft helemaal geen resultaat!?!?
ben ik nou kippig aan het worden, zie ik iets over het hoofd of is het gewoon een gebrek of bug in IText??