• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem setting text in center align format

 
Prashant Langade
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am facing a strange issue in center alignment of text using poi in my project.

I am unable to set the text in center align mode. here is my code.
The code for setting text in center align mode is as below.
The above code is working fine,but when i am integrating the above code with my code which is shown below.I am not able to see my text center aligned.


Can any one help me?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read.

You can edit your post by using the button.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cellStyle.setAlignment(cellFormat.getAlignFormat().getHorizontalAlignment().getValue())

This looks as if the alignment value is set to whatever value it already has - thus the code never changes anything.

What kind of object is "cellFormat"?
 
Prashant Langade
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CellFormat is my custom object. which has reference of AlignFormat which in turn has horizontalAlignment attribute.

Normally in POI,when we use to set some text as center aligned,then we do this way which is working fine.



CellStyle.ALIGN_CENTER gives 2 as a short value. which in my case i.e
cellFormat.getAlignFormat().
getHorizontalAlignment().getValue());
gives same value.
but still it is not gettting center aligned..
I am digging my head into it.
 
Prashant Langade
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey..

After lot of R&D and tial and error basis, finally i was able to solve the problem..




Special thanks to all of those who tried to help me..



Prashant
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic