Solved

Java String.format problem

Posted on 2011-02-14
11
937 Views
Last Modified: 2013-11-23
I include the form feed code \f at the end of my format string but is does not form feed to the next page before it starts printing the balance of the document.  Any Ideas
0
Comment
Question by:sargent240
  • 6
  • 5
11 Comments
 

Author Comment

by:sargent240
ID: 34892076
Forgot to include the line of code so here it is

            totaloutputString = String.format("\n%62s      %.2f", "Total Due",
                    stmtTotal, "\f");
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 34892151
try:

            totaloutputString = String.format("\n%62s      %.2f\f", "Total Due",
                    stmtTotal);
0
 

Author Comment

by:sargent240
ID: 34893786
Thanks objects:  I moved the \f to follow the %.2f with the same results.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 92

Expert Comment

by:objects
ID: 34893823
have you checked if the form feed is actually in the string?
Problem may not be with that line of code
0
 

Author Comment

by:sargent240
ID: 34893869
I write several invoices into a file and I would like each invoice to be on it's own page of course.  I am printing all the invoices to one file and trying to put a form feed between each one.  I am attaching the code I am using and the line you suggested is toward the bottom. Everything prints properly I am only lacking the form feed.   Hope this helps.
Cheers
 WriteFile.java
0
 
LVL 92

Expert Comment

by:objects
ID: 34902236
are you sure your printer supports form feeds?
0
 

Author Comment

by:sargent240
ID: 34912999
I have tried it on a Brother DCP 7020 and an Okidata 320 using the Epson FX emulation.  They both react the same.  We have several hundred Okidata printers in another application and we use the form feed there.  I'm not curtain about the Brother and am not sure how to find the info.
0
 

Author Comment

by:sargent240
ID: 34938211
Are we at a lose on this one.
Cheers sargent240
0
 
LVL 92

Expert Comment

by:objects
ID: 34938871
the code is writing the form feed to the string so I'm stuck as to why its not working
0
 

Author Comment

by:sargent240
ID: 34940128
Are you aware of the two printers I have tried?
Thanks
0
 
LVL 92

Expert Comment

by:objects
ID: 34940231
i'm not sorry
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question