Example usage for com.lowagie.text Table addCell

List of usage examples for com.lowagie.text Table addCell

Introduction

In this page you can find the example usage for com.lowagie.text Table addCell.

Prototype


public void addCell(String content) throws BadElementException 

Source Link

Document

Adds a Cell to the Table.

Usage

From source file:io.vertigo.dynamo.plugins.export.pdfrtf.AbstractExporterIText.java

License:Apache License

private void renderObject(final ExportSheet exportSheet, final Table datatable) throws BadElementException {
    final Font labelFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD);
    final Font valueFont = FontFactory.getFont(FontFactory.HELVETICA, 10, Font.NORMAL);

    for (final ExportField exportColumn : exportSheet.getExportFields()) {
        datatable.getDefaultCell().setBorderWidth(2);
        datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        datatable.addCell(new Phrase(exportColumn.getLabel().getDisplay(), labelFont));

        datatable.getDefaultCell().setBorderWidth(1);
        datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
        final DtField dtField = exportColumn.getDtField();
        final Object value = dtField.getDataAccessor().getValue(exportSheet.getDtObject());
        final int horizontalAlignement;
        if (value instanceof Number || value instanceof Date) {
            horizontalAlignement = Element.ALIGN_RIGHT;
        } else if (value instanceof Boolean) {
            horizontalAlignement = Element.ALIGN_CENTER;
        } else {//from   w  ww.  j  av  a2  s  .  c om
            horizontalAlignement = Element.ALIGN_LEFT;
        }
        datatable.getDefaultCell().setHorizontalAlignment(horizontalAlignement);

        String text = ExportUtil.getText(persistenceManager, referenceCache, denormCache,
                exportSheet.getDtObject(), exportColumn);
        if (text == null) {
            text = "";
        }
        datatable.addCell(new Phrase(8, text, valueFont));
    }
}

From source file:io.vertigo.dynamo.plugins.export.pdfrtf.AbstractExporterIText.java

License:Apache License

/**
 * Effectue le rendu des headers.//from w  w  w  .j a va2  s  .c  om
 *
 * @param parameters Paramtres
 * @param datatable Table
 */
private static void renderHeaders(final ExportSheet parameters, final Table datatable)
        throws BadElementException {
    // size of columns
    // datatable.setWidths(headerwidths);
    // datatable.setWidth(100f);

    // table header
    final Font font = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD);
    datatable.getDefaultCell().setBorderWidth(2);
    datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    // datatable.getDefaultCell().setGrayFill(0.75f);

    for (final ExportField exportColumn : parameters.getExportFields()) {
        datatable.addCell(new Phrase(exportColumn.getLabel().getDisplay(), font));
    }
    // end of the table header
    datatable.endHeaders();
}

From source file:io.vertigo.dynamo.plugins.export.pdfrtf.AbstractExporterIText.java

License:Apache License

/**
 * Effectue le rendu de la liste.//from w ww.  j av  a 2  s  .  c o m
 *
 * @param parameters Paramtres
 * @param datatable Table
 */
private void renderList(final ExportSheet parameters, final Table datatable) throws BadElementException {
    // data rows
    final Font font = FontFactory.getFont(FontFactory.HELVETICA, 10, Font.NORMAL);
    final Font whiteFont = FontFactory.getFont(FontFactory.HELVETICA, 10, Font.NORMAL);
    whiteFont.setColor(Color.WHITE);
    datatable.getDefaultCell().setBorderWidth(1);
    datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    // datatable.getDefaultCell().setGrayFill(0);

    // Parcours des DTO de la DTC
    for (final DtObject dto : parameters.getDtList()) {
        for (final ExportField exportColumn : parameters.getExportFields()) {
            final DtField dtField = exportColumn.getDtField();
            final Object value = dtField.getDataAccessor().getValue(dto);
            final int horizontalAlignement;
            if (value instanceof Number || value instanceof Date) {
                horizontalAlignement = Element.ALIGN_RIGHT;
            } else if (value instanceof Boolean) {
                horizontalAlignement = Element.ALIGN_CENTER;
            } else {
                horizontalAlignement = Element.ALIGN_LEFT;
            }
            datatable.getDefaultCell().setHorizontalAlignment(horizontalAlignement);

            String text = ExportUtil.getText(persistenceManager, referenceCache, denormCache, dto,
                    exportColumn);
            if (text == null) {
                text = "";
            }
            datatable.addCell(new Phrase(8, text, font));
        }
    }
}

