You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Alex Broytman <al...@instinet.com> on 2012/11/26 17:35:07 UTC

Image from worksheet does not get cloned

Hello,

I have a simple template 'xls' file which contains one worksheet with an image. 
I need to clone this sheet. As a result my new sheet gets the image, but the 
image disappers from original sheet - instead Excel shows me just a placeholder 
with message 'This image cannot currently be displayed'. I am usinf POI 3.7 and 
here is the code:

public class ReadTemplate {

	public static void main(String[] args) {

		try{
			
		  FileInputStream f = new FileInputStream("oamlogo.xls");
		  Workbook hwb = new HSSFWorkbook(f);
		  Sheet sheet = hwb.cloneSheet(0);
		  hwb.setSheetName(1, "AAA");
		  
		  FileOutputStream out = new FileOutputStream("clone.xls");
		  hwb.write(out);
		  out.close();
		}
		catch (IOException e) {
			System.out.println("IOException: " + e.getMessage());
			e.printStackTrace();
		}
	}

}

How to get the image cloned - or is there any workaround?

Thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Image from worksheet does not get cloned

Posted by Alex Broytman <al...@instinet.com>.
This worked, thanks a lot

Yegor Kozlov <yegor.kozlov <at> dinom.ru> writes:

> 
> Please try with the latest build from trunk. Many bugs including
> support for images in HSSF have been fixed since POI-3.8
> 
> Yegor
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Image from worksheet does not get cloned

Posted by Yegor Kozlov <ye...@dinom.ru>.
Please try with the latest build from trunk. Many bugs including
support for images in HSSF have been fixed since POI-3.8

Yegor

On Mon, Nov 26, 2012 at 8:35 PM, Alex Broytman
<al...@instinet.com> wrote:
> Hello,
>
> I have a simple template 'xls' file which contains one worksheet with an image.
> I need to clone this sheet. As a result my new sheet gets the image, but the
> image disappers from original sheet - instead Excel shows me just a placeholder
> with message 'This image cannot currently be displayed'. I am usinf POI 3.7 and
> here is the code:
>
> public class ReadTemplate {
>
>         public static void main(String[] args) {
>
>                 try{
>
>                   FileInputStream f = new FileInputStream("oamlogo.xls");
>                   Workbook hwb = new HSSFWorkbook(f);
>                   Sheet sheet = hwb.cloneSheet(0);
>                   hwb.setSheetName(1, "AAA");
>
>                   FileOutputStream out = new FileOutputStream("clone.xls");
>                   hwb.write(out);
>                   out.close();
>                 }
>                 catch (IOException e) {
>                         System.out.println("IOException: " + e.getMessage());
>                         e.printStackTrace();
>                 }
>         }
>
> }
>
> How to get the image cloned - or is there any workaround?
>
> Thanks
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org