You need to do the following;

Start Excel
If necessary, open a new workbook - Excel usually opens up with a new, empty
workbook so this may not be necessary.
Select Insert->Picture and navigate your way to where the logo image is
stored. Select (highlight) the image and then click on the Insert button.
Now, you should see that the logo has been inserted into the worksheet and
you can use the mouse to drag it into the correct location and re-size it as
necessary.
Save the file away and remember where you stored it and the name you used.

That has created the template that you will pick up using POI and populate
with data. All you need to do is something like this;

File file = new File("..Path to and name of the file you created above..");
FileInputStream fis = new FileInputStream(file);
HSSFWorkbook workbook = new HSSFWorkbook(fis);
HSSFSheet sheet = workbook.getSheetAt(0);

and when you have your sheet, populate it in the usual manner and then save
the completed workbook away again, most likely using a different name so
that the template can be used again and again as the basis for further
documents. It is common to see users do this sort of thing as POI's image
manipulation facilities are not quite as feature rich as are Excel's.

Hope that helps. If it is not clear, I will create a template and some code
that picks it up and populates it and PM both to you; just let me know.

Yours

Mark B


deep4u wrote:
> 
> Hi mark,
>            I need to create Excel sheet dynamically with logo. But using
> Template how it is possible.
> 
> Thanks,
> 
> 
> MSB wrote:
>> 
>> So, setting the anchor type does not solve the problem?
>> 
>> In that case, I think that your only recourse is to create a document
>> template using Excel and to place the logo onto the document with it.
>> Then you should be able to safely use HSSF/XSSF to populate the
>> worksheet.
>> 
>> Yours
>> 
>> Mark B
>> 
>> 
>> deep4u wrote:
>>> 
>>> Hi,
>>>     i use the poi 3.5 also image will be expanding. I write like this
>>>  anchor.setAnchorType(HSSFClientAnchor.DONT_MOVE_AND_RESIZE);
>>> or  anchor.setAnchorType(3);  how to reslove this.
>>> 
>>> Thanks,
>>> 
>>> 
>>> deep4u wrote:
>>>> 
>>>> Hello,
>>>>        I am new to this Library. Its working great, i used logo (image)
>>>> in the excel sheet. with the auto sizing the image also expanding and
>>>> contracting according to that column data. 
>>>> 
>>>> Can i keep the image irrespective of the column size? 
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/autosize-in-Excel-irrespetive-of-image-tp24604961p24703233.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to