From source file:io.vertigo.quarto.plugins.export.pdfrtf.AbstractExporterIText.java

License:Apache License

private void renderObject(final ExportSheet exportSheet, final Table datatable) throws BadElementException {
    final Font labelFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD);
    final Font valueFont = FontFactory.getFont(FontFactory.HELVETICA, 10, Font.NORMAL);

    for (final ExportField exportColumn : exportSheet.getExportFields()) {
        datatable.getDefaultCell().setBorderWidth(2);
        datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        datatable.addCell(new Phrase(exportColumn.getLabel().getDisplay(), labelFont));

        datatable.getDefaultCell().setBorderWidth(1);
        datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
        final DtField dtField = exportColumn.getDtField();
        final Object value = dtField.getDataAccessor().getValue(exportSheet.getDtObject());
        final int horizontalAlignement;
        if (value instanceof Number || value instanceof LocalDate || value instanceof Instant) {
            horizontalAlignement = Element.ALIGN_RIGHT;
        } else if (value instanceof Boolean) {
            horizontalAlignement = Element.ALIGN_CENTER;
        } else {// ww w .  j  a  va  2 s .c  o  m
            horizontalAlignement = Element.ALIGN_LEFT;
        }
        datatable.getDefaultCell().setHorizontalAlignment(horizontalAlignement);

        String text = ExportUtil.getText(storeManager, referenceCache, denormCache, exportSheet.getDtObject(),
                exportColumn);
        if (text == null) {
            text = "";
        }
        datatable.addCell(new Phrase(8, text, valueFont));
    }
}

From source file:io.vertigo.quarto.plugins.export.pdfrtf.AbstractExporterIText.java

License:Apache License

/**
 * Effectue le rendu des headers./*w ww.  j  a  v a  2s  .  co  m*/
 *
 * @param parameters Paramtres
 * @param datatable Table
 */
private static void renderHeaders(final ExportSheet parameters, final Table datatable)
        throws BadElementException {
    // table header
    final Font font = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD);
    datatable.getDefaultCell().setBorderWidth(2);
    datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

    for (final ExportField exportColumn : parameters.getExportFields()) {
        datatable.addCell(new Phrase(exportColumn.getLabel().getDisplay(), font));
    }
    // end of the table header
    datatable.endHeaders();
}

From source file:io.vertigo.quarto.plugins.export.pdfrtf.AbstractExporterIText.java

License:Apache License

/**
 * Effectue le rendu de la liste.//from   www  .java  2s . c  o  m
 *
 * @param parameters Paramtres
 * @param datatable Table
 */
private void renderList(final ExportSheet parameters, final Table datatable) throws BadElementException {
    // data rows
    final Font font = FontFactory.getFont(FontFactory.HELVETICA, 10, Font.NORMAL);
    final Font whiteFont = FontFactory.getFont(FontFactory.HELVETICA, 10, Font.NORMAL);
    whiteFont.setColor(Color.WHITE);
    datatable.getDefaultCell().setBorderWidth(1);
    datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);

    // Parcours des DTO de la DTC
    for (final DtObject dto : parameters.getDtList()) {
        for (final ExportField exportColumn : parameters.getExportFields()) {
            final DtField dtField = exportColumn.getDtField();
            final Object value = dtField.getDataAccessor().getValue(dto);
            final int horizontalAlignement;
            if (value instanceof Number || value instanceof LocalDate || value instanceof Instant) {
                horizontalAlignement = Element.ALIGN_RIGHT;
            } else if (value instanceof Boolean) {
                horizontalAlignement = Element.ALIGN_CENTER;
            } else {
                horizontalAlignement = Element.ALIGN_LEFT;
            }
            datatable.getDefaultCell().setHorizontalAlignment(horizontalAlignement);

            String text = ExportUtil.getText(storeManager, referenceCache, denormCache, dto, exportColumn);
            if (text == null) {
                text = "";
            }
            datatable.addCell(new Phrase(8, text, font));
        }
    }
}

