aspose file tools*
The moose likes Other Open Source Projects and the fly likes Problem setting text in center align format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Problem setting text in center align format" Watch "Problem setting text in center align format" New topic
Author

Problem setting text in center align format

Prashant Langade
Ranch Hand

Joined: Jul 01, 2009
Posts: 71
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

Joined: Sep 29, 2008
Posts: 12617

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
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
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"?


Ping & DNS - updated with new look and Ping home screen widget
Prashant Langade
Ranch Hand

Joined: Jul 01, 2009
Posts: 71
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

Joined: Jul 01, 2009
Posts: 71
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem setting text in center align format
 
Similar Threads
Converting Excel Workbook to PDF
Problem with setFillBackgroundColor in HSSF
Set character formatting in Excel using POI
APACHE POI
Covert Excel Worksheet to PDF