日期:2014-05-18 浏览次数:20731 次
# public class TestPOI {
#
# public static void main(String[] args); {
# FileOutputStream fileOut = null;
# BufferedImage bufferImg =null;
# BufferedImage bufferImg1 = null;
# try{
# ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();;
# ByteArrayOutputStream byteArrayOut1 = new ByteArrayOutputStream();;
# bufferImg = ImageIO.read(new File("d:/ok.jpeg"););;
# bufferImg1 = ImageIO.read(new File("d:/ok1.jpeg"););;
# ImageIO.write(bufferImg,"jpeg",byteArrayOut);;
# ImageIO.write(bufferImg1,"jpeg",byteArrayOut1);;
#
#
# HSSFWorkbook wb = new HSSFWorkbook();;
# HSSFSheet sheet1 = wb.createSheet("new sheet");;
# //HSSFRow row = sheet1.createRow(2);;
# HSSFPatriarch patriarch = sheet1.createDrawingPatriarch();;
# HSSFClientAnchor anchor = new HSSFClientAnchor(0,0,512,255,(short); 0,0,(short);10,10);;
# HSSFClientAnchor anchor1 = new HSSFClientAnchor(0,0,512,255,(short); 0,15,(short);10,20);;
# patriarch.createPicture(anchor , wb.addPicture(byteArrayOut.toByteArray();,HSSFWorkbook.PICTURE_TYPE_JPEG););;
# patriarch.createPicture(anchor1 , wb.addPicture(byteArrayOut1.toByteArray();,HSSFWorkbook.PICTURE_TYPE_JPEG););;
#
# fileOut = new FileOutputStream("d:/workbook.xls");;
# wb.write(fileOut);;
# fileOut.close();;
#
# }catch(IOException io);{
# io.printStackTrace();;
# System.out.println("io erorr : "+ io.getMessage(););;
# } finally
# {
# if (fileOut != null);
# try {
# fileOut.close();;
# } catch (IOException e); {
# // TODO Auto-generated catch block
# e.printStackTrace();;
# }
# }
# }