?
Solved

Java String.format problem

Posted on 2011-02-14
11
Medium Priority
?
962 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 2000 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
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…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
Suggested Courses
Course of the Month13 days, 22 hours left to enroll

809 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