现在有个excel模版
模版里有个自定义的图片(在excel里用自定义图片--基本图片---圆角矩形画出来的)
我现在想用String templatePath = "D:/moban.xls";
        
        InputStream  is = null;
        is = new FileInputStream(templatePath );        POIFSFileSystem fs = new POIFSFileSystem(is);
        HSSFWorkbook wb = new  HSSFWorkbook(fs);
        HSSFSheet sheet = wb.getSheetAt(0);
        sheet.???
这样的代码来取得这个自定义图片
怎么能取到?
上网找了很久
都没找到解决方法
还请高人指点一二

解决方案 »

  1.   

    写了个简单的测试方类:
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;import org.apache.poi.hssf.usermodel.HSSFCell;
    import org.apache.poi.hssf.usermodel.HSSFSheet;
    import org.apache.poi.hssf.usermodel.HSSFWorkbook;
    import org.apache.poi.poifs.filesystem.POIFSFileSystem;
    public class TestHyoujiDemo   {    
        public static void main(String[] arg) throws Exception {
          test_Excel();
        }
        static void test_Excel()throws Exception{
            String templatePath = "D:/TestHyouji.xls";
            
            InputStream  is = null;
            is = new FileInputStream(templatePath );        POIFSFileSystem fs = new POIFSFileSystem(is);
            HSSFWorkbook wb = new  HSSFWorkbook(fs);
            HSSFSheet sheet = wb.getSheetAt(0);
            
            System.out.println(wb.getSheetName(0));
            HSSFCell cell = sheet.getRow(27).getCell((short)3);
            System.out.println(cell.getStringCellValue());
            //HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); 
            sheet.dumpDrawingRecords();
                    
            FileOutputStream   fileOut   =   new   FileOutputStream("D:/TestHyoujiOut.xls");   
            wb.write(fileOut);   
            fileOut.close();  
        }
      
    }
    另:poi包的下载地址:
    点击http://www.devlib.org/apache/jakarta/poi/ 
    打开后会看到3个连接 
    Parent Directory 
    dev 
    release 
    选择release里的bin连接
      

  2.   

    我记得我以前弄POI的时候发现所有图表都无效。估计你这个也没法做。