Non puoi utilizzare iReports cosi' ti disegni il template e via JAVA code gli carichi i dati dentro ?
cmq guarda se ti puo' tornare utile:
package com.school.reports;
import java.awt.Color;
import java.io.File;
import java.io.FileOutputStream;
import javax.servlet.http.HttpServletRequest;
import com.lowagie.text.Document;
import com.lowagie.text.Font;
import com.lowagie.text.PageSize;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfWriter;
import com.school.dataproviders.TSchoolScuole;
public class ProtocolloReport extends BaseReport {
protected final static int MAX_ENTRIES_PER_PAGE = 6;
protected int numEntries;
public void addEntry(ProtocolloEntry protocolloEntry) throws Exception {
appendEntry(protocolloEntry);
numEntries++;
}
private void appendEntry(ProtocolloEntry protocolloEntry) throws Exception {
int i = 0;
String helperString = null;
// Documenti ricevuti top
if (numEntries == MAX_ENTRIES_PER_PAGE) {
numEntries = 0;
document.newPage();
appendEntry(protocolloEntry);
return;
}
float tableTop = 0;
if (numEntries == 0) {
tableTop = Commons.tableHeaderTop - 70 + Commons.singleLineContainer;
}
else {
tableTop = Commons.tableHeaderTop - ( (numEntries+1) * (70 - Commons.singleLineContainer));
}
float tableBottom = tableTop - 70;
//cb.moveTo(Commons.tableHeaderX + 50, tableTop);
//cb.lineTo(PageSize.A4.top() - Commons.tableHeaderX - 50, tableTop);
//addCenteredText(Commons.tableHeaderX + 50, tableTop, PageSize.A4.top() / 2, tableTop - Commons.singleLineContainer, protocolloEntry.partenza.);
// Numero protocollo sx right
// impostiamo lo spessore delle linee
cb.setLineWidth(0.5f);
cb.moveTo(Commons.tableHeaderX+50, tableTop - Commons.singleLineContainer);
cb.lineTo(Commons.tableHeaderX + 50, tableBottom);
float top = PageSize.A4.top();
// Numero protocollo dx left
cb.moveTo(top - Commons.tableHeaderX - 50, tableTop - Commons.singleLineContainer);
cb.lineTo(top - Commons.tableHeaderX - 50, tableBottom);
//addCenteredText(PageSize.A4.top() / 2, tableTop, PageSize.A4.top() - 60, tableTop - Commons.singleLineContainer, "Documenti Spediti (Uscita)");
// Note bottom
// ricordarsi di fare stroke prima di cambiare le impostazioni, così disegna sul pdf tutto quello che gli abbiamo detto dall'ultimo stroke
cb.stroke();
cb.setLineWidth(1.2f);
cb.moveTo(Commons.tableHeaderX+50, tableBottom);
cb.lineTo(top - Commons.tableHeaderX-50, tableBottom);
cb.moveTo(Commons.tableHeaderX+50, tableTop - Commons.singleLineContainer);
// Numero protocollo sx top
//cb.lineTo(Commons.tableHeaderX, tableTop - Commons.singleLineContainer);
cb.moveTo(Commons.tableHeaderX, tableTop - Commons.singleLineContainer);
// Numero protocollo sx left
cb.lineTo(Commons.tableHeaderX, tableBottom);
// Numero protocollo sx bottom
cb.lineTo(Commons.tableHeaderX + 50, tableBottom);
cb.moveTo(top - Commons.tableHeaderX-50, tableTop - Commons.singleLineContainer);
// Numero protocollo dx top
//cb.lineTo(top - Commons.tableHeaderX, tableTop - Commons.singleLineContainer);
cb.moveTo(top - Commons.tableHeaderX, tableTop - Commons.singleLineContainer);
// Numero protocollo dx right
cb.lineTo(top - Commons.tableHeaderX, tableBottom);
// Numero protocollo dx bottom
cb.lineTo(top - Commons.tableHeaderX -50, tableBottom);
cb.stroke();
cb.setLineWidth(0.5f);
// Documenti ricevuti e spediti bottom
//cb.moveTo(Commons.tableHeaderX+50, tableTop - Commons.singleLineContainer);
//cb.lineTo(top - Commons.tableHeaderX - 50, tableTop - Commons.singleLineContainer);
// Separatore tra Documenti ricevuti e Documenti spediti
cb.moveTo(top / 2, tableTop - Commons.singleLineContainer);
cb.lineTo(top / 2, tableBottom);
// Note top
cb.moveTo(Commons.tableHeaderX + 50, tableBottom + Commons.singleLineContainer);
cb.lineTo(top - Commons.tableHeaderX - 50, tableBottom + Commons.singleLineContainer);
// Data titolario allegati sx right
// cb.moveTo(Commons.tableHeaderX + 50 + 60, tableTop - Commons.singleLineContainer);
// cb.lineTo(Commons.tableHeaderX + 50 + 60, tableBottom+ 2* Commons.singleLineContainer);
// Data/N. Protocollo di Partenza | Spese | Soggetti | sx --> top
cb.moveTo(Commons.tableHeaderX + 50, tableBottom + 2 * Commons.singleLineContainer);
cb.lineTo((top / 2)-80, tableBottom + 2 * Commons.singleLineContainer);
cb.lineTo((top / 2) -80, tableTop - Commons.singleLineContainer);
// Data Titolario Allegati dx right
// cb.moveTo((top / 2) + 60, tableTop - Commons.singleLineContainer);
// cb.lineTo((top / 2) + 60, tableBottom + 2*Commons.singleLineContainer);
// Data/N. Protocollo di Partenza | Spese | Soggetti | dx --> top
cb.moveTo(top / 2, tableBottom + 2*Commons.singleLineContainer);
cb.lineTo(top - Commons.tableHeaderX - 50 - 80, tableBottom + 2*Commons.singleLineContainer);
cb.lineTo(top - Commons.tableHeaderX - 50 - 80, tableTop - Commons.singleLineContainer);
// Soggetti sx right
cb.moveTo((top / 2)-80, tableBottom + 2*Commons.singleLineContainer);
cb.lineTo((top / 2)-80, tableBottom + Commons.singleLineContainer);
// Soggetti dx right
cb.moveTo(top - Commons.tableHeaderX - 50 - 80, tableBottom + 2*Commons.singleLineContainer);
cb.lineTo(top - Commons.tableHeaderX - 50 - 80, tableBottom + Commons.singleLineContainer);
//Mittente destinatario sx right
cb.moveTo(((top / 2) + Commons.tableHeaderX + 50 ) /2 - 50, tableTop - Commons.singleLineContainer);
cb.lineTo(((top / 2) + Commons.tableHeaderX + 50 ) /2 - 50, tableBottom +2 * Commons.singleLineContainer);
//Spese sx right
cb.moveTo(((top / 2) + Commons.tableHeaderX + 50 ) /2 , tableBottom +2 * Commons.singleLineContainer);
cb.lineTo(((top / 2) + Commons.tableHeaderX + 50 ) /2 , tableBottom + Commons.singleLineContainer);
// Mittente / Destinatario dx right
cb.moveTo((top / 2 +((top / 2) - Commons.tableHeaderX - 50 ) /2) - 50, tableTop - Commons.singleLineContainer);
cb.lineTo((top / 2 +((top / 2) - Commons.tableHeaderX - 50 ) /2) - 50, tableBottom +2* Commons.singleLineContainer);
// spese dx right
cb.moveTo(top / 2 +((top / 2) - Commons.tableHeaderX - 50 ) /2, tableBottom +2* Commons.singleLineContainer);
cb.lineTo(top / 2 +((top / 2) - Commons.tableHeaderX - 50) /2, tableBottom + Commons.singleLineContainer);
// Spese sx left
cb.moveTo(((top / 2) + Commons.tableHeaderX + 50 ) /2 - 50, tableBottom + 2*Commons.singleLineContainer);
cb.lineTo(((top / 2) + Commons.tableHeaderX + 50 ) /2 - 50, tableBottom + Commons.singleLineContainer );
// Spese dx left
cb.moveTo((top / 2 +((top / 2) - Commons.tableHeaderX - 50 ) /2) - 50, tableBottom +2* Commons.singleLineContainer);
cb.lineTo((top / 2 +((top / 2) - Commons.tableHeaderX - 50 ) /2) - 50, tableBottom + Commons.singleLineContainer);
cb.stroke();
Color rispostaColor = new Color(0,0,0);
Color partenzaColor = new Color(0,0,0);
if (protocolloEntry.getRisposta().getStato().equals("0")) {
rispostaColor = new Color(255, 0, 0);
}
if (protocolloEntry.getPartenza().getStato().equals("0")) {
partenzaColor = new Color(255, 0, 0);
}
//addCenteredText(PageSize.A4.top() - Commons.tableHeaderX - 50, tableTop - 2*Commons.singleLine, PageSize.A4.top() - Commons.tableHeaderX, tableTop - 3*Commons.singleLine, "Numero");
Commons.addCenteredText(cb, helv, 12, top - Commons.tableHeaderX - 50, tableTop - Commons.singleLineContainer - 10 , top - Commons.tableHeaderX, tableTop - 2*Commons.singleLine, rispostaColor, protocolloEntry.getRisposta().getCdNumero());
Commons.addCenteredText(cb, helv, top - Commons.tableHeaderX - 50, tableTop - 3*Commons.singleLineContainer, top - Commons.tableHeaderX, tableTop - 4*Commons.singleLine, rispostaColor, protocolloEntry.getRisposta().getTitolario());
Commons.addCenteredText(cb, helv, top - Commons.tableHeaderX - 50, tableTop - 5*Commons.singleLineContainer, top - Commons.tableHeaderX, tableTop - 6*Commons.singleLine, rispostaColor, protocolloEntry.getRisposta().getDtData());
// Commons.addCenteredText(cb, helv, Commons.tableHeaderX, tableTop - 2*Commons.singleLine, Commons.tableHeaderX + 50, tableTop -3 *Commons.singleLine, "Numer");
Commons.addCenteredText(cb, helv, 12, Commons.tableHeaderX, tableTop - Commons.singleLineContainer -10, Commons.tableHeaderX + 50, tableTop - 2 * Commons.singleLine, partenzaColor, protocolloEntry.getPartenza().getCdNumero());
Commons.addCenteredText(cb, helv, Commons.tableHeaderX, tableTop - 3 *Commons.singleLineContainer, Commons.tableHeaderX + 50, tableTop - 4 * Commons.singleLine, partenzaColor, protocolloEntry.getPartenza().getTitolario());
Commons.addCenteredText(cb, helv, Commons.tableHeaderX, tableTop - 5 *Commons.singleLineContainer, Commons.tableHeaderX + 50, tableTop - 6 * Commons.singleLine, partenzaColor, protocolloEntry.getPartenza().getDtData());
helperString = new String(protocolloEntry.getPartenza().getProtocolloPartenzaData());
if (helperString.length() > 0) helperString +=" / ";
Commons.addCenteredText(cb, helv, Commons.tableHeaderX + 50, tableBottom + 2*Commons.singleLineContainer, ((top / 2)+ Commons.tableHeaderX + 50 ) /2-50, tableBottom+Commons.singleLineContainer, partenzaColor, helperString+protocolloEntry.getPartenza().getProtocolloPartenza());
Commons.addCenteredText(cb, helv, ((top / 2)+ Commons.tableHeaderX + 50 ) /2-50, tableBottom + 2*Commons.singleLineContainer, ((top / 2) + Commons.tableHeaderX + 50 ) /2 , tableBottom + Commons.singleLineContainer, partenzaColor, protocolloEntry.getPartenza().getSpese());
// qui ci andrebbero i soggetti
Commons.addCenteredText(cb, helv, ((top / 2)+ Commons.tableHeaderX + 50 ) /2 , tableBottom + 2*Commons.singleLineContainer, (top / 2)-80, tableBottom + Commons.singleLineContainer, "");
// data sx
//Commons.addCenteredText(cb, helv, Commons.tableHeaderX + 50, tableTop - Commons.singleLineContainer - Commons.singleLine, Commons.tableHeaderX + 50 + 60, tableTop - Commons.singleLineContainer, partenzaColor, protocolloEntry.getPartenza().getDtData());
//Commons.addCenteredText(cb, helv, Commons.tableHeaderX + 50, tableTop -Commons.singleLineContainer - Commons.singleLine, Commons.tableHeaderX + 50 + 60, tableTop -Commons.singleLineContainer - 2* Commons.singleLine, partenzaColor, protocolloEntry.getPartenza().getTitolario());
// Commons.addCenteredText(cb, helv, Commons.tableHeaderX + 50, tableTop -Commons.singleLineContainer - 2* Commons.singleLine, Commons.tableHeaderX + 50 + 60, tableTop -Commons.singleLineContainer - 3* Commons.singleLine, partenzaColor, protocolloEntry.getPartenza().getAllegati());
// data dx
//Commons.addCenteredText(cb, helv, (top / 2) , tableTop -Commons.singleLineContainer -Commons.singleLine, (top / 2) + 60, tableTop -Commons.singleLineContainer, rispostaColor, protocolloEntry.getRisposta().getDtData());
//Commons.addCenteredText(cb, helv, (top / 2) , tableTop -Commons.singleLineContainer - Commons.singleLine, (top / 2) + 60, tableTop -Commons.singleLineContainer - 2* Commons.singleLine, rispostaColor, protocolloEntry.getRisposta().getTitolario());
// Commons.addCenteredText(cb, helv, (top / 2) , tableTop -Commons.singleLineContainer - 2* Commons.singleLine, (top / 2) + 60, tableTop -Commons.singleLineContainer - 3* Commons.singleLine, rispostaColor, protocolloEntry.getRisposta().getAllegati());
// for (i=0; i < protocolloEntry.getPartenza().getBeneficiari().length && i < 3; i++) {
// //Commons.addCenteredText(cb, helv, Commons.tableHeaderX + 50 + 60, tableTop -Commons.singleLineContainer + (i>0 ? ( (i-1) * Commons.singleLineContainer ): 0), ((top / 2) + Commons.tableHeaderX + 50 ) /2 , tableBottom + 2 *Commons.singleLineContainer + (i * Commons.singleLineContainer), protocolloEntry.getPartenza().getBeneficiari());
// Commons.addTextWithLength(cb, helv,
// Commons.tableHeaderX + 50 + 62,
// tableTop - 2* Commons.singleLine - (i * Commons.singleLine),
// 100,
// protocolloEntry.getPartenza().getBeneficiari());
// }
// Mittente sx
if (protocolloEntry.getPartenza().getBeneficiari().length > 0) {
Commons.addTextWithLength(cb, helv,
//Commons.tableHeaderX + 50 + 62, tableTop - 2* Commons.singleLine,
Commons.tableHeaderX + 52 , tableTop - 2 * Commons.singleLine,
110,
partenzaColor,
//protocolloEntry.getPartenza().getBeneficiari()[0] + (protocolloEntry.getPartenza().getBeneficiari().length > 0 ? " *": ""));
protocolloEntry.getPartenza().getBeneficiari()[0]);
Commons.addTextWithLength(cb, helv,
Commons.tableHeaderX + 52,
tableTop - 3* Commons.singleLine,
110,
partenzaColor,
protocolloEntry.getPartenza().getBeneficiarioIndirizzo());
Commons.addTextWithLength(cb, helv,
Commons.tableHeaderX + 52,
tableTop - 4* Commons.singleLine,
110,
partenzaColor,
protocolloEntry.getPartenza().getBeneficiarioComuneCap());
}
helperString = protocolloEntry.getPartenza().getDescrizione();
Commons.addMultilineText(cb, helv, Commons.singleLine,
((top / 2) + Commons.tableHeaderX + 50 ) /2 - 50 - 2, tableTop -Commons.singleLineContainer,
(top / 2) - 80, tableBottom + 2 *Commons.singleLineContainer ,partenzaColor, helperString);
//Commons.addCenteredText(cb, helv, ((top / 2) + Commons.tableHeaderX + 50 ) /2 , tableTop -Commons.singleLineContainer, (top / 2) - 60, tableBottom + Commons.singleLineContainer , protocolloEntry.getPartenza().getOggettoDescrizione());
helperString = protocolloEntry.getPartenza().getOggettoDeBreve();
if (helperString.length() > 0 && protocolloEntry.getPartenza().getNumeroRiferimento().length() > 0)
helperString += ": ";
if (protocolloEntry.getPartenza().getNumeroRiferimento().length() > 0)
helperString += protocolloEntry.getPartenza().getNumeroRiferimento();
Commons.addCenteredText(cb, helv, (PageSize.A4.top() / 2) - 80,
tableTop -Commons.singleLineContainer - Commons.singleLine,
PageSize.A4.top() / 2,
tableTop -Commons.singleLineContainer - 2*Commons.singleLine,
partenzaColor,
//protocolloEntry.getPartenza().getOggettoDescrizione());
protocolloEntry.getPartenza().getProtocolloEsterno());
Commons.addCenteredText(cb, helv, (PageSize.A4.top() / 2) - 80,
tableTop -Commons.singleLineContainer - 2*Commons.singleLine,
PageSize.A4.top() / 2,
tableTop -Commons.singleLineContainer - 3 *Commons.singleLine,
partenzaColor, helperString);
// Commons.addCenteredText(cb, helv, (top / 2) -60,
// tableTop - Commons.singleLineContainer - 2*Commons.singleLine,
// top / 2, tableTop -Commons.singleLineContainer - 3*Commons.singleLine,
// partenzaColor, protocolloEntry.getPartenza().getNumeroRiferimento());
Commons.addCenteredText(cb, helv, (top / 2)- 80,
tableTop - Commons.singleLineContainer - 3*Commons.singleLine,
top / 2, tableTop -Commons.singleLineContainer - 4*Commons.singleLine,
protocolloEntry.getPartenza().getDataRiferimento());
// Commons.addCenteredText(cb, helv, (PageSize.A4.top() / 2) - 60, tableTop -Commons.singleLineContainer - Commons.singleLine, PageSize.A4.top() / 2, tableTop -Commons.singleLineContainer - Commons.singleLine, partenzaColor, protocolloEntry.getPartenza().getNumeroRiferimento());
// Commons.addCenteredText(cb, helv, (top / 2) -60, tableTop - Commons.singleLineContainer - 2*Commons.singleLine, top / 2, tableTop -Commons.singleLineContainer - 3*Commons.singleLine, partenzaColor, protocolloEntry.getPartenza().getDataRiferimento());
//Commons.addCenteredText(cb, helv, (top / 2)-60, tableTop - Commons.singleLineContainer - 3*Commons.singleLine, top / 2, tableTop -Commons.singleLineContainer - 4*Commons.singleLine, protocolloEntry.getPartenza().getCdNumero());
// for (i=0; i < protocolloEntry.getRisposta().getBeneficiari().length && i < 3; i++) {
// //Commons.addCenteredText(cb, helv, (top / 2) + 60, tableTop -Commons.singleLineContainer + (i>0 ? ( (i-1) * Commons.singleLineContainer ): 0), top / 2 +((top / 2) - Commons.tableHeaderX - 50 ) /2, tableBottom + 2 *Commons.singleLineContainer + (i*Commons.singleLineContainer), protocolloEntry.getRisposta().getBeneficiari());
// Commons.addTextWithLength(cb, helv,
// (top / 2) + 62,
// tableTop - 2*Commons.singleLine - (i*Commons.singleLine),
// 100,
// protocolloEntry.getRisposta().getBeneficiari());
// }
// Mittenti beneficiari dx
if (protocolloEntry.getRisposta().getBeneficiari().length > 0) {
Commons.addTextWithLength(cb, helv,
(top / 2) + 2,
tableTop - 2*Commons.singleLine,
110,
rispostaColor,
//protocolloEntry.getRisposta().getBeneficiari()+ (protocolloEntry.getRisposta().getBeneficiari().length > 1 ? " *": ""));
protocolloEntry.getRisposta().getBeneficiari()
);
Commons.addTextWithLength(cb, helv,
(top / 2) + 2,
tableTop - 3*Commons.singleLine,
110,
rispostaColor,
protocolloEntry.getRisposta().getBeneficiarioIndirizzo()
);
Commons.addTextWithLength(cb, helv,
(top / 2) + 2,
tableTop - 4*Commons.singleLine,
110,
rispostaColor,
protocolloEntry.getRisposta().getBeneficiarioComuneCap()
);
}
// helperString = new String();
// if (protocolloEntry.getRisposta().getOggetto().length() > 0) {
// helperString = protocolloEntry.getRisposta().getOggetto();
// }
// if (protocolloEntry.getRisposta().getDescrizione().length() > 0) {
// if (helperString.length() > 0) helperString = helperString.concat(": ");
// helperString = helperString.concat(protocolloEntry.getRisposta().getDescrizione());
// }
helperString = protocolloEntry.getRisposta().getDescrizione();
Commons.addMultilineText(cb, helv, Commons.singleLine,
//top / 2 +((top / 2)- Commons.tableHeaderX - 50 ) /2, tableTop -Commons.singleLineContainer,
(top / 2 +((top / 2) - Commons.tableHeaderX - 50 ) /2) - 50 -2, tableTop -Commons.singleLineContainer,
top - Commons.tableHeaderX - 50 - 80, tableBottom + 2 *Commons.singleLineContainer,
rispostaColor, helperString);
//Commons.addCenteredText(cb, helv, top / 2 + ((top /2) -Commons.tableHeaderX - 50) /2, tableTop - Commons.singleLineContainer, top - Commons.tableHeaderX - 50 - 60, tableBottom + 2 *Commons.singleLineContainer, protocolloEntry.getRisposta().getOggettoDescrizione());
helperString = protocolloEntry.getRisposta().getOggettoDeBreve();
if (helperString.length() > 0 && protocolloEntry.getRisposta().getNumeroRiferimento().length() > 0)
helperString += ": ";
if (protocolloEntry.getRisposta().getNumeroRiferimento().length() > 0)
helperString += protocolloEntry.getRisposta().getNumeroRiferimento();
Commons.addCenteredText(cb, helv,
PageSize.A4.top() - Commons.tableHeaderX - 50 -80,
tableTop -Commons.singleLineContainer -Commons.singleLine,
PageSize.A4.top() - Commons.tableHeaderX - 50,
tableTop -Commons.singleLineContainer - 2*Commons.singleLine,
rispostaColor,
//protocolloEntry.getRisposta().getOggettoDescrizione());
protocolloEntry.getRisposta().getProtocolloEsterno());
Commons.addCenteredText(cb, helv,
PageSize.A4.top() - Commons.tableHeaderX - 50 -80,
tableTop -Commons.singleLineContainer - 2*Commons.singleLine,
PageSize.A4.top() - Commons.tableHeaderX - 50,
tableTop -Commons.singleLineContainer - 3*Commons.singleLine,
rispostaColor, helperString);
// Commons.addCenteredText(cb, helv, top - Commons.tableHeaderX - 50 -60,
// tableTop -Commons.singleLineContainer - 2*Commons.singleLine,
// top- Commons.tableHeaderX - 50,
// tableTop -Commons.singleLineContainer - 3*Commons.singleLine,
// rispostaColor, protocolloEntry.getRisposta().getNumeroRiferimento());
Commons.addCenteredText(cb, helv,
top - Commons.tableHeaderX - 50 -80,
tableTop -Commons.singleLineContainer - 3*Commons.singleLine,
top - Commons.tableHeaderX - 50,
tableTop -Commons.singleLineContainer - 4*Commons.singleLine,
protocolloEntry.getRisposta().getDataRiferimento());
// Commons.addCenteredText(cb, helv, PageSize.A4.top() - Commons.tableHeaderX - 50 -60, tableTop -Commons.singleLineContainer - Commons.singleLine, PageSize.A4.top() - Commons.tableHeaderX - 50, tableTop -Commons.singleLineContainer - Commons.singleLine, rispostaColor, protocolloEntry.getRisposta().getNumeroRiferimento());
// Commons.addCenteredText(cb, helv, top - Commons.tableHeaderX - 50 -60, tableTop -Commons.singleLineContainer - 2*Commons.singleLine, top- Commons.tableHeaderX - 50, tableTop -Commons.singleLineContainer - 3*Commons.singleLine, rispostaColor, protocolloEntry.getRisposta().getDataRiferimento());
//Commons.addCenteredText(cb, helv, top - Commons.tableHeaderX - 50 -60, tableTop -Commons.singleLineContainer - 3*Commons.singleLine, top - Commons.tableHeaderX - 50, tableTop -Commons.singleLineContainer - 4*Commons.singleLine, protocolloEntry.getRisposta().getCdNumero());
helperString = new String(protocolloEntry.getRisposta().getProtocolloPartenzaData());
if (helperString.length() > 0) helperString += " / ";
Commons.addCenteredText(cb, helv, top / 2, tableBottom + 2*Commons.singleLineContainer, (top / 2 +((top / 2) - Commons.tableHeaderX - 50 ) /2) - 50, tableBottom +Commons.singleLineContainer, rispostaColor, helperString+protocolloEntry.getRisposta().getProtocolloPartenza());
Commons.addCenteredText(cb, helv, (top / 2 +((top / 2) - Commons.tableHeaderX - 50 ) /2) - 50, tableBottom +2*Commons.singleLineContainer, top / 2 +((top / 2) - Commons.tableHeaderX - 50) /2, tableBottom +Commons.singleLineContainer, rispostaColor, protocolloEntry.getRisposta().getSpese());
// qui ci andrebbero i soggetti
Commons.addCenteredText(cb, helv, top / 2 +((top / 2) - Commons.tableHeaderX - 50) /2, tableBottom +2*Commons.singleLineContainer, top - Commons.tableHeaderX - 50 - 80, tableBottom +Commons.singleLineContainer, "" );
Commons.addCenteredText(cb, helv, Commons.tableHeaderX + 50, tableBottom +Commons.singleLineContainer, top / 2, tableBottom, partenzaColor, protocolloEntry.getPartenza().getNote());
Commons.addCenteredText(cb, helv, top / 2, tableBottom +Commons.singleLineContainer, top - Commons.tableHeaderX - 50, tableBottom, rispostaColor, protocolloEntry.getRisposta().getNote());
}
public ProtocolloReport(HttpServletRequest request, TSchoolScuole scuola) throws Exception {
super(request, scuola);
try {
numEntries = 0;
document = new Document(PageSize.A4.rotate());
helv = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, false);
//stringBufferWriter = new StringBufferWriter();
//writer = PdfWriter.getInstance(document, stringBufferWriter);
tmpfile = File.createTempFile("ProtoWeb", "pdf");
tmpfile.deleteOnExit();
writer = PdfWriter.getInstance(document, new FileOutputStream(tmpfile));
writer.setPageEvent(new ProtocolloEventHelper(this.path, scuola));
document.open();
cb = writer.getDirectContent();
}
catch (Exception e) {
e.printStackTrace();
throw e;
}
}
// public static void main(String[] args) throws Exception {
//
// ProtocolloReport pr = new ProtocolloReport();
// Protocollo entrata = new Protocollo();
// entrata.setAllegati("Allegato 1");
// entrata.setBeneficiari("Beneficiario 1");
// entrata.setCdAnno("Anno1");
// entrata.setCdNumero("cdNumero1");
// entrata.setDescrizione("Descrizione1");
// entrata.setDeTipo("tipo1");
// entrata.setDtData("data1");
// entrata.setOggetto("Oggetto1");
// entrata.setProtocolloPartenza("10000");
// entrata.setProtocolloPartenzaData("00/00/0000");
// entrata.setTitolario("Titolario1");
// entrata.setSpese("1000");
//
// Protocollo risposta = new Protocollo();
// risposta.setAllegati("Allegato 2");
// risposta.setBeneficiari("Beneficiario 2");
// risposta.setCdAnno("Anno2");
// risposta.setCdNumero("cdNumero2");
// risposta.setDescrizione("Descrizione2");
// risposta.setDeTipo("tipo2");
// risposta.setDtData("data2");
// risposta.setOggetto("Oggetto2");
// risposta.setProtocolloPartenza("20000");
// risposta.setProtocolloPartenzaData("22/22/2222");
// risposta.setTitolario("Titolario2");
// risposta.setSpese("0,5");
//
// ProtocolloEntry entry1 = new ProtocolloEntry();
// entry1.setPartenza(entrata);
// entry1.setRisposta(risposta);
//
// ProtocolloEntry entry2 = new ProtocolloEntry();
// entry2.setPartenza(entrata);
// entry2.setRisposta(risposta);
//
// pr.addEntry(entry1);
// pr.addEntry(entry2);
// pr.addEntry(entry1);
// pr.addEntry(entry2);
// pr.addEntry(entry1);
// pr.addEntry(entry2);
// pr.addEntry(entry1);
// pr.addEntry(entry2);
// pr.addEntry(entry1);
// pr.addEntry(entry2);
//
// pr.save();
// }
}
ciao