Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About the "printColumnsText" method #109

Open
tanerparcali opened this issue Oct 9, 2023 · 1 comment
Open

About the "printColumnsText" method #109

tanerparcali opened this issue Oct 9, 2023 · 1 comment

Comments

@tanerparcali
Copy link

"printColumnsText" also used in the method
let columnWidth = [46 - (7 + 12), 7, 12]; what does it mean.
let's say I have an 80mm printer and I want to print a triple table and I want the division to be "3 / 1 / 2"
so a long left field, a short center field and a slightly longer right field.

How should columnWidth be set in this case?

Thanks.

@licomobrusli
Copy link

You probably reslved this a long time ago but anyway ...

In the example the whole text row allows 46 characters. The author wants the 2nd column to have 7 and the third column to have 12 and the first column to have all the rest i.e. 46 - (7+12). Therefore using up all 46 characters. This is an example where the programmer knows the character limit of a row (46) and that column 2 and 3 will never have more than 7 and 12 characters respectively and wants his column 1 to have all of the remaining characters.

If you want the division to be 3 / 1 / 2 then you need to know the length of your row in characters (X) and then do [X * (3/6), X * (1/6), X * (2/6)];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants