Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-01-2007, 05:16 PM
Member
 
Join Date: Jul 2007
Posts: 40
trill is on a distinguished road
Export data to xls
Hello, I made export option in my application, in which i send data dynamically from java application to excel. Same thing i did with html,word and PDF. All this options working fine except excel option while taking print out. When data length is more it increases the width not height in case of excel.

How can i force excel cell to be a constant in length n increases height as per the size of data?

Thanks.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-07-2007, 08:27 AM
zoe zoe is offline
Member
 
Join Date: Jul 2007
Posts: 40
zoe is on a distinguished road
This can be done using xsl/xml. To force a cell to wrap add a ss:Vertical="Bottom" ss:WrapText="1" style to the cell. To keep a constant width add the attributes: ss:AutoFitHeight="0" ss:Height="46.5". I only know this because I needed some special formatting for my exported data in excel and found this article. Of course it didn't have the formatting I needed but if you make a change to the excel file then save as xml you can see what attributes you will need to add to perform the desired formatting.

The article is for asp.net but the xml/xsl will apply to any programming language. Just curious, what format are you sending your data for the other export options?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 01-11-2008, 10:24 AM
Member
 
Join Date: Nov 2007
Posts: 4
sanjay_sharma77 is on a distinguished road
export to excell
HSSFWorkbook wb = new HSSFWorkbook();
HSSFCellStyle cellStyle = wb.createCellStyle()
HSSFSheet sheet = wb.createSheet("sheet 1");

//You can make the cell to wrap the text. Automatically the height will increase
cellStyle.setWrapText(true);

//Alternativelly, you can force the cell width.
//setColumnWidth((short)ColNumber,(short)Column width)
example

sheet.setColumnWidth((short)(col-1),(short)4000)

Thanks,
Sanjay Sharma
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
export to excel diana glz Advanced Java 0 03-14-2008 12:01 AM
export to excel diana glz New To Java 0 03-13-2008 10:26 PM
Export excel issue sanjay_sharma77 Advanced Java 0 01-10-2008 04:47 PM
Export to Java program, applet or c/c++ fernando New To Java 1 08-07-2007 07:55 AM
problem with the way to export data to CSV file gonne Java Servlet 0 07-01-2007 03:43 PM


All times are GMT +3. The time now is 01:41 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org