From source file:ispyb.client.mx.collection.PdfRtfExporter.java

License:Open Source License

/***
 * sets the sessions informations in the pdf document for fx or ix accounts
 * (Issue 1049)//www  . j  ava  2s  .c o  m
 * 
 * @param document
 * @throws Exception
 */
private void setSessionTable(Document document) throws Exception {
    if (slv != null && (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)
            || proposalCode.equals(Constants.PROPOSAL_CODE_IX))) {
        if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) { // session
            // title
            // only
            // for
            // FX
            // accounts
            document.add(new Paragraph("Session title:", FONT_TITLE));
            document.add(new Paragraph(slv.getSessionTitle(), FONT_DOC));
        }
        Table sessionTable = new Table(2);
        // sessionTable.setWidth(50); // percentage
        sessionTable.setPadding(3);
        sessionTable.setCellsFitPage(true);
        sessionTable.getDefaultCell().setBorderWidth(0);
        sessionTable.setBorder(0);
        sessionTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
        boolean hasData = false;
        // print only if the value > 0
        if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) { // structure
            // determinations
            // only
            // for
            // FX
            // accounts
            if (slv.getStructureDeterminations() != null && !slv.getStructureDeterminations().isNaN()
                    && slv.getStructureDeterminations() != 0) {
                hasData = true;
                sessionTable.addCell(new Paragraph("Structure determinations", FONT_DOC_BOLD));
                sessionTable.addCell(new Paragraph("" + slv.getStructureDeterminations(), FONT_DOC));
            }
        }
        if (slv.getDewarTransport() != null && !slv.getDewarTransport().isNaN()
                && slv.getDewarTransport() != 0) {
            hasData = true;
            sessionTable.addCell(new Paragraph("Dewar transport", FONT_DOC_BOLD));
            sessionTable.addCell(new Paragraph("" + slv.getDewarTransport(), FONT_DOC));
        }
        if (slv.getDatabackupFrance() != null && !slv.getDatabackupFrance().isNaN()
                && slv.getDatabackupFrance() != 0) {
            hasData = true;
            sessionTable.addCell(new Paragraph("Data backup & Express delivery France", FONT_DOC_BOLD));
            sessionTable.addCell(new Paragraph("" + slv.getDatabackupFrance(), FONT_DOC));
        }
        if (slv.getDatabackupEurope() != null && !slv.getDatabackupEurope().isNaN()
                && slv.getDatabackupEurope() != 0) {
            hasData = true;
            sessionTable.addCell(new Paragraph("Data backup & Express delivery Europe", FONT_DOC_BOLD));
            sessionTable.addCell(new Paragraph("" + slv.getDatabackupEurope(), FONT_DOC));
        }
        if (hasData) {
            document.add(sessionTable);
        }
    }
}

From source file:ispyb.client.mx.collection.PdfRtfExporter.java

License:Open Source License

/**
 * set the header for the dataCollection table
 * //  w  ww.  j a  va  2  s .co  m
 * @param document
 * @param table
 * @throws Exception
 */
