Example usage for com.lowagie.text Cell setVerticalAlignment

List of usage examples for com.lowagie.text Cell setVerticalAlignment

Introduction

In this page you can find the example usage for com.lowagie.text Cell setVerticalAlignment.

Prototype

public void setVerticalAlignment(String alignment) 

Source Link

Document

Sets the alignment of this paragraph.

Usage

From source file:org.kuali.kfs.module.cam.report.DepreciationReport.java

License:Open Source License

/**
 * This method creates a report group for the error message on the report
 * //from   w  w w  . j  ava2s . com
 * @throws DocumentException
 */
private void generateErrorColumnHeaders() throws DocumentException {
    try {
        int headerwidths[] = { 60 };

        Table aTable = new Table(1, 1); // 2 columns, 1 rows.

        aTable.setAutoFillEmptyCells(true);
        aTable.setPadding(3);
        aTable.setWidths(headerwidths);
        aTable.setWidth(100);

        Cell cell;

        Font font = FontFactory.getFont(FontFactory.HELVETICA, 9, Font.NORMAL);

        cell = new Cell(new Phrase("Error(s)", font));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setGrayFill(0.9f);
        aTable.addCell(cell);

        this.document.add(aTable);

    } catch (Exception e) {
        throw new RuntimeException(
                "DepreciationReport.generateErrorColumnHeaders() - Error: " + e.getMessage());
    }
}

From source file:org.kuali.kfs.module.cam.report.DepreciationReport.java

License:Open Source License

/**
 * This method creates the headers for the report statistics
 *///from w ww .  j  a  v  a2s  .com
private void generateColumnHeaders() {
    try {
        int headerwidths[] = { 40, 15 };

        Table aTable = new Table(2, 1); // 2 columns, 1 rows.

        aTable.setAutoFillEmptyCells(true);
        aTable.setPadding(3);
        aTable.setWidths(headerwidths);
        aTable.setWidth(100);

        Cell cell;

        Font font = FontFactory.getFont(FontFactory.HELVETICA, 9, Font.NORMAL);

        cell = new Cell(new Phrase(SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(
                CamsKeyConstants.Depreciation.MSG_REPORT_DEPRECIATION_HEADING1), font));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setGrayFill(0.9f);
        aTable.addCell(cell);

        cell = new Cell(new Phrase(SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(
                CamsKeyConstants.Depreciation.MSG_REPORT_DEPRECIATION_HEADING2), font));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setGrayFill(0.9f);
        aTable.addCell(cell);
        this.document.add(aTable);

    } catch (Exception e) {
        throw new RuntimeException("DepreciationReport.generateColumnHeaders() - Error: " + e.getMessage());
    }
}

From source file:org.netxilia.server.rest.pdf.SheetPdfProvider.java

License:Open Source License

/**
 * Returns a formatted cell for the given value.
 * //  w  w  w .  ja  va  2 s .c  o  m
 * @param value
 *            cell value
 * @return Cell
 * @throws BadElementException
 *             errors while generating content
 */
private Cell getCell(String value, Font font, int horizAlign, int width) throws BadElementException {
    Cell cell = new Cell(new Chunk(StringUtils.trimToEmpty(value), font));
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setHorizontalAlignment(horizAlign);
    cell.setLeading(8);
    if (width > 0) {
        cell.setWidth(width);
    }
    return cell;
}

From source file:org.pentaho.reporting.engine.classic.core.modules.output.table.rtf.helper.RTFPrinter.java

License:Open Source License

