Examples of OpenXML4JException


Examples of org.openxml4j.exceptions.OpenXML4JException

      if (!StreamHelper.saveXmlInStream(xmlDoc, out)) {
        return false;
      }
      zos.closeEntry();
    } catch (IOException e) {
      throw new OpenXML4JException(e.getLocalizedMessage());
    }
    return true;
  }
View Full Code Here

Examples of org.openxml4j.exceptions.OpenXML4JException

  public TableCell getCellAt(int line,int col) throws OpenXML4JException {
    //check parameter (col is check in getCell())
    if (line>=lines.size()) {
      String msg="line should be <"+ lines.size()+" line="+line;
      logger.error(msg);
      throw new OpenXML4JException(msg);
    }
//#ifdef JAVA5
    return lines.get(line).getCell(col);
//#else
/*
 
View Full Code Here

Examples of org.openxml4j.exceptions.OpenXML4JException

    PackagePartName relName =
      PackagingURIHelper.createPartName(rel.getTargetURI());
   
    PackagePart sheet = container.getPart(relName);
    if(sheet == null) {
      throw new OpenXML4JException("No part found for rel " + rel);
    }
    try {
      SAXReader reader = new SAXReader();
      return reader.read(sheet.getInputStream());
    } catch (DocumentException e) {
      throw new OpenXML4JException(e.getMessage());
    } catch (IOException io) {
      throw new OpenXML4JException(io.getMessage());
    }
  }
View Full Code Here

Examples of org.openxml4j.exceptions.OpenXML4JException

  private void openWorkbook() throws Exception {
    // Find the package part for it
    ArrayList<PackagePart> wbs =
      container.getPartsByContentType(MAIN_CONTENT_TYPE);
    if(wbs.size() != 1) {
      throw new OpenXML4JException("Expecting one entry with content type of " + MAIN_CONTENT_TYPE + ", but found " + wbs.size());
    }
    workbookPart = wbs.get(0);
   
    // And load it up
    try {
      SAXReader reader = new SAXReader();
      workbook = reader.read(workbookPart.getInputStream());
    } catch (DocumentException e) {
      throw new OpenXML4JException(e.getMessage());
    }
  }
View Full Code Here

Examples of org.openxml4j.exceptions.OpenXML4JException

                .getPartName().getName()) + "'");
        PartMarshaller marshaller = partMarshallers
            .get(part.contentType);
        if (marshaller != null) {
          if (!marshaller.marshall(part, zos)) {
            throw new OpenXML4JException(
                "The part "
                    + part.getPartName().getURI()
                    + " fail to be saved in the stream with marshaller "
                    + marshaller);
          }
        } else {
          if (!defaultPartMarshaller.marshall(part, zos))
            throw new OpenXML4JException(
                "The part "
                    + part.getPartName().getURI()
                    + " fail to be saved in the stream with marshaller "
                    + defaultPartMarshaller);
        }
View Full Code Here

Examples of org.openxml4j.exceptions.OpenXML4JException

    this.nbCellHorizontallyMerged =1;//no merge
  }

  public CellWidth(int nbCellHorizontallyMerged) throws OpenXML4JException {
    if (nbCellHorizontallyMerged<1) {
      throw new OpenXML4JException("Cell merge should be >= 1");
      // 1 -> no merge, cell is alone
      // 2 -> merge with the next one
      // 3                    2 next ones
    }
    this.nbCellHorizontallyMerged = nbCellHorizontallyMerged;
View Full Code Here

Examples of org.openxml4j.exceptions.OpenXML4JException

  public TableCell getCell(int col) throws OpenXML4JException {
    if (col>=cells.size()) {
      String msg="col should be <"+ cells.size()+" col="+col;
      logger.error(msg);
      throw new OpenXML4JException(msg);
    }
//#ifdef JAVA5
    return cells.get(col);
//#else
/*
 
View Full Code Here

Examples of org.openxml4j.exceptions.OpenXML4JException

  public WordDocument(Package pack) throws OpenXML4JException {
    super(pack);
    mainDocumentHelper = new MainDocumentHelper();
    if (!mainDocumentHelper.parseDocumentContent()) {
      throw new OpenXML4JException("error in parsing doc");
    }
    container.addMarshaller(WMLContentType.WORD_MAIN_DOCUMENT,
        mainDocumentHelper);
  }
View Full Code Here

Examples of org.openxml4j.exceptions.OpenXML4JException

    public boolean marshall(PackagePart part, OutputStream os)
        throws OpenXML4JException {
      if (!(os instanceof ZipOutputStream)) {
        logger.error("ZipOutputSTream expected!"
            + os.getClass().getName());
        throw new OpenXML4JException("ZipOutputSTream expected!");
      }

      ZipOutputStream out = (ZipOutputStream) os;

      // save in zip
View Full Code Here

Examples of org.openxml4j.exceptions.OpenXML4JException

      while(relIter.hasNext()) {
        PackageRelationship rel = relIter.next();
        hyperlinks.add(new XWPFHyperlink(rel.getId(), rel.getTargetURI().toString()));
      }
    } catch(Exception e) {
      throw new OpenXML4JException(e.getLocalizedMessage());
    }

    // Get the comments, if there are any
    PackageRelationshipCollection commentsRel = getCmntRelations();
    if(commentsRel != null && commentsRel.size() > 0) {
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.