File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Report Formatting 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 » Java » Beginning Java
Bookmark "Report Formatting" Watch "Report Formatting" New topic
Author

Report Formatting

Mark Mokris
Ranch Hand

Joined: May 08, 2002
Posts: 61
I was wondering how you format a hard copy printout or report in Java. What classes do I look to? Suppose I want to format numbers as dollars and cents, right-justified within 15 print positions, like you can do in other languages.
Hari Gangadharan
Ranch Hand

Joined: Mar 08, 2001
Posts: 73
Seems like you are a COBOL programmer :-). I too was! It is very difficult to format text reports using Java comparing COBOL or older languages that can create reports. You can use the following classes to format the Date and Number: SimpleDateFormat and NumberFormat (Look in java.text package).
However there is no StringFormat class that enables us to right align or left align our strings during report generation. You may have to create your own StringFormat class that can append spaces in front or back - A sample use of the StringFormat may be as follows (Remember you have to create StringFormat):



Hope this helps.
[ February 05, 2003: Message edited by: Hari Gangadharan ]

<B>Hari Gangadharan</B><BR>Unix is user friendly..<BR>but it chooses to whom it is friendly with!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Report Formatting
 
Similar Threads
junit test report eclipse?
reports- Urgent, please help
Convert a report in Jsp to PDF format
tomcat connection
generate report in pdf format through a JSP page