Example usage for com.lowagie.text Element ALIGN_LEFT

List of usage examples for com.lowagie.text Element ALIGN_LEFT

Introduction

In this page you can find the example usage for com.lowagie.text Element ALIGN_LEFT.

Prototype

int ALIGN_LEFT

To view the source code for com.lowagie.text Element ALIGN_LEFT.

Click Source Link

Document

A possible value for paragraph alignment.

Usage

From source file:org.unitime.timetable.webutil.pdf.PdfInstructionalOfferingTableBuilder.java

License:Open Source License

private PdfPCell pdfBuildManager(PreferenceGroup prefGroup, boolean isEditable) {
    Color color = (isEditable ? sEnableColor : sDisableColor);
    PdfPCell cell = createCell();//from ww w.  j ava2  s  .c  o  m

    Department managingDept = null;
    if (prefGroup instanceof Class_) {
        managingDept = ((Class_) prefGroup).getManagingDept();
    } else if (prefGroup instanceof SchedulingSubpart) {
        managingDept = ((SchedulingSubpart) prefGroup).getManagingDept();
    }
    if (managingDept != null) {
        addText(cell, managingDept.getShortLabel(), false, false, Element.ALIGN_LEFT, color, true);
    }

    return cell;
}

From source file:org.unitime.timetable.webutil.pdf.PdfInstructionalOfferingTableBuilder.java

License:Open Source License

private PdfPCell pdfBuildAssignedTime(ClassAssignmentProxy classAssignment, PreferenceGroup prefGroup,
        boolean isEditable) {
    Color color = (isEditable ? sEnableColor : sDisableColor);
    PdfPCell cell = createCell();//from   w w  w.  ja va2 s.c  om

    if (classAssignment != null && prefGroup instanceof Class_) {
        Class_ aClass = (Class_) prefGroup;
        Assignment a = null;
        AssignmentPreferenceInfo p = null;
        try {
            a = classAssignment.getAssignment(aClass);
            p = classAssignment.getAssignmentInfo((Class_) prefGroup);
        } catch (Exception e) {
            Debug.error(e);
        }
        if (a != null) {
            StringBuffer sb = new StringBuffer();
            Enumeration<Integer> e = a.getTimeLocation().getDays();
            while (e.hasMoreElements()) {
                sb.append(Constants.DAY_NAMES_SHORT[e.nextElement()]);
            }
            sb.append(" ");
            sb.append(a.getTimeLocation().getStartTimeHeader(CONSTANTS.useAmPm()));
            sb.append("-");
            sb.append(a.getTimeLocation().getEndTimeHeader(CONSTANTS.useAmPm()));
            addText(cell, sb.toString(), false, false, Element.ALIGN_LEFT, (p == null || !isEditable ? color
                    : PreferenceLevel.int2awtColor(p.getTimePreference(), color)), true);
        }
    }

    return cell;
}

From source file:org.unitime.timetable.webutil.pdf.PdfInstructionalOfferingTableBuilder.java

License:Open Source License

private PdfPCell pdfBuildAssignedRoom(ClassAssignmentProxy classAssignment, PreferenceGroup prefGroup,
        boolean isEditable) {
    Color color = (isEditable ? sEnableColor : sDisableColor);
    PdfPCell cell = createCell();/*from  w  w w  .  j a  v  a  2s.c o m*/

    if (classAssignment != null && prefGroup instanceof Class_) {
        Class_ aClass = (Class_) prefGroup;
        Assignment a = null;
        AssignmentPreferenceInfo p = null;
        try {
            a = classAssignment.getAssignment(aClass);
            p = classAssignment.getAssignmentInfo((Class_) prefGroup);
        } catch (Exception e) {
            Debug.error(e);
        }
        if (a != null) {
            StringBuffer sb = new StringBuffer();
            Iterator it2 = a.getRooms().iterator();
            while (it2.hasNext()) {
                Location room = (Location) it2.next();
                sb.append(room.getLabel());
                if (it2.hasNext()) {
                    sb.append("\n");
                }
            }
            addText(cell, sb.toString(), false, false, Element.ALIGN_LEFT, (p == null || !isEditable ? color
                    : PreferenceLevel.int2awtColor(p.getTimePreference(), color)), true);
        }
    }

    return cell;
}

From source file:org.unitime.timetable.webutil.pdf.PdfInstructionalOfferingTableBuilder.java

License:Open Source License

