ESC-POS-USB-NET icon indicating copy to clipboard operation
ESC-POS-USB-NET copied to clipboard

How to print a table?

Open JuanDa237 opened this issue 10 months ago • 2 comments

A method to print tables could be very usefull!

If u know a very good way of printing something like a table please help me.

image

JuanDa237 avatar Mar 29 '24 23:03 JuanDa237

string.format & fields definitions (length/align/...) https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-string-format#get-started-with-the-stringformat-method

saper-2 avatar Mar 30 '24 16:03 saper-2

Use escape character "\t" like that

//Defiine Header 
string table = "\tfooHeader\tbarHeader";

//Define Body
foreach(var item in items){
table += "\n\tfooItem\tbarItem"
}
printer.Append(table);

oatgh2 avatar Apr 20 '24 00:04 oatgh2