Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java API
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework
this week in the
Java in General
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Liutauras Vilda
Ron McLeod
Sheriffs:
Jeanne Boyarsky
Devaka Cooray
Paul Clapham
Saloon Keepers:
Scott Selikoff
Tim Holloway
Piet Souris
Mikalai Zaikin
Frits Walraven
Bartenders:
Stephan van Hulst
Carey Brown
Forum:
Other JSE/JEE APIs
How to insert images in excel using jxl API
Manikanta Mogalluri
Greenhorn
Posts: 11
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi All,
Could you please help me to insert images in excel workbook using jxl API.
Kindly give me any sample code.
With warm regards, Manikanta Mogalluri
SCJP(90%), SCWCD(100%)
Ulf Dittmer
Rancher
Posts: 43081
77
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
The
jxl.write.WritableSheet
class has the
addImage
method for that. Note that only PNG images are supported. If you have a JPEG, GIF or BMP you can use the javax.imageio.ImageIO class to convert them to PNG.
Manikanta Mogalluri
Greenhorn
Posts: 11
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi Ulf,
Thanks for giving the method.
It will be very useful if give me the sample code for this issue.
With warm regards, Manikanta Mogalluri
SCJP(90%), SCWCD(100%)
Ulf Dittmer
Rancher
Posts: 43081
77
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Search for "jexcelapi faq", it has an example.
shareeef hiasat
Greenhorn
Posts: 8
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
This code i used and worked but i faced little problems with sizing the image
As you see you must convert to PNG because its the only one supported
As if you worndered about if you can put it in some cell you cant
stackoverflow inserting image into cell jxl
////////// WritableImage ////////// //////////public WritableImage(double x, ////////// double y, ////////// double width, ////////// double height, ////////// java.io.File image) ////////// ////////// Constructor ////////// //////////Parameters: ////////// x - the column number at which to position the image ////////// y - the row number at which to position the image START FROM 0 ////////// width - the number of columns cells which the image spans ////////// height - the number of rows which the image spans ////////// image - the source image file ///
java.io.File imageFile = new java.io.File(imgPath + "/HK_logo.jpg"); BufferedImage input = ImageIO.read(imageFile); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(input, "PNG", baos); sheet.addImage(new WritableImage(4,0,1, 1,baos.toByteArray()))
;
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Excel steps -
read an excel file in .xlsx format
java Excel
Export JSP page to Excel
Inserting image in header/footer in excel using jxl
More...