Package org.apache.poi

Examples of org.apache.poi.POIXMLException


     */
    public int addPicture(byte[] pictureData, int format) throws InvalidFormatException {
        try {
           return addPicture(new ByteArrayInputStream(pictureData), format);
        } catch (IOException e){
            throw new POIXMLException(e);
        }
    }
View Full Code Here


                    namedRanges.add(new XSSFName(ctName, this));
                }
            }

        } catch (XmlException e) {
            throw new POIXMLException(e);
        }
    }
View Full Code Here

            pkg.getPackageProperties().setCreatorProperty(DOCUMENT_CREATOR);

            return pkg;
        } catch (Exception e){
            throw new POIXMLException(e);
        }
    }
View Full Code Here

        try {
            OutputStream out = img.getPackagePart().getOutputStream();
            out.write(pictureData);
            out.close();
        } catch (IOException e){
            throw new POIXMLException(e);
        }
        pictures.add(img);
        return imageNumber - 1;
    }
View Full Code Here

        try {
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            srcSheet.write(out);
            clonedSheet.read(new ByteArrayInputStream(out.toByteArray()));
        } catch (IOException e){
            throw new POIXMLException("Failed to clone sheet", e);
        }
        CTWorksheet ct = clonedSheet.getCTWorksheet();
        if(ct.isSetDrawing()) {
            logger.log(POILogger.WARN, "Cloning sheets with drawings is not yet supported.");
            ct.unsetDrawing();
View Full Code Here

        nameRecord.setLocalSheetId(sheetNumber);

        XSSFName name = new XSSFName(nameRecord, this);
        for (XSSFName nr : namedRanges) {
            if (nr.equals(name))
                throw new POIXMLException("Builtin (" + builtInName
                        + ") already exists for sheet (" + sheetNumber + ")");
        }

        namedRanges.add(name);
        return name;
View Full Code Here

                 try {
                    pict = org.openxmlformats.schemas.drawingml.x2006.picture.CTPicture.Factory.parse(
                          pict.toString()
                    );
                 } catch(XmlException e) {
                    throw new POIXMLException(e);
                 }
              }
              if(pict instanceof org.openxmlformats.schemas.drawingml.x2006.picture.CTPicture) {
                 XWPFPicture picture = new XWPFPicture(
                       (org.openxmlformats.schemas.drawingml.x2006.picture.CTPicture)pict, p
View Full Code Here

               try {
                  _cellXf = CTXf.Factory.parse(
                        src.getCoreXf().toString()
                  );
               } catch(XmlException e) {
                  throw new POIXMLException(e);
               }
              
               // Copy the format
               String fmt = src.getDataFormatString();
               setDataFormat(
                     (new XSSFDataFormat(_stylesSource)).getFormat(fmt)
               );
              
               // Copy the font
               try {
                  CTFont ctFont = CTFont.Factory.parse(
                        src.getFont().getCTFont().toString()
                  );
                  XSSFFont font = new XSSFFont(ctFont);
                  font.registerTo(_stylesSource);
                  setFont(font);
               } catch(XmlException e) {
                  throw new POIXMLException(e);
               }
            }
           
            // Clear out cached details
            _font = null;
View Full Code Here

    @Override
    protected void onDocumentRead() {
        try {
            read(getPackagePart().getInputStream());
        } catch (IOException e){
            throw new POIXMLException(e);
        }
    }
View Full Code Here

    protected void read(InputStream is) throws IOException {
        try {
            worksheet = WorksheetDocument.Factory.parse(is).getWorksheet();
        } catch (XmlException e){
            throw new POIXMLException(e);
        }

        initRows(worksheet);
        columnHelper = new ColumnHelper(worksheet);
View Full Code Here

TOP

Related Classes of org.apache.poi.POIXMLException

Copyright © 2018 www.massapicom. 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.