private PdfPCell pdfBuildAssignedRoomCapacity(ClassAssignmentProxy classAssignment, PreferenceGroup prefGroup,
        boolean isEditable) {
    Color color = (isEditable ? sEnableColor : sDisableColor);
    PdfPCell cell = createCell();/*from   w ww  . j  av  a  2  s . com*/

    if (classAssignment != null && prefGroup instanceof Class_) {
        Class_ aClass = (Class_) prefGroup;
        Assignment a = null;
        try {
            a = classAssignment.getAssignment(aClass);
        } catch (Exception e) {
            Debug.error(e);
        }
        if (a != null) {
            StringBuffer sb = new StringBuffer();
            Iterator it2 = a.getRooms().iterator();
            while (it2.hasNext()) {
                sb.append(((Location) it2.next()).getCapacity());
                if (it2.hasNext()) {
                    sb.append("\n");
                }
            }
            addText(cell, sb.toString(), false, false, Element.ALIGN_LEFT, color, true);
        }
    }

    return cell;
}

From source file:org.unitime.timetable.webutil.pdf.PdfInstructionalOfferingTableBuilder.java

License:Open Source License

private PdfPCell pdfBuildExamName(TreeSet exams, boolean isEditable) {
    StringBuffer sb = new StringBuffer();
    for (Iterator i = exams.iterator(); i.hasNext();) {
        Exam exam = (Exam) i.next();/*from w  w  w  .ja v a  2s .c o  m*/
        sb.append(exam.getLabel());
        if (i.hasNext())
            sb.append("\n");
    }
    Color color = (isEditable ? sEnableColor : sDisableColor);
    PdfPCell cell = createCell();
    addText(cell, sb.toString(), false, false, Element.ALIGN_LEFT, color, true);
    return cell;
}

From source file:org.unitime.timetable.webutil.pdf.PdfInstructionalOfferingTableBuilder.java

License:Open Source License

private PdfPCell pdfBuildExamPeriod(ExamAssignmentProxy examAssignment, TreeSet exams, boolean isEditable) {
    StringBuffer sb = new StringBuffer();
    for (Iterator i = exams.iterator(); i.hasNext();) {
        Exam exam = (Exam) i.next();//ww  w  .ja  va  2 s .c om
        if (examAssignment != null && examAssignment.getExamTypeId().equals(exam.getExamType().getUniqueId())) {
            ExamAssignment ea = examAssignment.getAssignment(exam.getUniqueId());
            if (ea == null && !isShowExamName())
                continue;
            sb.append(ea == null ? "" : ea.getPeriodAbbreviation());
        } else {
            if (exam.getAssignedPeriod() == null && !isShowExamName())
                continue;
            sb.append(exam.getAssignedPeriod() == null ? "" : exam.getAssignedPeriod().getAbbreviation());
        }
        if (i.hasNext())
            sb.append("\n");
    }
    Color color = (isEditable ? sEnableColor : sDisableColor);
    PdfPCell cell = createCell();
    addText(cell, sb.toString(), false, false, Element.ALIGN_LEFT, color, true);
    return cell;
}

From source file:org.unitime.timetable.webutil.pdf.PdfInstructionalOfferingTableBuilder.java

License:Open Source License

private PdfPCell pdfBuildExamRoom(ExamAssignmentProxy examAssignment, TreeSet exams, boolean isEditable) {
    StringBuffer sb = new StringBuffer();
    for (Iterator i = exams.iterator(); i.hasNext();) {
        Exam exam = (Exam) i.next();//from   ww  w . j av  a 2s .  c  o m
        if (examAssignment != null && examAssignment.getExamTypeId().equals(exam.getExamType().getUniqueId())) {
            ExamAssignment ea = examAssignment.getAssignment(exam.getUniqueId());
            if (ea == null && !isShowExamName())
                continue;
            sb.append(ea == null ? "" : ea.getRoomsName(", "));
        } else {
            if (exam.getAssignedPeriod() == null && !isShowExamName())
                continue;
            for (Iterator j = new TreeSet(exam.getAssignedRooms()).iterator(); j.hasNext();) {
                Location location = (Location) j.next();
                sb.append(location.getLabel());
                if (j.hasNext())
                    sb.append(", ");
            }
        }
        if (i.hasNext())
            sb.append("\n");
    }
    Color color = (isEditable ? sEnableColor : sDisableColor);
    PdfPCell cell = createCell();
    addText(cell, sb.toString(), false, false, Element.ALIGN_LEFT, color, true);
    return cell;
}

From source file:org.unitime.timetable.webutil.pdf.PdfInstructionalOfferingTableBuilder.java

License:Open Source License

protected void pdfBuildConfigRow(Vector subpartIds, ClassAssignmentProxy classAssignment,
        ExamAssignmentProxy examAssignment, CourseOffering co, InstrOfferingConfig ioc, SessionContext context,
        boolean printConfigLine) {
    iBgColor = sBgColorConfig;//  www  . j a  va 2s.  c  om
    boolean isEditable = context.hasPermission(ioc.getInstructionalOffering(),
            Right.InstructionalOfferingDetail);
    Color color = (isEditable ? sEnableColor : sDisableColor);
    String configName = ioc.getName();
    boolean unlimited = ioc.isUnlimitedEnrollment().booleanValue();
    boolean hasConfig = false;
    if (printConfigLine) {
        if (isShowLabel()) {
            if (configName == null || configName.trim().length() == 0)
                configName = ioc.getUniqueId().toString();
            PdfPCell cell = createCell();
            addText(cell, indent + "Configuration " + configName, false, false, Element.ALIGN_LEFT, color,
                    true);
            iPdfTable.addCell(cell);
        }
        if (isShowDivSec()) {
            iPdfTable.addCell(createCell());
        }
        if (isShowDemand()) {
            iPdfTable.addCell(createCell());
        }
        if (isShowProjectedDemand()) {
            iPdfTable.addCell(createCell());
        }
        if (isShowLimit()) {
            PdfPCell cell = createCell();
            addText(cell, (unlimited ? "inf" : ioc.getLimit().toString()), false, false, Element.ALIGN_RIGHT,
                    color, true);
            iPdfTable.addCell(cell);
        }
        if (isShowRoomRatio()) {
            iPdfTable.addCell(createCell());
        }
        if (isShowManager()) {
            iPdfTable.addCell(createCell());
        }
        if (isShowDatePattern()) {
            iPdfTable.addCell(createCell());
        }
        if (isShowMinPerWk()) {
            iPdfTable.addCell(createCell());
        }
        if (isShowTimePattern()) {
            iPdfTable.addCell(createCell());
        }
        if (isShowPreferences()) {
            for (int j = 0; j < PREFERENCE_COLUMN_ORDER.length
                    + (getDisplayDistributionPrefs() ? 0 : -1); j++) {
                iPdfTable.addCell(createCell());
            }
        }
        if (isShowInstructor()) {
            iPdfTable.addCell(createCell());
        }
        if (getDisplayTimetable() && isShowTimetable()) {
            for (int j = 0; j < TIMETABLE_COLUMN_ORDER.length; j++) {
                iPdfTable.addCell(createCell());
            }
        }
        if (isShowTitle()) {
            iPdfTable.addCell(createCell());
        }
        if (isShowCredit()) {
            iPdfTable.addCell(createCell());
        }
        if (isShowSubpartCredit()) {
            iPdfTable.addCell(createCell());
        }
        if (isShowConsent()) {
            iPdfTable.addCell(createCell());
        }
        if (isShowSchedulePrintNote()) {
            iPdfTable.addCell(createCell());
        }
        if (isShowNote()) {
            iPdfTable.addCell(createCell());
        }

        if (isShowExam()) {
            TreeSet exams = new TreeSet(Exam.findAll(ExamOwner.sOwnerTypeConfig, ioc.getUniqueId()));
            if (isShowExamName()) {
                iPdfTable.addCell(pdfBuildExamName(exams, isEditable));
            }
            if (isShowExamTimetable()) {
                iPdfTable.addCell(pdfBuildExamPeriod(examAssignment, exams, isEditable));
                iPdfTable.addCell(pdfBuildExamRoom(examAssignment, exams, isEditable));
            }
        }

        hasConfig = true;
    }

    ArrayList subpartList = new ArrayList(ioc.getSchedulingSubparts());
    Collections.sort(subpartList, new SchedulingSubpartComparator());
    Iterator it = subpartList.iterator();
    SchedulingSubpart ss = null;
    while (it.hasNext()) {
        ss = (SchedulingSubpart) it.next();
        if (ss.getParentSubpart() == null) {
            pdfBuildSchedulingSubpartRows(subpartIds, classAssignment, examAssignment, co, ss,
                    (hasConfig ? indent + indent : indent), context);
        }
    }
    it = subpartList.iterator();
    int ct = 0;
    String prevLabel = null;
    while (it.hasNext()) {
        ss = (SchedulingSubpart) it.next();
        if (ss.getParentSubpart() == null) {
            if (ss.getClasses() != null) {
                Vector classes = new Vector(ss.getClasses());
                Collections.sort(classes, getClassComparator());
                Iterator cIt = classes.iterator();
                Class_ c = null;
                while (cIt.hasNext()) {
                    c = (Class_) cIt.next();
                    pdfBuildClassRows(classAssignment, examAssignment, ++ct, co, c, indent, context, prevLabel);
                    prevLabel = c.htmlLabel();
                }
            }
        }
    }
}

From source file:org.unitime.timetable.webutil.pdf.PdfInstructionalOfferingTableBuilder.java

License:Open Source License

private void pdfAddInstrOffrRowsToTable(ClassAssignmentProxy classAssignment,
        ExamAssignmentProxy examAssignment, InstructionalOffering io, Long subjectAreaId,
        SessionContext context) {//from w ww  . j  ava 2s  .  c  o  m
    iBgColor = sBgColorOffering;
    CourseOffering co = io.findSortCourseOfferingForSubjectArea(subjectAreaId);
    boolean isEditable = context.hasPermission(co.getInstructionalOffering(),
            Right.InstructionalOfferingDetail);
    boolean isManagedAs = !co.isIsControl().booleanValue();
    Color color = (isEditable ? sEnableColor : sDisableColor);

    if (isShowLabel()) {
        iPdfTable.addCell(pdfSubjectAndCourseInfo(io, co));
    }
    if (isShowDivSec()) {
        iPdfTable.addCell(createCell());
    }
    if (isShowDemand()) {
        PdfPCell cell = createCell();
        if (StudentClassEnrollment.sessionHasEnrollments(io.getSessionId())) {
            addText(cell, (io.getEnrollment() != null ? io.getEnrollment().toString() : "0"), false, false,
                    Element.ALIGN_RIGHT, (co.isIsControl() ? color : sDisableColor), true);
        } else {
            addText(cell, (io.getDemand() != null ? io.getDemand().toString() : "0"), false, false,
                    Element.ALIGN_RIGHT, (co.isIsControl() ? color : sDisableColor), true);
        }
        iPdfTable.addCell(cell);
    }
    if (isShowProjectedDemand()) {
        PdfPCell cell = createCell();
        addText(cell, (io.getProjectedDemand() != null ? io.getProjectedDemand().toString() : "0"), false,
                false, Element.ALIGN_RIGHT, (co.isIsControl() ? color : sDisableColor), true);
        iPdfTable.addCell(cell);
    }
    if (isShowLimit()) {
        boolean unlimited = false;
        for (Iterator x = io.getInstrOfferingConfigs().iterator(); !unlimited && x.hasNext();)
            if ((((InstrOfferingConfig) x.next())).isUnlimitedEnrollment().booleanValue())
                unlimited = true;
        PdfPCell cell = createCell();
        addText(cell, (unlimited ? "inf" : io.getLimit() == null ? "0" : io.getLimit().toString()), false,
                false, Element.ALIGN_RIGHT, (co.isIsControl() ? color : sDisableColor), true);
        iPdfTable.addCell(cell);
    }
    int emptyCels = 0;
    if (isShowRoomRatio()) {
        emptyCels++;
    }
    if (isShowManager()) {
        emptyCels++;
    }
    if (isShowDatePattern()) {
        emptyCels++;
    }
    if (isShowMinPerWk()) {
        emptyCels++;
    }
    if (isShowTimePattern()) {
        emptyCels++;
    }
    if (isShowPreferences()) {
        emptyCels += PREFERENCE_COLUMN_ORDER.length + (getDisplayDistributionPrefs() ? 0 : -1);
    }
    if (isShowInstructor()) {
        emptyCels++;
    }
    if (getDisplayTimetable() && isShowTimetable()) {
        emptyCels += TIMETABLE_COLUMN_ORDER.length;
    }
    if (emptyCels > 0) {
        PdfPCell managedCell = createCell();
        if (isManagedAs) {
            if (!isShowTitle() && io.getControllingCourseOffering().getTitle() != null) {
                if (co.getTitle() != null && co.getTitle().length() > 0) {
                    addText(managedCell,
                            "     " + co.getTitle() + " (Managed As "
                                    + io.getControllingCourseOffering().getCourseName() + ")",
                            true, false, Element.ALIGN_LEFT, sDisableColor, false);
                } else {
                    addText(managedCell, "     Managed As " + io.getControllingCourseOffering().getCourseName(),
                            true, false, Element.ALIGN_LEFT, sDisableColor, true);
                }
                for (Iterator it = io
                        .courseOfferingsMinusSortCourseOfferingForSubjectArea(co.getSubjectArea().getUniqueId())
                        .iterator(); it.hasNext();) {
                    CourseOffering x = (CourseOffering) it.next();
                    addText(managedCell, (x.getTitle() == null ? "" : "     " + x.getTitle()), false, false,
                            Element.ALIGN_LEFT, sDisableColor, true);
                }
            } else {
                addText(managedCell, "     Managed As " + io.getControllingCourseOffering().getCourseName(),
                        true, false, Element.ALIGN_LEFT, sDisableColor, true);
            }
        } else {
            if (!isShowTitle() && io.getControllingCourseOffering().getTitle() != null) {
                addText(managedCell, (co.getTitle() == null ? "" : "      " + co.getTitle()), true, false,
                        Element.ALIGN_LEFT, color, true);
                for (Iterator it = io
                        .courseOfferingsMinusSortCourseOfferingForSubjectArea(co.getSubjectArea().getUniqueId())
                        .iterator(); it.hasNext();) {
                    CourseOffering x = (CourseOffering) it.next();
                    addText(managedCell, (x.getTitle() == null ? "" : "      " + x.getTitle()), false, false,
                            Element.ALIGN_LEFT, sDisableColor, true);
                }
            }
        }
        managedCell.setColspan(emptyCels);
        iPdfTable.addCell(managedCell);

    }
    if (isShowTitle()) {
        PdfPCell titleCell = createCell();
        addText(titleCell,
                (io.getControllingCourseOffering().getTitle() != null
                        ? "      " + io.getControllingCourseOffering().getTitle()
                        : ""),
                false, false, Element.ALIGN_LEFT, color, true);
        iPdfTable.addCell(titleCell);
    }
    if (isShowCredit()) {
        PdfPCell cell = createCell();
        addText(cell, (co.getCredit() != null ? co.getCredit().creditAbbv() : ""), true, false,
                Element.ALIGN_LEFT, isManagedAs ? sDisableColor : color, true);
        for (Iterator it = io
                .courseOfferingsMinusSortCourseOfferingForSubjectArea(co.getSubjectArea().getUniqueId())
                .iterator(); it.hasNext();) {
            CourseOffering x = (CourseOffering) it.next();
            addText(cell, (x.getCredit() != null ? x.getCredit().creditAbbv() : ""), false, false,
                    Element.ALIGN_LEFT, sDisableColor, true);
        }
        iPdfTable.addCell(cell);
    }
    if (isShowSubpartCredit()) {
        iPdfTable.addCell(createCell());
    }
    if (isShowConsent()) {
        PdfPCell cell = createCell();
        addText(cell, co.getConsentType() != null ? co.getConsentType().getAbbv() : MSG.noConsentRequired(),
                true, false, Element.ALIGN_LEFT, isManagedAs ? sDisableColor : color, true);
        for (Iterator it = io
                .courseOfferingsMinusSortCourseOfferingForSubjectArea(co.getSubjectArea().getUniqueId())
                .iterator(); it.hasNext();) {
            CourseOffering x = (CourseOffering) it.next();
            addText(cell, (x.getConsentType() != null ? x.getConsentType().getAbbv() : MSG.noConsentRequired()),
                    false, false, Element.ALIGN_LEFT, sDisableColor, true);
        }
        iPdfTable.addCell(cell);
    }
    if (isShowSchedulePrintNote()) {
        iPdfTable.addCell(pdfBuildSchedulePrintNote(io, isEditable, context.getUser()));
    }
    if (isShowNote()) {
        iPdfTable.addCell(createCell());
    }
    if (isShowExam()) {
        TreeSet exams = new TreeSet(Exam.findAll(ExamOwner.sOwnerTypeOffering, io.getUniqueId()));
        for (Iterator i = io.getCourseOfferings().iterator(); i.hasNext();) {
            CourseOffering cox = (CourseOffering) i.next();
            exams.addAll(Exam.findAll(ExamOwner.sOwnerTypeCourse, cox.getUniqueId()));
        }
        if (io.getInstrOfferingConfigs().size() == 1) {
            for (Iterator i = io.getInstrOfferingConfigs().iterator(); i.hasNext();) {
                InstrOfferingConfig ioc = (InstrOfferingConfig) i.next();
                exams.addAll(Exam.findAll(ExamOwner.sOwnerTypeConfig, ioc.getUniqueId()));
            }
        }
        if (isShowExamName()) {
            iPdfTable.addCell(pdfBuildExamName(exams, isEditable));
        }
        if (isShowExamTimetable()) {
            iPdfTable.addCell(pdfBuildExamPeriod(examAssignment, exams, isEditable));
            iPdfTable.addCell(pdfBuildExamRoom(examAssignment, exams, isEditable));
        }
    }

    if (io.getInstrOfferingConfigs() != null & !io.getInstrOfferingConfigs().isEmpty()) {
        TreeSet configs = new TreeSet(new InstrOfferingConfigComparator(
                io.getControllingCourseOffering().getSubjectArea().getUniqueId()));
        configs.addAll(io.getInstrOfferingConfigs());
        pdfBuildConfigRows(classAssignment, examAssignment, io.getControllingCourseOffering(), configs, context,
                true);
    }
}

From source file:org.unitime.timetable.webutil.PdfWebTable.java

License:Open Source License

/**
 * Prints pdf table. By default does not split table across
 * page boundaries /*from   w  w  w.  j a va2s.c  o  m*/
 * @param ordCol
 * @param keepTogether true does not split table across pages
 * @return
 */
public PdfPTable printPdfTable(int ordCol, boolean keepTogether) {
    PdfPTable table = new PdfPTable(getNrColumns());
    table.setWidthPercentage(100);
    table.getDefaultCell().setPadding(3);
    table.getDefaultCell().setBorderWidth(0);
    table.setSplitRows(false);
    table.setKeepTogether(keepTogether);

    boolean asc = (ordCol == 0 || iAsc == null || iAsc.length <= Math.abs(ordCol) - 1 ? true
            : iAsc[Math.abs(ordCol) - 1]);
    if (ordCol < 0)
        asc = !asc;

    widths = new float[iColumns];
    for (int i = 0; i < iColumns; i++)
        widths[i] = 0f;

    String lastLine[] = new String[Math.max(iColumns, (iHeaders == null ? 0 : iHeaders.length))];

    if (iHeaders != null) {
        for (int i = 0; i < iColumns; i++) {
            if (isFiltered(i))
                continue;
            PdfPCell c = createCell();
            c.setBorderWidthBottom(1);
            float width = addText(c, iHeaders[i] == null ? "" : iHeaders[i], true);
            widths[i] = Math.max(widths[i], width);
            String align = (iAlign != null ? iAlign[i] : "left");
            if ("left".equals(align))
                c.setHorizontalAlignment(Element.ALIGN_LEFT);
            if ("right".equals(align))
                c.setHorizontalAlignment(Element.ALIGN_RIGHT);
            if ("center".equals(align))
                c.setHorizontalAlignment(Element.ALIGN_CENTER);
            table.addCell(c);
        }
        table.setHeaderRows(1);
    }
    if (ordCol != 0) {
        Collections.sort(iLines, new WebTableComparator(Math.abs(ordCol) - 1, asc));
    }
    for (int el = 0; el < iLines.size(); el++) {
        WebTableLine wtline = (WebTableLine) iLines.elementAt(el);
        String[] line = wtline.getLine();
        boolean blank = iBlankWhenSame;
        for (int i = 0; i < iColumns; i++) {
            if (isFiltered(i))
                continue;
            if (blank && line[i] != null && !line[i].equals(lastLine[i]))
                blank = false;
            PdfPCell c = createCell();
            float width = addText(c, blank || line[i] == null ? "" : line[i], false);
            widths[i] = Math.max(widths[i], width);
            String align = (iAlign != null ? iAlign[i] : "left");
            if ("left".equals(align))
                c.setHorizontalAlignment(Element.ALIGN_LEFT);
            if ("right".equals(align))
                c.setHorizontalAlignment(Element.ALIGN_RIGHT);
            if ("center".equals(align))
                c.setHorizontalAlignment(Element.ALIGN_CENTER);
            applyPdfStyle(c, wtline, (el + 1 < iLines.size() ? (WebTableLine) iLines.elementAt(el + 1) : null),
                    ordCol);
            table.addCell(c);
            lastLine[i] = line[i];
        }
    }

    try {
        if (getNrFilteredColumns() < 0) {
            table.setWidths(widths);
        } else {
            float[] x = new float[getNrColumns()];
            int idx = 0;
            for (int i = 0; i < iColumns; i++) {
                if (isFiltered(i))
                    continue;
                x[idx++] = widths[i];
            }
            table.setWidths(x);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    return table;
}