Examples of ExcelWorkbookException


Examples of org.jboss.seam.excel.ExcelWorkbookException

     * @param url
     *            The target URL
     */
    private void addHyperlink(UIHyperlink uiHyperlink) {
        if (worksheet == null) {
            throw new ExcelWorkbookException(
                    "Can't add a hyperlink before creating a worksheet");
        }

        int useStartColumn = uiHyperlink.getStartColumn() == null ? currentColumnIndex
                : uiHyperlink.getStartColumn();
        int useStartRow = uiHyperlink.getStartRow() == null ? currentRowIndex
                : uiHyperlink.getStartRow();
        int useEndColumn = uiHyperlink.getEndColumn() == null ? useStartColumn
                : uiHyperlink.getEndColumn();
        int useEndRow = uiHyperlink.getEndRow() == null ? useStartRow
                : uiHyperlink.getEndRow();
        String useDescription = uiHyperlink.getDescription() == null ? uiHyperlink
                .getURL()
                : uiHyperlink.getDescription();
        URL useURL = null;

        try {
            useURL = new URL(uiHyperlink.getURL());
        } catch (MalformedURLException e) {
            throw new ExcelWorkbookException("Bad url", e);
        }
        try {
            worksheet.addHyperlink(new WritableHyperlink(useStartColumn,
                    useStartRow, useEndColumn, useEndRow, useURL,
                    useDescription));
        } catch (Exception e) {
            throw new ExcelWorkbookException("Could not add hyperlink", e);
        }
    }
View Full Code Here

Examples of org.jboss.seam.excel.ExcelWorkbookException

            break;
        case image:
            addImage((UIImage) item);
            break;
        default:
            throw new ExcelWorkbookException(Interpolator.instance()
                    .interpolate("Unknown item type {0}", item.getItemType()));
        }
    }
View Full Code Here

Examples of org.jboss.seam.excel.ExcelWorkbookException

            break;
        case add_row_pagebreak:
            addRowPageBreak((UIRowPageBreak) command);
            break;
        default:
            throw new ExcelWorkbookException(
                    Interpolator.instance().interpolate("Unknown command #0",
                            command.getCommandType()));
        }
    }
View Full Code Here

Examples of org.jboss.seam.excel.ExcelWorkbookException

    private void addRowPageBreak(UIRowPageBreak command) {
        if (log.isTraceEnabled()) {
            log.trace("Adding row page break #0", command);
        }
        if (worksheet == null) {
            throw new ExcelWorkbookException(
                    "Can't add row page breaks before creating a worksheet");
        }
        int useRow = command.getRow() != null ? command.getRow()
                : currentRowIndex;
        worksheet.addRowPageBreak(useRow);
View Full Code Here

Examples of org.jboss.seam.excel.ExcelWorkbookException

    private void groupRows(UIGroupRows command) {
        if (log.isTraceEnabled()) {
            log.trace("Grouping rows #0", command);
        }
        if (worksheet == null) {
            throw new ExcelWorkbookException(
                    "Can't group rows before creating a worksheet");
        }
        if (command.getStartRow() == null || command.getEndRow() == null) {
            throw new ExcelWorkbookException(
                    "Must define starting and ending rows when grouping rows");
        }
        boolean collapse = command.getCollapse() == null ? false : command
                .getCollapse();
        try {
            worksheet.setRowGroup(command.getStartRow(), command.getEndRow(),
                    collapse);
        } catch (Exception e) {
            throw new ExcelWorkbookException("Could not group columns", e);
        }
    }
View Full Code Here

Examples of org.jboss.seam.excel.ExcelWorkbookException

    private void groupColumns(UIGroupColumns command) {
        if (log.isTraceEnabled()) {
            log.trace("Grouping columns #0", command);
        }
        if (worksheet == null) {
            throw new ExcelWorkbookException(
                    "Can't group columns before creating a worksheet");
        }
        if (command.getStartColumn() == null || command.getEndColumn() == null) {
            throw new ExcelWorkbookException(
                    "Must define starting and ending columns when grouping columns");
        }
        // JExcelAPI bug workaround
        for (int i = command.getStartColumn(); i <= command.getEndColumn(); i++) {
            worksheet.setColumnView(i, new CellView());
        }
        boolean collapse = command.getCollapse() == null ? false : command
                .getCollapse();
        try {
            worksheet.setColumnGroup(command.getStartColumn(), command
                    .getEndColumn(), collapse);
        } catch (Exception e) {
            throw new ExcelWorkbookException("Could not group columns", e);
        }
    }
View Full Code Here

Examples of org.jboss.seam.excel.ExcelWorkbookException

    private void mergeCells(UIMergeCells command) {
        if (log.isTraceEnabled()) {
            log.trace("Merging cells #0", command);
        }
        if (worksheet == null) {
            throw new ExcelWorkbookException(
                    "Can't merge cells before creating a worksheet");
        }
        if (command.getStartColumn() == null || command.getStartRow() == null
                || command.getEndColumn() == null
                || command.getEndRow() == null) {
            throw new ExcelWorkbookException(
                    "All start/end columns/rows must be set when merging cells");
        }
        try {
            worksheet
                    .mergeCells(command.getStartColumn(),
                            command.getStartRow(), command.getEndColumn(),
                            command.getEndRow());
        } catch (Exception e) {
            throw new ExcelWorkbookException("Couldn't merge cells", e);
        }
    }
View Full Code Here

Examples of org.jboss.seam.excel.ExcelWorkbookException

     */
    public void setStylesheets(List<UILink> stylesheets) {
        try {
            jxlHelper.setStylesheets(stylesheets);
        } catch (Exception e) {
            throw new ExcelWorkbookException("Could not parse stylesheet", e);
        }
    }
View Full Code Here

Examples of org.jboss.seam.excel.ExcelWorkbookException

         return null;
      }
      catch (Exception e)
      {
         String message = Interpolator.instance().interpolate("Could not read field #0 of bean #1", field, component.getId());
         throw new ExcelWorkbookException(message, e);
      }
   }
View Full Code Here

Examples of org.jboss.seam.excel.ExcelWorkbookException

               // Skip it, just moving along
            } else if (isNumeric(value)) {
               styleMap.put(indexedKey, Integer.parseInt(value));
            } else {
               String message = Interpolator.instance().interpolate("Column widths must be numerical or *, not #0", value);
               throw new ExcelWorkbookException(message);
            }
         }
         return styleMap;
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.