JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java Tools  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 POI寫多圖到 excel裡的問題! 只出現了最後一張圖!
ethan_victory





發文: 49
積分: 0
於 2008-06-12 17:20 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
從網路上扣了這些程式碼?也測好它可以寫圖到excel裡了...

這段程式我複雜了多份, 丟進不同的image file(gif), 都永遠都只出現最後一張圖...

不知那位先進, 有相同的經驗過, 可指教指教

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
protected void printHeaderImg() throws BusinessException{
     ByteArrayOutputStream ByteArrayOut = new ByteArrayOutputStream();
      BufferedImage BufferImg;
    try {
      BufferImg = ImageIO.read(new File((this.getClass().getResource("/")+this.HEADER_IMG).substring(6)));
        ImageIO.write(BufferImg,"gif",ByteArrayOut);
         
         
        HSSFPatriarch Patriarch = super.getHssfSheet().createDrawingPatriarch();
        HSSFClientAnchor Anchor = new HSSFClientAnchor(0,0,1023,255,(short) 0,0,(short)10,10);
        Patriarch.createPicture(Anchor , getHssfWorkbook().addPicture(ByteArrayOut.toByteArray(),HSSFWorkbook.PICTURE_TYPE_JPEG));
 
        ByteArrayOut.close();
    }
    catch (IOException e) {
      throw new BusinessException("Get image file error: " + e.getMessage());
    }
}


reply to postreply to post
» JWorld@TW »  Java Tools

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8