private Table setDataCollectionHeader(Document document, Table table, boolean withAutoProcessing)
        throws Exception {
    int nbCol = NB_COL_DATACOLLECTION;
    boolean withoutAutoProc = !withAutoProcessing;
    boolean withSampleName = name != null;
    boolean isIfx = proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX);
    if (withoutAutoProc) {
        nbCol -= 5;
    }
    if (withSampleName) {
        nbCol += 1;
    }
    if (isIfx) {
        nbCol += 1;
    }
    table = new Table(nbCol);
    int[] headersWidth = new int[nbCol];
    int i = 0;
    // image prefix
    headersWidth[i] = 12;
    if (withSampleName && !withAutoProcessing)
        headersWidth[i] = 10;
    i++;
    // beamline
    if (withSampleName) {
        headersWidth[i++] = 5;
    }
    // run no
    headersWidth[i++] = 5;
    // nb images
    headersWidth[i++] = 6;
    // auto proc
    if (withAutoProcessing) {
        headersWidth[i++] = 9; // space group
        headersWidth[i++] = 9; // unit cell
        headersWidth[i++] = 10; // completeness
        headersWidth[i++] = 9; // rsymm
        headersWidth[i++] = 9; // resolution
    }
    // detector
    headersWidth[i++] = 7;
    // wavelength
    headersWidth[i++] = 8;
    // phi range
    headersWidth[i++] = 5;
    // crytsl class
    if (isIfx) {
        headersWidth[i++] = 8;
    }
    // comments
    headersWidth[i++] = 17;
    //
    table.setWidths(headersWidth);

    table.setWidth(100); // percentage
    table.setPadding(3);
    table.setCellsFitPage(true);
    table.getDefaultCell().setBorderWidth(1);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

    // DataCollection Header

    table.getDefaultCell().setGrayFill(GREY_FILL_HEADER);
    table.addCell(new Paragraph("Image prefix", FONT_DOC_BOLD));
    if (withSampleName)
        table.addCell(new Paragraph("Beamline", FONT_DOC_BOLD));
    table.addCell(new Paragraph("Run no", FONT_DOC_BOLD));
    table.addCell(new Paragraph("# images", FONT_DOC_BOLD));
    if (withAutoProcessing) {
        table.addCell(new Paragraph("Space Group", FONT_DOC_BOLD));
        table.addCell(new Paragraph("Unit Cell", FONT_DOC_BOLD));
        table.addCell(new Paragraph("Completeness (Inner, Outer, Overall)", FONT_DOC_BOLD));
        table.addCell(new Paragraph("Rsymm (Inner, Outer, Overall)", FONT_DOC_BOLD));
        table.addCell(new Paragraph("Resolution", FONT_DOC_BOLD));
    }
    table.addCell(new Paragraph("Detector\nResolution\n(" + Constants.ANGSTROM + ")", FONT_DOC_BOLD));
    table.addCell(new Paragraph("Wavelength\n(" + Constants.ANGSTROM + ")", FONT_DOC_BOLD));
    table.addCell(new Paragraph("Phi range\n(" + Constants.DEGREE + ")", FONT_DOC_BOLD));
    // Column crystalClass only for IFX proposal in case of MXPress
    // experiment
    if (isIfx)
        table.addCell(new Paragraph("Crystal class", FONT_DOC_BOLD));
    table.addCell(new Paragraph("Comments", FONT_DOC_BOLD));
    table.getDefaultCell().setBorderWidth(1);
    return table;
}

From source file:ispyb.client.mx.collection.PdfRtfExporter.java

License:Open Source License

/**
 * set a line for a specified dataCollection in the dataCollection table
 * //from   w w w  .  j  a v  a2 s  .c o  m
 * @param document
 * @param table
 * @param col
 * @param session
 * @param df2
 * @param df3
 * @throws Exception
 */
