mtmsuhail / ESC-POS-USB-NET

This project is a simple .NET (C#) Implementation of the Epson ESC/POS Printing using USB Device Driver.
MIT License
202 stars 86 forks source link

How to print a table? #69

Open JuanDa237 opened 5 months ago

JuanDa237 commented 5 months ago

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

saper-2 commented 5 months ago

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

oatgh2 commented 4 months ago

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);