private void computeCellStyle(final RenderBox content, final Cell cell) {
    final ElementAlignment verticalAlign = content.getNodeLayoutProperties().getVerticalAlignment();
    if (ElementAlignment.BOTTOM.equals(verticalAlign)) {
        cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
    } else if (ElementAlignment.MIDDLE.equals(verticalAlign)) {
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    } else {//from   w w w .j  a v a2  s .c o  m
        cell.setVerticalAlignment(Element.ALIGN_TOP);
    }

    final ElementAlignment textAlign = (ElementAlignment) content.getStyleSheet()
            .getStyleProperty(ElementStyleKeys.ALIGNMENT);
    if (ElementAlignment.RIGHT.equals(textAlign)) {
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    } else if (ElementAlignment.JUSTIFY.equals(textAlign)) {
        cell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    } else if (ElementAlignment.CENTER.equals(textAlign)) {
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    } else {
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    }
}

From source file:org.sigmah.server.report.renderer.itext.ThemeHelper.java

License:Open Source License

public static Cell columnHeaderCell(String label, boolean leaf, int hAlign) throws BadElementException {
    Paragraph para = new Paragraph(label);
    para.setFont(new Font(Font.HELVETICA, 10, Font.NORMAL, Color.WHITE));

    Cell cell = new Cell();
    cell.addElement(para);/*from   www  . j ava2  s .c o  m*/
    cell.setHorizontalAlignment(hAlign);
    cell.setHeader(true);
    cell.setVerticalAlignment(Cell.ALIGN_BOTTOM);
    cell.setBackgroundColor(new Color(55, 96, 145));

    cell.setBorderWidth(0);

    return cell;
}

From source file:org.tpspencer.tal.mvc.document.DocumentWriterImpl.java

License:Apache License

public void startTable(String[] headings) {
    if (sections.size() == 0)
        throw new IllegalArgumentException("Cannot start a list if there is no section");
    if (table != null)
        throw new IllegalArgumentException("Cannot nest a table in another table");

    try {/*from   w w w.ja  va  2s. c o m*/
        table = new Table(headings.length);
        table.setPadding(2);
        table.setBorderColor(Color.GRAY);
        table.setBorderWidth(1);

        for (int i = 0; i < headings.length; i++) {
            Cell c = new Cell(new Phrase(getText(headings[i]), headingFont));
            c.setUseAscender(true);
            c.setBackgroundColor(Color.DARK_GRAY);
            c.setVerticalAlignment(Element.ALIGN_MIDDLE);
            c.setHeader(true);
            table.addCell(c);
        }

        table.endHeaders();
    } catch (Exception e) {
        throw new IllegalArgumentException("Error creating table", e);
    }
}

From source file:org.tpspencer.tal.mvc.document.DocumentWriterImpl.java

License:Apache License

public void addTableRow(String[] cols, AppElement element) {
    if (table == null)
        throw new IllegalArgumentException("Cannot add a row if there is no table!");

    try {//from   w ww.  j av  a  2s  . c om
        for (int i = 0; i < cols.length; i++) {
            Cell c = new Cell(new Phrase(getText(cols[i], element), paraFont));
            c.setUseAscender(true);
            c.setVerticalAlignment("middle");
            table.addCell(c);
        }
    } catch (Exception e) {
        throw new IllegalArgumentException("Error adding row to a table", e);
    }
}

From source file:org.tpspencer.tal.mvc.document.DocumentWriterImpl.java

License:Apache License

public void addTableRow(String[] cols) {
    if (table == null)
        throw new IllegalArgumentException("Cannot add a row if there is no table!");

    try {//from   w  w w. java  2 s  . co  m
        for (int i = 0; i < cols.length; i++) {
            Cell c = new Cell(new Phrase(cols[i], paraFont));
            c.setUseAscender(true);
            c.setVerticalAlignment("middle");
            table.addCell(c);
        }
    } catch (Exception e) {
        throw new IllegalArgumentException("Error adding row to a table", e);
    }
}

From source file:s2s.luna.reports.Report_REP_AZL_GSE.java

License:GNU General Public License

