Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Apache POI: Output of excel not as expected (Image missing)  RSS feed

 
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a follow up question of this post, but since it's an different issue, I created a different thread.
I'm trying to generate an excel file from data in my program, in which I succeed, but the formatting is al wrong.
First of all the first cell of the first row should be a logo, it shows up as 0, which kinda makes me suspect the bite array was empty?
I use an url to fetch the picture, since I don't know where the user is going to install the program, I can't add it as an recource and then use that path.
Secondly everything I used a '\n' on is concatenaded to one line cause the cells don't expand automaticly.
So I have a two based question: What am I doing wrong with the logo and how do I make the cells expand automaticly?
This is the method I use to generate xlsx:

This part I'm using to get and write the image (it's part of the export method):

The used url result in:




This is how it looks:



This is +- how it's suposed to look:

 
Daniel Demesmaecker
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Layout I managed to solve, rests only the logo that isn't being printed
 
Daniel Demesmaecker
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also Managed to solve That One:



Looks mutch better dosn't it?
 
Daniel Demesmaecker
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For everyone wondering what changes I maded...
For the Picture:
Turns out I forgot an important part of the code:

Which is actually responsible for drawing the picture to the workbook and setting an achor, containing a start column and row and an end column and row (so determines the size of the picture)
The last two lines posted alow me to resize the picture.

for the expanding of the columns:
I just added in my column forEach (the second forEach in the original posted code)

and finally the bold Lines:
I checked for the content of the field and created a style:

That's all!
Lol... A one man thread...
 
no wonder he is so sad, he hasn't seen this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!