Solved

Java String.format problem

Posted on 2011-02-14
11
930 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
 
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
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 synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now