private void setDataCollectionData(Document document, Table table, DataCollection3VO col,
        Session3Service sessionService, AutoProc3VO autoProcValue, AutoProcScalingStatistics3VO autoProcOverall,
        AutoProcScalingStatistics3VO autoProcInner, AutoProcScalingStatistics3VO autoProcOuter,
        boolean withAutoProcessing, boolean setEDNAInfo, ScreeningOutput3VO screeningOutput,
        ScreeningOutputLattice3VO screeningOutputLattice) throws Exception {
    // Session3VO slv = sessionService.findByPk(col.getSessionId(), false,
    // false, false);
    DataCollectionGroup3VO dcGroup = col.getDataCollectionGroupVO();
    Session3VO slv = dcGroup.getSessionVO();
    // here slv is not null
    if (col.getNumberOfImages() != null) {
        if (!DataCollectionExporter.isDataCollectionScreening(col)) {
            table.getDefaultCell().setGrayFill(GREY_FILL_DATA_COLLECT);
        } else
            table.getDefaultCell().setGrayFill(GREY_FILL_DATA);
    }
    if (col.getImagePrefix() != null)
        table.addCell(new Paragraph(col.getImagePrefix(), FONT_DOC));
    else
        table.addCell("");
    // The beamline name is only displayed for select by protein or by
    // sample name
    if (name != null) {
        if (slv.getBeamlineName() != null)
            table.addCell(new Paragraph(slv.getBeamlineName(), FONT_DOC));
        else
            table.addCell("");
    }

    if (col.getDataCollectionNumber() != null)
        table.addCell(new Paragraph(col.getDataCollectionNumber().toString(), FONT_DOC));
    else
        table.addCell("");

    if (col.getNumberOfImages() != null)
        table.addCell(new Paragraph(col.getNumberOfImages().toString(), FONT_DOC));
    else
        table.addCell("");

    if (withAutoProcessing) {
        // space group
        if (autoProcValue != null && autoProcValue.getSpaceGroup() != null) {
            Paragraph p = new Paragraph(autoProcValue.getSpaceGroup(), FONT_DOC);
            table.addCell(p);
        } else if (setEDNAInfo && screeningOutputLattice != null
                && screeningOutputLattice.getSpaceGroup() != null) {
            Paragraph p = new Paragraph(screeningOutputLattice.getSpaceGroup(), FONT_DOC);
            table.addCell(p);
        } else
            table.addCell("");

        // unit cell
        if (autoProcValue != null && autoProcValue.getSpaceGroup() != null)
            table.addCell(new Paragraph(autoProcValue.getRefinedCellA() + " ("
                    + autoProcValue.getRefinedCellAlpha() + ")\n" + autoProcValue.getRefinedCellB() + " ("
                    + autoProcValue.getRefinedCellBeta() + ")\n" + autoProcValue.getRefinedCellC() + " ("
                    + autoProcValue.getRefinedCellGamma() + ")", FONT_DOC));
        else if (setEDNAInfo && screeningOutputLattice != null && screeningOutputLattice.getUnitCell_a() != null
                && screeningOutputLattice.getUnitCell_b() != null
                && screeningOutputLattice.getUnitCell_c() != null
                && screeningOutputLattice.getUnitCell_alpha() != null
                && screeningOutputLattice.getUnitCell_beta() != null
                && screeningOutputLattice.getUnitCell_gamma() != null) {
            Paragraph p = new Paragraph(df3.format(screeningOutputLattice.getUnitCell_a()) + " ("
                    + df3.format(screeningOutputLattice.getUnitCell_alpha()) + ")\n"
                    + df3.format(screeningOutputLattice.getUnitCell_b()) + " ("
                    + df3.format(screeningOutputLattice.getUnitCell_beta()) + ")\n"
                    + df3.format(screeningOutputLattice.getUnitCell_c()) + " ("
                    + df3.format(screeningOutputLattice.getUnitCell_gamma()) + ")", FONT_DOC);
            table.addCell(p);
        } else
            table.addCell("");

        // completeness, rsymm, processed resolution
        String completenessString = new String();
        String rSymmString = new String();
        String resolutionString = new String();

        if (autoProcOverall != null && autoProcInner != null && autoProcOuter != null) {
            completenessString += df2.format(autoProcInner.getCompleteness()) + "\n"
                    + df2.format(autoProcOuter.getCompleteness()) + "\n"
                    + df2.format(autoProcOverall.getCompleteness());
            rSymmString += (autoProcInner.getRmerge() == null ? "" : df2.format(autoProcInner.getRmerge()))
                    + "\n" + (autoProcOuter.getRmerge() == null ? "" : df2.format(autoProcOuter.getRmerge()))
                    + "\n"
                    + (autoProcOverall.getRmerge() == null ? "" : df2.format(autoProcOverall.getRmerge()));
            resolutionString += autoProcInner.getResolutionLimitLow() + " - "
                    + autoProcInner.getResolutionLimitHigh() + "\n" + autoProcOuter.getResolutionLimitLow()
                    + " - " + autoProcOuter.getResolutionLimitHigh() + "\n"
                    + autoProcOverall.getResolutionLimitLow() + " - "
                    + autoProcOverall.getResolutionLimitHigh();
        } else if (setEDNAInfo && screeningOutput != null && screeningOutput.getRankingResolution() != null) {
            resolutionString = df2.format(screeningOutput.getRankingResolution());
        }
        table.addCell(new Paragraph(completenessString, FONT_DOC));
        table.addCell(new Paragraph(rSymmString, FONT_DOC));
        table.addCell(new Paragraph(resolutionString, FONT_DOC));
    }

    // detector resolution
    if (col.getResolution() != null)
        table.addCell(new Paragraph(df2.format(col.getResolution()), FONT_DOC));
    else
        table.addCell("");

    // wavelength
    if (col.getWavelength() != null)
        table.addCell(new Paragraph(df3.format(col.getWavelength()), FONT_DOC));
    else
        table.addCell("");

    // phi range
    if (col.getAxisRange() != null)
        table.addCell(new Paragraph(df2.format(col.getAxisRange()), FONT_DOC));
    else
        table.addCell("");

    // Column crystalClass only for IFX proposal in case of MXPress
    // experiment
    if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) {
        // if (col.getCrystalClass() != null && col.getCrystalClass() != "")
        // table.addCell(new
        // Paragraph(col.getCrystalClass(), new Font(Font.HELVETICA, 8)));
        // else table.addCell("");
        DataCollectionGroup3Service dataCollectionGroupService = (DataCollectionGroup3Service) ejb3ServiceLocator
                .getLocalService(DataCollectionGroup3Service.class);
        DataCollectionGroup3VO group = dataCollectionGroupService.findByPk(col.getDataCollectionGroupVOId(),
                true, true);
        boolean firstCollect = group.isFirstCollect(col);
        if (dcGroup.getCrystalClass() != null) {
            int idCC = getCrystalClassIndex(listOfCrystalClass, dcGroup.getCrystalClass().trim().toUpperCase());
            String crystalS = "";
            if (idCC == -1) {
                crystalS = dcGroup.getCrystalClass().toString();
            } else {
                crystalS = listOfCrystalClass.get(idCC).getCrystalClassName();
            }
            String crystalCell = crystalS;
            if (!firstCollect && crystalS != null && !crystalS.equals("")) {
                crystalCell = "(" + crystalS + ")";
            }
            table.addCell(new Paragraph(crystalCell, FONT_DOC));
        } else
            table.addCell("");

    }
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    if (col.getComments() != null && col.getComments() != "")
        table.addCell(new Paragraph(col.getComments(), FONT_DOC));
    else
        table.addCell("");
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
}

