0

I have a print function in an application I made on CSharp. But I don't like the way the document is formatted and its hard to specifically format the text to the printer or sort of like that.

Here is the way I format it. I hope there is a more dynamic and efficient way of doing this so that it could be compatible for all computers or laptop that use it.

5
  • If you are wanting to format the output with spaces and without having to code all of those " Amount " for example you could do something like this string s = new string( ' ', 20 ) Commented Oct 29, 2012 at 14:46
  • how to better format this report and prepare it for printing. it gets messy when I transfer to other printers Commented Oct 29, 2012 at 14:47
  • 1
    John Look at my example if you know how you want the layout. remember the old way of printing documents printers would generally work off of 80 characters per line.. so you will have to do some counting.. Commented Oct 29, 2012 at 14:53
  • please include the actual question in your "question" ;-) what do you mean by messy? the line breaks? Commented Oct 29, 2012 at 14:54
  • Well sort of.. They don't appear in line. and I have to print multiple times to correct the format for my printer.. I am wondering if there is a better way to do this format.. Or is it supposed to be this tedious when printing? Commented Oct 29, 2012 at 15:05

1 Answer 1

1

are you looking do something that would format the spaces already.. for example If I wanted to WriteLine("** HELLO **); I would do something like this

string s = new string( '*', 8 )
WriteLine(s+ HELLO + s)

so in your case you can follow this example and count out the number of spaces that you are wanting and if you need to make a few new String Variables to hold the different number of spaces plus it will be cleaner when reading.. this is a simple example

string strSpaces = new string(' ', 20) for example.. 

just play around with what you need

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.