Examples of HSSFPatriarch


Examples of org.apache.poi.hssf.usermodel.HSSFPatriarch

        for(int i = 0; i < wb.getNumberOfSheets(); i++){
            HSSFSheet sheet = wb.getSheetAt(i);
            DrawingAggregateInfo info = DrawingAggregateInfo.get(sheet);
            if(info != null) {
                aggs.put(i, info);
                HSSFPatriarch p = sheet.getDrawingPatriarch();

                // compare aggregate.serialize() with raw bytes from the record stream
                EscherAggregate agg = HSSFTestHelper.getEscherAggregate(p);

                byte[] dgBytes1 = info.getRawBytes();
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFPatriarch

        for(int i = 0; i < wb.getNumberOfSheets(); i++){
            HSSFSheet sheet = wb.getSheetAt(i);
            DrawingAggregateInfo info = DrawingAggregateInfo.get(sheet);
            if(info != null) {
                aggs.put(i, info);
                HSSFPatriarch p = sheet.getDrawingPatriarch();

                // compare aggregate.serialize() with raw bytes from the record stream
                EscherAggregate agg = HSSFTestHelper.getEscherAggregate(p);

                byte[] dgBytes1 = info.getRawBytes();
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFPatriarch

                builder.append(record.toXml(tab));
            }
        }
        List<Integer> sheets = getSheetsIndexes(params, workbook);
        for (Integer i : sheets) {
            HSSFPatriarch p = workbook.getSheetAt(i).getDrawingPatriarch();
            if(p != null ) {
                builder.append(tab).append("<sheet").append(i).append(">\n");
                builder.append(getHSSFPatriarchBoundAggregate(p).toXml(tab + "\t"));
                builder.append(tab).append("</sheet").append(i).append(">\n");
            }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFPatriarch

    private void addImageToSheet(int colNumber, int rowNumber, HSSFSheet sheet,
            String imageFile, double reqImageWidthMM, double reqImageHeightMM,
            int resizeBehaviour) throws FileNotFoundException, IOException,
                                                     IllegalArgumentException  {
        HSSFClientAnchor anchor = null;
        HSSFPatriarch patriarch = null;
        ClientAnchorDetail rowClientAnchorDetail = null;
        ClientAnchorDetail colClientAnchorDetail = null;

        // Validate the resizeBehaviour parameter.
        if((resizeBehaviour != AddDimensionedImage.EXPAND_COLUMN) &&
           (resizeBehaviour != AddDimensionedImage.EXPAND_ROW) &&
           (resizeBehaviour != AddDimensionedImage.EXPAND_ROW_AND_COLUMN) &&
           (resizeBehaviour != AddDimensionedImage.OVERLAY_ROW_AND_COLUMN)) {
            throw new IllegalArgumentException("Invalid value passed to the " +
                    "resizeBehaviour parameter of AddDimensionedImage.addImageToSheet()");
        }

        // Call methods to calculate how the image and sheet should be
        // manipulated to accomodate the image; columns and then rows.
        colClientAnchorDetail = this.fitImageToColumns(sheet, colNumber,
                reqImageWidthMM, resizeBehaviour);
        rowClientAnchorDetail = this.fitImageToRows(sheet, rowNumber,
                reqImageHeightMM, resizeBehaviour);

        // Having determined if and how to resize the rows, columns and/or the
        // image, create the HSSFClientAnchor object to position the image on
        // the worksheet. Note how the two ClientAnchorDetail records are
        // interrogated to recover the row/column co-ordinates and any insets.
        // The first two parameters are not used currently but could be if the
        // need arose to extend the functionality of this code by adding the
        // ability to specify that a clear 'border' be placed around the image.
        anchor = new HSSFClientAnchor(0,
                                      0,
                                      colClientAnchorDetail.getInset(),
                                      rowClientAnchorDetail.getInset(),
                                      (short)colClientAnchorDetail.getFromIndex(),
                                      rowClientAnchorDetail.getFromIndex(),
                                      (short)colClientAnchorDetail.getToIndex(),
                                      rowClientAnchorDetail.getToIndex());

        // For now, set the anchor type to do not move or resize the
        // image as the size of the row/column is adjusted. This could easilly
        // become another parameter passed to the method.
        anchor.setAnchorType(HSSFClientAnchor.DONT_MOVE_AND_RESIZE);

        // Now, add the picture to the workbook. Note that the type is assumed
        // to be a JPEG/JPG, this could easily (and should) be parameterised
        // however.
        int index = sheet.getWorkbook().addPicture(this.imageToBytes(imageFile),
                    HSSFWorkbook.PICTURE_TYPE_JPEG);

        // Get the drawing patriarch and create the picture.
        patriarch = sheet.createDrawingPatriarch();
        patriarch.createPicture(anchor, index);
    }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFPatriarch

      int height = Math.abs(image.getHeight());

      int index = workbook.addPicture(bytes, type);
      HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, row, column, row, column);

      HSSFPatriarch patriarch = s.createDrawingPatriarch();
      HSSFPicture picture = patriarch.createPicture(anchor, index);

      picture.resize();

      if ((width != 0) && (height != 0)) {
        picture.getImageDimension().setSize(width, height);
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFPatriarch

    JSONArray exportedSheets = worksheetJSON.getJSONArray(EXPORTED_SHEETS);
    for (int i = 0; i < sheetsNumber; i++) {
      JSONObject sheetJ = exportedSheets.getJSONObject(i);
      String sheetName = "Sheet " + i;
      HSSFSheet sheet = wb.createSheet(sheetName);
      HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
     
      for(int j = 0; j < 50; j++){
        sheet.createRow(j);
      }
     
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFPatriarch

            }
        }
        short columnCount = (short) (Math.min(modelSheet.getActiveColumnRange(),
                254) + 1);

        HSSFPatriarch patriarch = xlsSheet.createDrawingPatriarch();
        xlsSheet.setDisplayGridlines(showGridLines);

        // workbook.setSheetName( workbook.getNumberOfSheets( ) - 1,
        // modelSheet.getName( ),
        // HSSFWorkbook.ENCODING_UTF_16 );
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFPatriarch

                System.out.println("done");

                for(int i = 0; i < wb.getNumberOfSheets(); i++){
                    HSSFSheet sheet = wb.getSheetAt(i);
                    if(initDrawing) {
                        HSSFPatriarch dg = sheet.getDrawingPatriarch();
                    }
                }

                String outputFile = arg.replace(".xls", "-saved.xls");
                System.out.print("saving to " + outputFile + "...");
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFPatriarch

                builder.append(record.toXml(tab));
            }
        }
        List<Integer> sheets = getSheetsIndexes(params, workbook);
        for (Integer i : sheets) {
            HSSFPatriarch p = workbook.getSheetAt(i).getDrawingPatriarch();
            if(p != null ) {
                builder.append(tab).append("<sheet").append(i).append(">\n");
                builder.append(getHSSFPatriarchBoundAggregate(p).toXml(tab + "\t"));
                builder.append(tab).append("</sheet").append(i).append(">\n");
            }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFPatriarch

        for(int i = 0; i < wb.getNumberOfSheets(); i++){
            HSSFSheet sheet = wb.getSheetAt(i);
            DrawingAggregateInfo info = DrawingAggregateInfo.get(sheet);
            if(info != null) {
                aggs.put(i, info);
                HSSFPatriarch p = sheet.getDrawingPatriarch();

                // compare aggregate.serialize() with raw bytes from the record stream
                EscherAggregate agg = HSSFTestHelper.getEscherAggregate(p);

                byte[] dgBytes1 = info.getRawBytes();
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.