@Override
public void doReport() throws DocumentException, IOException, BadElementException, Exception {
    String strTemp = "";
    IAziendaHome home = (IAziendaHome) PseudoContext.lookup("AziendaBean");
    IAzienda bean = home.findByPrimaryKey(new Long(lCOD_AZL));

    initDocument("the doc", null,
            IncludeLogo ? ApplicationConfigurator.LanguageManager.getString("SCHEDA.AZIENDALE")
                    : ApplicationConfigurator.LanguageManager.getString("Informazioni.preliminari"),
            bean.getRAG_SCL_AZL(), null);
    if (IncludeLogo) {
        AddImage();/*from w ww.j av a  2  s .co m*/
    }
    // writeIndent();
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        tbl.addHeaderCellB(IncludeLogo ? ApplicationConfigurator.LanguageManager.getString("SCHEDA.AZIENDALE")
                : ApplicationConfigurator.LanguageManager.getString("Informazioni.preliminari"));
        tbl.addTitleCell(bean.getRAG_SCL_AZL());
        m_document.add(tbl);
    }
    {// Dati anagrafici
        writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Dati.anagrafici"));
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 30, 79 };
        tbl.setWidths(width);

        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Attivit.svolta")); //ok
        tbl.addCell(bean.getDES_ATI_SVO_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Indirizzo.n.civico"));// ok
        tbl.addCell(bean.getIDZ_AZL() + ", " + bean.getNUM_CIC_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Citt.C.A.P."));// ok
        if (bean.getCAP_AZL() != null) {
            tbl.addCell(bean.getCIT_AZL() + " - " + bean.getCAP_AZL());
        } else {
            tbl.addCell(bean.getCIT_AZL());
        }
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Provincia"));// ok
        tbl.addCell(bean.getPRV_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Nazionalit"));// ok
        strTemp = "";
        INazionalitaHome h = (INazionalitaHome) PseudoContext.lookup("NazionalitaBean");
        INazionalita b = h.findByPrimaryKey(new Long(bean.getCOD_STA()));
        tbl.addCell(b.getNOM_STA());
        m_document.add(tbl);
    }
    {// Dati sulla sicurezza
        writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Dati.sulla.sicurezza"));
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 30, 79 };
        tbl.setWidths(width);

        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Datore.di.lavoro"));// ok
        tbl.addCell(bean.getNOM_RSP_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Qualifica.del.datore.lavoro"));//ok
        tbl.addCell(bean.getQLF_RSP_AZL());

        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Resp.aziendale.SPP"));// ok
        tbl.addCell(bean.getNOM_RSP_SPP_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Medico.competente"));// ok
        tbl.addCell(bean.getNOM_MED_AZL());
        m_document.add(tbl);
    }
    {// Altro
        writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Altro"));
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 30, 79 };
        tbl.setWidths(width);

        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("E-mail.aziendale"));// ok
        tbl.addCell(bean.getIDZ_PSA_ELT_RSP_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Sito.internet.aziendale"));// ok
        tbl.addCell(bean.getSIT_INT_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Azienda.associata"));
        if (bean.getCOD_AZL_ASC() == 0) {
            tbl.addCell("");
        } else {
            strTemp = "";
            IAziendaHome h = (IAziendaHome) PseudoContext.lookup("AziendaBean");
            IAzienda b = h.findByPrimaryKey(new Long(bean.getCOD_AZL_ASC()));

            tbl.addCell(b.getRAG_SCL_AZL());
        }
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Codice.ISTAT"));//ok
        tbl.addCell(bean.getCOD_IST_TAT_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Telefoni.utili"));//ok
        strTemp = "";
        IAziendaTelefonoHome h = (IAziendaTelefonoHome) PseudoContext.lookup("AziendaTelefonoBean");
        Iterator it = h.getAziendaTelefoniByAZLID_View(lCOD_AZL).iterator();
        while (it.hasNext()) {
            AziendaTelefoniByAZLID_View w = (AziendaTelefoniByAZLID_View) it.next();
            strTemp += w.NUM_TEL;
            if (it.hasNext()) {
                strTemp += ", ";
            }
        }
        tbl.addCell(strTemp);
        m_document.add(tbl);
    }
    {// Rappresentanti dei lavoratori
        writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Rappresentanti.dei.lavoratori"));
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 30, 79 };
        tbl.setWidths(width);

        Cell rlsCell = new Cell(ApplicationConfigurator.LanguageManager.getString("R.L.S."));
        rlsCell.setVerticalAlignment(Element.ALIGN_TOP);
        tbl.addCell(rlsCell);//ok
        strTemp = "";
        IDipendenteHome home_dpd = (IDipendenteHome) PseudoContext.lookup("DipendenteBean");
        java.util.Iterator it_dip = home_dpd.getDipendentiByAZLID_RLS_View(lCOD_AZL).iterator();
        while (it_dip.hasNext()) {
            DipendentiByAZLID_View dt = (DipendentiByAZLID_View) it_dip.next();
            strTemp += Formatter.format(dt.COG_DPD);
            strTemp += " " + Formatter.format(dt.NOM_DPD);
            if (it_dip.hasNext()) {
                strTemp += "\n";
            }
        }
        tbl.addCell(strTemp);
        m_document.add(tbl);
    }
    {// Siti aziendali
        writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Sedi"));
        CenterMiddleTable tbl = new CenterMiddleTable(5);
        tbl.toLeft();
        int width[] = { 22, 25, 25, 20, 8 };
        tbl.setWidths(width);

        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Sede"));// ok
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Immobile"));// ok
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Indirizzo"));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Citt.C.A.P."));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Prov."));
        tbl.endHeaders();

        IImmobili3lvHome imm3lv = (IImmobili3lvHome) PseudoContext.lookup("Immobili3lvBean");
        Iterator imm3lv_it = imm3lv.findEx(lCOD_AZL, null, null, null, null, null, null, null, null, 0)
                .iterator();
        String previousNOM_SIT_AZL = "";
        while (imm3lv_it.hasNext()) {
            Immobili3liv_View immobile3lv = (Immobili3liv_View) imm3lv_it.next();
            Cell nomSitAzlCell = null;
            // Cambio sede
            if (previousNOM_SIT_AZL.equals(immobile3lv.NOM_SIT_AZL) == false) {
                nomSitAzlCell = new Cell(immobile3lv.NOM_SIT_AZL);
                if (imm3lv_it.hasNext()) {
                    nomSitAzlCell.setBorder(Rectangle.TOP | Rectangle.LEFT | Rectangle.RIGHT);
                }
                // Sede uguale alle precedente
            } else {
                nomSitAzlCell = new Cell("");
                if (imm3lv_it.hasNext()) {
                    nomSitAzlCell.setBorder(Rectangle.LEFT | Rectangle.RIGHT);
                } else {
                    nomSitAzlCell.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
                }
            }
            tbl.addCell(nomSitAzlCell);
            previousNOM_SIT_AZL = immobile3lv.NOM_SIT_AZL;
            tbl.addCell(Formatter.format(immobile3lv.NOM_IMM));
            tbl.addCell(Formatter.format(immobile3lv.IND_IMM)
                    + (StringManager.isNotEmpty(immobile3lv.IND_IMM)
                            && StringManager.isNotEmpty(immobile3lv.NUM_CIV_IMM) ? ", " : "")
                    + Formatter.format(immobile3lv.NUM_CIV_IMM));
            tbl.addCell(Formatter.format(immobile3lv.CIT_IMM)
                    + (StringManager.isNotEmpty(immobile3lv.CIT_IMM)
                            && StringManager.isNotEmpty(immobile3lv.CAP_IMM) ? " - " : "")
                    + Formatter.format(immobile3lv.CAP_IMM));
            tbl.addCell(Formatter.format(immobile3lv.PRO_IMM));
        }
        m_document.add(tbl);
    }
    closeDocument();
}

