Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

POI and setting cells to VerticalAlignment.MIDDLE

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all I am trying to get my cell to vertical line instead of just being aligned by the left side using POI.

This is my java code:


However, the line headerCellStyle.setVerticalAlignment(VerticalAlignment.MIDDLE); has an error of:

The method setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment) in the type CellStyle is not applicable for the arguments (org.apache.poi.sl.usermodel.VerticalAlignment)

How can i go about getting this to work if I have already defined it as an static CellStyle headerCellStyle = workbook.createCellStyle();?
 
Rancher
Posts: 4258
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment) in the type CellStyle is not applicable for the arguments (org.apache.poi.sl.usermodel.VerticalAlignment)

You've imported the wrong VerticalAlignment (I know, they are stupidly close in their package names).
You want the ss one, not the sl one.
 
David Go
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Dave Tolls wrote:The method setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment) in the type CellStyle is not applicable for the arguments (org.apache.poi.sl.usermodel.VerticalAlignment)

You've imported the wrong VerticalAlignment (I know, they are stupidly close in their package names).
You want the ss one, not the sl one.



It looks like "Middle" is not part of the SS?
 
Dave Tolls
Rancher
Posts: 4258
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, it's CENTER instead.
 
You totally ruined the moon. You're gonna hafta pay for that you know. This tiny ad agrees:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!