Solved

Java String.format problem

Posted on 2011-02-14
11
935 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

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…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
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 and create new code templates in NetBeans IDE 8.0 for Windows.

773 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