Probably another simple question...
I'm in the final stretch of my POS system and I'm printing invoices using this excellent share by timwil:
http://www.b4x.com/forum/basic4andr...torials/17692-bluetooth-printing-via-spp.html
I'm having great success printing to my bluetooth printer but I would more control about the text formatting.
For example, lets say that I have 48 characters per line available. On one line I would like to print a quantity, a price and a total. timwil's way uses the 'textwriter.writeline' mthod to write directly to the bluetooth serial port. I'm probably too tired to figure it out but I would like to be able to simply format my output text like so:
Currently, products quantity and prices don't have the same length:
But I would prefer something like that:
I'm able to use number format to add 0s with the minimum integer function but after that I would need to remove those 0s.
There must be a library somewhere that does that?
Something similar to those python functions:
Thanks in advance.
JF.
I'm in the final stretch of my POS system and I'm printing invoices using this excellent share by timwil:
http://www.b4x.com/forum/basic4andr...torials/17692-bluetooth-printing-via-spp.html
I'm having great success printing to my bluetooth printer but I would more control about the text formatting.
For example, lets say that I have 48 characters per line available. On one line I would like to print a quantity, a price and a total. timwil's way uses the 'textwriter.writeline' mthod to write directly to the bluetooth serial port. I'm probably too tired to figure it out but I would like to be able to simply format my output text like so:
Currently, products quantity and prices don't have the same length:
B4X:
12 @ 143.50$ = 1722.00$
6 @ 15.00$ = 90.00$
But I would prefer something like that:
B4X:
12 @ 143.50$ = 1722.00$
6 @ 15.00$ = 90.00$
I'm able to use number format to add 0s with the minimum integer function but after that I would need to remove those 0s.
There must be a library somewhere that does that?
Something similar to those python functions:
B4X:
string.ljust(s, width[, fillchar])
string.rjust(s, width[, fillchar])
string.center(s, width[, fillchar])
These functions respectively left-justify, right-justify and center a string in a
field of given width. They return a string that is at least width characters wide,
created by padding the string s with the character fillchar (default is a space)
until the given width on the right, left or both sides. The string is never truncated.
Thanks in advance.
JF.
Last edited: