Example usage for org.apache.poi.hssf.usermodel HSSFPicture resize

List of usage examples for org.apache.poi.hssf.usermodel HSSFPicture resize

Introduction

In this page you can find the example usage for org.apache.poi.hssf.usermodel HSSFPicture resize.

Prototype

@Override
public void resize(double scale) 

Source Link

Document

Resize the image proportionally.

Usage

From source file:mx.avanti.siract.ui.FiltrosBeanUI.java

public HSSFSheet cabezeraGeneralExcel(HSSFSheet sheet, int logouabc, HSSFCellStyle style) {
    /* Create the drawing container */
    HSSFPatriarch drawing = sheet.createDrawingPatriarch();
    /* Create an anchor point */
    ClientAnchor my_anchor = new HSSFClientAnchor();
    /* Define top left corner, and we can resize picture suitable from there */
    my_anchor.setCol1(1);//from   w w  w  .  j  av  a2  s  .c  o  m
    my_anchor.setRow1(1);
    /* Invoke createPicture and pass the anchor point and ID */
    HSSFPicture my_picture = drawing.createPicture(my_anchor, logouabc);
    /* Call resize method, which resizes the image */
    double escalaRes = 1;
    my_picture.resize(escalaRes);
    //definiremos el estilo para estas Celdas
    //Definiremos el nombre de la escuela
    HSSFRow row = sheet.createRow(2);
    row.setHeight((short) 600);
    HSSFCell cell = row.createCell(3);
    cell.setCellValue("Universidad Autnoma de Baja California");
    cell.setCellStyle(style);
    row = sheet.createRow(3);
    row.setHeight((short) 600);
    cell = row.createCell(3);
    cell.setCellValue("Facultad de Ingeniera");
    cell.setCellStyle(style);
    row = sheet.createRow(4);
    row.setHeight((short) 600);
    cell = row.createCell(3);
    cell.setCellValue("Mexicali");
    cell.setCellStyle(style);
    return sheet;
}