From source file:ispyb.client.mx.collection.PdfRtfExporter.java

License:Open Source License

/**
 * set the energy scan table/*from   www  .  j av  a  2  s  .c  om*/
 * 
 * @param document
 * @throws Exception
 */
private void setEnergyScansTable(Document document) throws Exception {
    if (slv == null) {// if session is null, no sense to display energy
                      // scans
        return;
    }
    document.add(new Paragraph("Energy Scans:", FONT_TITLE));
    document.add(new Paragraph(" "));
    if (energyScanList == null || energyScanList.isEmpty()) {
        document.add(new Paragraph("There is no energy scan in this report", FONT_DOC));
    } else {
        int NumColumnsES = 12;
        Table tableES = new Table(NumColumnsES);
        int headerwidthsSessionES[] = { 7, 7, 7, 7, 7, 7, 6, 6, 7, 7, 7, 25 }; // percentage
        int headerwidthsMXPressES[] = { 7, 7, 7, 7, 7, 7, 6, 6, 7, 7, 7, 8, 17 }; // percentage
        tableES.setWidths(headerwidthsSessionES);
        // Column crystalClass added only for IFX proposal in case of
        // MXPress experiment
        if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) {
            tableES = new Table(NumColumnsES + 1);
            tableES.setWidths(headerwidthsMXPressES);
        }

        tableES.setWidth(100); // percentage
        tableES.setPadding(3);
        tableES.setCellsFitPage(true);
        tableES.getDefaultCell().setBorderWidth(1);
        tableES.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

        // Energy Scan Header

        tableES.getDefaultCell().setGrayFill(GREY_FILL_HEADER);
        tableES.addCell(new Paragraph("Element", FONT_DOC_BOLD));
        tableES.addCell(new Paragraph("Inflection Energy\n(keV)", FONT_DOC_BOLD));
        tableES.addCell(new Paragraph("Exposure Time\n(s)", FONT_DOC_BOLD));
        tableES.addCell(new Paragraph("Inflection f'\n(e)", FONT_DOC_BOLD));
        tableES.addCell(new Paragraph("Inflection f''\n(e)", FONT_DOC_BOLD));
        tableES.addCell(new Paragraph("Peak Energy\n(keV)", FONT_DOC_BOLD));
        tableES.addCell(new Paragraph("Peak f'\n(e)", FONT_DOC_BOLD));
        tableES.addCell(new Paragraph("Peak f''\n(e)", FONT_DOC_BOLD));
        tableES.addCell(new Paragraph("Beam size Hor.\n(" + Constants.MICRO + "m)", FONT_DOC_BOLD));
        tableES.addCell(new Paragraph("Beam size Ver.\n(" + Constants.MICRO + "m)", FONT_DOC_BOLD));
        tableES.addCell(new Paragraph("Transm. Factor\n(%)", FONT_DOC_BOLD));
        // Column crystalClass only for IFX proposal in case of MXPress
        // experiment
        if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX))
            tableES.addCell(new Paragraph("Crystal class", FONT_DOC_BOLD));
        tableES.addCell(new Paragraph("Comments", FONT_DOC_BOLD));
        tableES.getDefaultCell().setGrayFill(GREY_FILL_DATA);
        tableES.getDefaultCell().setBorderWidth(1);

        // Energy Scan Rows

        Iterator<EnergyScan3VO> itES = energyScanList.iterator();
        while (itES.hasNext()) {
            EnergyScan3VO col = itES.next();

            if (col.getElement() != null)
                tableES.addCell(new Paragraph(col.getElement().toString(), FONT_DOC));
            else
                tableES.addCell("");

            if (col.getExposureTime() != null)
                tableES.addCell(new Paragraph(col.getExposureTime().toString(), FONT_DOC));
            else
                tableES.addCell("");

            if (col.getInflectionEnergy() != null)
                tableES.addCell(new Paragraph(col.getInflectionEnergy().toString(), FONT_DOC));
            else
                tableES.addCell("");

            if (col.getInflectionFPrime() != null)
                tableES.addCell(new Paragraph(col.getInflectionFPrime().toString(), FONT_DOC));
            else
                tableES.addCell("");

            if (col.getInflectionFDoublePrime() != null)
                tableES.addCell(new Paragraph(col.getInflectionFDoublePrime().toString(), FONT_DOC));
            else
                tableES.addCell("");

            if (col.getPeakEnergy() != null)
                tableES.addCell(new Paragraph(col.getPeakEnergy().toString(), FONT_DOC));
            else
                tableES.addCell("");

            if (col.getPeakFPrime() != null)
                tableES.addCell(new Paragraph(col.getPeakFPrime().toString(), FONT_DOC));
            else
                tableES.addCell("");

            if (col.getPeakFDoublePrime() != null)
                tableES.addCell(new Paragraph(col.getPeakFDoublePrime().toString(), FONT_DOC));
            else
                tableES.addCell("");

            if (col.getBeamSizeHorizontal() != null)
                tableES.addCell(new Paragraph(col.getBeamSizeHorizontal().toString(), FONT_DOC));
            else
                tableES.addCell("");

            if (col.getBeamSizeVertical() != null)
                tableES.addCell(new Paragraph(col.getBeamSizeVertical().toString(), FONT_DOC));
            else
                tableES.addCell("");

            if (col.getTransmissionFactor() != null)
                tableES.addCell(new Paragraph(col.getTransmissionFactor().toString(), FONT_DOC));
            else
                tableES.addCell("");

            if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) {
                // if (col.getCrystalClass()!= null) tableES.addCell(new
                // Paragraph(col.getCrystalClass().toString(),
                // new Font(Font.HELVETICA, 8)));
                // else tableES.addCell("");
                if (col.getCrystalClass() != null) {
                    int idCC = getCrystalClassIndex(listOfCrystalClass,
                            col.getCrystalClass().trim().toUpperCase());
                    if (idCC == -1) {
                        tableES.addCell(new Paragraph(col.getCrystalClass().toString(), FONT_DOC));
                    } else
                        tableES.addCell(
                                new Paragraph(listOfCrystalClass.get(idCC).getCrystalClassName(), FONT_DOC));
                } else
                    tableES.addCell("");
            }

            tableES.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
            if (col.getComments() != null)
                tableES.addCell(new Paragraph(col.getComments().toString(), FONT_DOC));
            else
                tableES.addCell("");
            tableES.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

        }
        document.add(tableES);
    }
}