From source file:s2s.luna.reports.Report_REP_SOP.java

License:GNU General Public License

@Override
public void doReport() throws DocumentException, IOException, BadElementException, Exception {

    SecurityWrapper Security = SecurityWrapper.getInstance();
    ISopraluogoHome home1 = (ISopraluogoHome) PseudoContext.lookup("SopraluogoBean");
    ISopraluogo bean = home1.findByPrimaryKey(new Long(new Long(request.getParameter("ID"))));
    IAnagrProcedimentoHome home_pro = (IAnagrProcedimentoHome) PseudoContext.lookup("AnagrProcedimentoBean");
    IAnagrProcedimento bean_pro = home_pro.findByPrimaryKey(new Long(bean.getCOD_PRO()));
    IDipendenteHome home_dpd = (IDipendenteHome) PseudoContext.lookup("DipendenteBean");

    ICantiereHome home_can = (ICantiereHome) PseudoContext.lookup("CantiereBean");
    ICantiere bean_can = home_can.findByPrimaryKey(new Long(bean.getCOD_CAN()));

    IAnagrOpereHome home_ope = (IAnagrOpereHome) PseudoContext.lookup("AnagrOpereBean");
    IAnagrOpere bean_ope = null;/*from   w  ww. j av  a2s  .  com*/
    long COD_OPE = bean.getCOD_OPE();
    if (COD_OPE != 0) {
        bean_ope = home_ope.findByPrimaryKey(COD_OPE);
    }

    lCOD_AZL = Security.getAziendaR();
    IAziendaHome home_az = (IAziendaHome) PseudoContext.lookup("AziendaBean");
    IAzienda bean_az = home_az.findByPrimaryKey(new Long(lCOD_AZL));

    initDocument("the doc",
            // Intestazione - Cella a sinistra
            bean_pro.getstrDES(),
            // Intestazione - Cella centrale
            bean_can.getNOM_CAN() + " - " + bean.getNUM_SOP(),
            // Pi di pagina Cella a sinistra
            bean_az.getRAG_SCL_AZL(),
            // Pi di pagina Cella a destra
            formatPlain(bean.getDAT_SOP()));

    m_handler.bShowDate = false;

    // LOGO E TITOLO
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.setDefaultCellBorder(0);
        int width[] = { 15, 75 };
        tbl.setWidths(width);
        if (IncludeLogo) {
            Image png = loadImage("LOGO");
            png.scalePercent(50);
            png.setAlignment(Image.ALIGN_LEFT);
            Cell cImage = new Cell(png);
            tbl.addCell(cImage);
        } else {
            tbl.addCell("");
        }
        CenterMiddleTable tbl2 = new CenterMiddleTable(1);
        tbl2.setDefaultCellBorder(0);
        tbl2.addCellBU(ApplicationConfigurator.CUSTOMER_NAME.toUpperCase(), 15);
        tbl2.addCellBU(ApplicationConfigurator.LanguageManager.getString("Coordinamento.sicurezza.cantieri")
                .toUpperCase(), 15);

        Cell cText = new Cell(tbl2);
        tbl.addCell(cText);
        m_document.add(tbl);
    }

    writeIndent();
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        if (bStandAlone) {
        }
        m_document.add(tbl);
    }

    // DATI DEL SOPRALLUOGO
    {
        CenterMiddleTable tbl = new CenterMiddleTable(4);
        tbl.toLeft();
        int width[] = { 30, 20, 25, 25 };
        tbl.setWidths(width);
        tbl.addCell(
                ApplicationConfigurator.LanguageManager.getString("Sopralluogo.N") + "  " + bean.getNUM_SOP(),
                defaultFontSize);
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("del") + "  "
                + formatPlain(bean.getDAT_SOP()), defaultFontSize);
        tbl.addCell(
                ApplicationConfigurator.LanguageManager.getString("Inizio.h")
                        + (bean.getORA_INI() != null ? bean.getORA_INI().toString().substring(0, 5) : ""),
                defaultFontSize);
        tbl.addCell(
                ApplicationConfigurator.LanguageManager.getString("Fine.h")
                        + (bean.getORA_FIN() != null ? bean.getORA_FIN().toString().substring(0, 5) : ""),
                defaultFontSize);
        m_document.add(tbl);
    }
    {
        CenterMiddleTable tbl = new CenterMiddleTable(3);
        tbl.toLeft();
        int width[] = { 34, 33, 33 };
        tbl.setWidths(width);
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Linea") + ":  " + bean_pro.getstrDES(),
                defaultFontSize);
        tbl.addCell(
                ApplicationConfigurator.LanguageManager.getString("Stazione") + ":  " + bean_can.getNOM_CAN(),
                defaultFontSize);
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Opera") + ":  "
                + (bean_ope != null ? bean_ope.getstrNOM_OPE() : ""), defaultFontSize);
        m_document.add(tbl);
    }

    // PRESENTI AZIENDA
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 25, 70 };
        tbl.setWidths(width);
        tbl.border();
        java.util.Collection col = home_dpd.getDipendentiBySOP_View(lCOD_SOP);
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Presenti.RM"), defaultFontSize);
        java.util.Iterator it = col.iterator();
        String presentiRM = "";
        while (it.hasNext()) {
            DipendentiBySOP_View obj = (DipendentiBySOP_View) it.next();
            presentiRM += (StringManager.isEmpty(presentiRM) ? "" : ", ") + obj.COG_DPD + " " + obj.NOM_DPD;
        }
        tbl.addCell(presentiRM, defaultFontSize);
        m_document.add(tbl);
    }

    // PRESENTI IMPRESA
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        tbl.setPadding(1 / 2);
        int width[] = { 25, 70 };
        tbl.setWidths(width);
        tbl.border();
        java.util.Collection col = home_dpd.getDipendentiEstBySOP_View(lCOD_SOP);
        java.util.Iterator it = col.iterator();
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Presenti.impresa"), defaultFontSize);
        String presentiIMP = "";
        while (it.hasNext()) {
            DipendentiBySOP_View obj = (DipendentiBySOP_View) it.next();
            presentiIMP += (StringManager.isEmpty(presentiIMP) ? "" : ", ") + obj.COG_DPD + " " + obj.NOM_DPD
                    + " (" + obj.IMPRESA + ")";
        }
        tbl.addCell(presentiIMP, defaultFontSize);
        m_document.add(tbl);
    }
    writeLine();

    // CONSTATAZIONI
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        tbl.toLeft();
        int width[] = { 100 };
        tbl.setWidths(width);
        tbl.addHeaderCellB2(ApplicationConfigurator.LanguageManager.getString("CONSTATAZIONI"), 1, false, 11);
        m_document.add(tbl);
    }
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 5, 85 };
        tbl.setWidths(width);
        java.util.Collection col = home1.getConstatazioniSop(lCOD_SOP);
        java.util.Iterator it = col.iterator();
        tbl.setWidths(width);
        String constElementSeparator = " - ";
        Alphabet c = new Alphabet();
        String REV1 = c.getNextElement("1");
        while (it.hasNext()) {
            jbConstatazione obj = (jbConstatazione) it.next();

            // Numerazione alfabetica
            Cell cell = new Cell(new Phrase(Formatter.format(REV1), REPORT_SETTINGS.ftText9B));
            cell.setVerticalAlignment(Element.ALIGN_TOP);
            tbl.addCell(cell);

            // Constatazione
            tbl.addCell(Formatter.format(
                    (StringManager.isNotEmpty(obj.sRAG_SCL_DTE) ? obj.sRAG_SCL_DTE + constElementSeparator : "")
                            + (StringManager.isNotEmpty(obj.sNOM_ATT)
                                    ? obj.sNOM_ATT + constElementSeparator
                                    : "")
                            + (StringManager.isNotEmpty(obj.sDES_LIB) ? obj.sDES_LIB + constElementSeparator
                                    : "")
                            + obj.sDESC),
                    defaultFontSize);
            REV1 = c.getNextElement(REV1);
        }
        m_document.add(tbl);
    }
    writeLine();

    // DISPOSIZIONI
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        tbl.toLeft();
        int width[] = { 85 };
        tbl.setWidths(width);
        tbl.addHeaderCellB2(ApplicationConfigurator.LanguageManager.getString("DISPOSIZIONI"), 1, false, 11);
        m_document.add(tbl);
    }
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 5, 85 };
        java.util.Collection col = home1.getConstatazioniSop(lCOD_SOP);
        java.util.Iterator it = col.iterator();
        tbl.setWidths(width);
        Alphabet c = new Alphabet();
        String REV2 = c.getNextElement("1");
        while (it.hasNext()) {
            jbConstatazione obj = (jbConstatazione) it.next();

            // Numerazione alfabetica
            Cell cell = new Cell(new Phrase(Formatter.format(REV2), REPORT_SETTINGS.ftText9B));
            cell.setVerticalAlignment(Element.ALIGN_TOP);
            tbl.addCell(cell);

            // Disposizione generata
            tbl.addCell(Formatter.format(obj.sDIS_GEN), defaultFontSize);
            REV2 = c.getNextElement(REV2);
        }
        m_document.add(tbl);
    }

    // FIRME
    // Spazio per le firme
    for (int i = 1; i <= 5; i++) {
        writeLine();
    }
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        int width[] = { 50, 50 };
        tbl.setWidths(width);
        tbl.setDefaultCellBorder(0);

        // Firme del personale dell'azienda
        Cell cell = new Cell(
                new Phrase(ApplicationConfigurator.CUSTOMER_NAME.toUpperCase(), REPORT_SETTINGS.ftText9));
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        tbl.addCell(cell);

        // Firme del personale delle imprese
        Cell cell2 = new Cell(
                new Phrase(ApplicationConfigurator.LanguageManager.getString("Impresa").toUpperCase(),
                        REPORT_SETTINGS.ftText9));
        cell2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        tbl.addCell(cell2);

        m_document.add(tbl);
    }

    // FOTO
    {
        Collection<jbMedia> listaFoto = home1.getMediaSOP(lCOD_SOP);
        if (listaFoto != null && listaFoto.size() > 0) {

            // STAMPA L'INDICE DELLE FOTO.
            boolean firstFoto = true;
            int fotoIndex = 0;
            for (jbMedia foto : listaFoto) {
                try {
                    // Verifica che l'immagine sia in un formato supportato.
                    Image.getInstance(foto.mediaData);
                    fotoIndex++;
                    if (firstFoto) {
                        writePage();
                        writeTitle(ApplicationConfigurator.LanguageManager.getString("Indice.foto.allegate"));
                        firstFoto = false;
                    }
                    writeLine();
                    // Stampo il progessivo della foto, nel formato "Foto n".
                    writeText2Bold(ApplicationConfigurator.LanguageManager.getString("Foto") + " " + fotoIndex);
                    // Stampo il "nome" o se questo  assente, "il nome file".
                    writeText2(StringManager.isNotEmpty(foto.sNOM_MED) ? Formatter.format(foto.sNOM_MED)
                            : Formatter.format(foto.sFile));
                    // Stampo, se presente, la "descrizione".
                    writeText2(StringManager.isNotEmpty(foto.sDES_MED) ? Formatter.format(foto.sDES_MED) : "");
                } catch (Exception ex) {
                    // Eccezione silenziosa.
                    // Gestisce il caso in cui l'allegato non sia un immagine
                }
            }
            // STAMPA LE FOTO.
            firstFoto = true;
            fotoIndex = 0;
            byte SPACE_FOR_TITLE = 20;
            byte SPACE_FOR_BOTTOM_MARGIN = 20;
            boolean strictImageSequence = m_writer.isStrictImageSequence();
            m_writer.setStrictImageSequence(true);
            for (jbMedia foto : listaFoto) {
                Element image = prepareImage(m_document, foto.mediaData);
                if (image != null) {
                    fotoIndex++;
                    if (firstFoto) {
                        writePage();
                        firstFoto = false;
                    }
                    if (m_document.getPageSize().getHeight() - m_document.topMargin()
                            + 20 < getAvailablePageSpace(m_document, m_writer)) {
                        writeLine();
                    }
                    if (getAvailablePageSpace(m_document, m_writer)
                            - (SPACE_FOR_TITLE + SPACE_FOR_BOTTOM_MARGIN) < ((Image) image).getScaledHeight()) {
                        writePage();
                    }
                    // Stampo il progessivo della foto, nel formato "Foto n".
                    writeText2(ApplicationConfigurator.LanguageManager.getString("Foto") + " " + fotoIndex);
                    // Stampo l'immagine.
                    m_document.add(image);
                }
            }
            m_writer.setStrictImageSequence(strictImageSequence);
        }
    }
    // DOCUMENTI ALLEGATI
    Collection<DocumentiAssociati_Sopralluogo_View> listadocumenti = home1
            .getDocumentiCantiereSOP_STAMPA(lCOD_SOP);
    if (listadocumenti != null && listadocumenti.size() > 0) {

        // STAMPA L'INDICE DEI DOCUMENTI ALLEGATI
        // i documenti allegati sono quei documenti la cui tipologia risulta avere attivo
        //il flag di stampa in sopralluogo.
        boolean firstdocument = true;
        int documentIndex = 0;
        for (DocumentiAssociati_Sopralluogo_View documento : listadocumenti) {
            try {
                // Verifica che l'immagine sia in un formato supportato.
                documentIndex++;
                if (firstdocument) {
                    writePage();
                    writeTitle(ApplicationConfigurator.LanguageManager.getString("Indice.documenti.allegati"));
                    firstdocument = false;
                }
                writeLine();
                // Stampo il "titolo" del documento.
                writeText3Bold(documentIndex + ")"
                        + (StringManager.isNotEmpty(documento.TIT_DOC) ? Formatter.format(documento.TIT_DOC)
                                : Formatter.format(documento.NOM_TPL_DOC)));
                // Stampo, se presente, la "descrizione".
                if (!(documento.DES).equals("")) {
                    writeLine();
                }
                writeText3_3(StringManager.isNotEmpty(documento.DES) ? Formatter.format(documento.DES) : "");

                IAnagrDocumentoHome doc_home = (IAnagrDocumentoHome) PseudoContext.lookup("AnagrDocumentoBean");
                AnagDocumentoFileInfo fileInfo = null;
                AnagDocumentoFileInfo fileInfoLink = null;
                fileInfo = doc_home.getFileInfoU("", documento.lCOD_DOC);
                fileInfoLink = doc_home.getFileInfoULink("", documento.lCOD_DOC);

                // se esiste stampo il file allegato
                if (fileInfo != null) {
                    writeLine();
                    writeText3_3(Formatter.format("   " + "File Allegato:  " + fileInfo.strName));
                } else {
                    writeLine();
                    writeText3_3(Formatter.format("   " + "File Allegato:  "));
                }

                // se esiste stampo il file link allegato
                if (fileInfoLink != null) {
                    writeText3_3(Formatter.format("   " + "File Link Allegato:  " + fileInfoLink.strName));
                } else {
                    writeText3_3(Formatter.format("   " + "File Link Allegato:  "));
                }
                writeLine();
            } catch (Exception ex) {
                // Eccezione silenziosa.
                // Gestisce il caso in cui l'allegato non sia un immagine
            }

        }
        writePage();
        // Stampa documenti allegati
        boolean endWithNewPage = false;
        endWithNewPage = StampaDocumenti(home1, bean.getCOD_SOP(), m_document, m_writer);

    }
    closeDocument();
}