question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support AutoWidth

See original GitHub issue

I’d like to have an option to have each cellwidth calculated according to the added values (never wrap), so I’d get for instance;

|subject         |date       |name                                 |
|sbj             |2018-01-01 |a very very very very very long name |
|another subject |2018-01-01 |shortname                            |

Instead of the equal distribution according to the set width.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

4reactions
haukeecommented, Jun 16, 2018

This can be done via AsciiTable.getRenderer().setCWC(AT_ColumnWidthCalculator)

The Behaviour you want can be achieved by using CWC_LongestLine I think.

Note that you seem to have to set the CWC right before rendering (= after adding content).

Also see here: http://www.vandermeer.de/projects/skb/java/asciitable/examples/AT_07c_LongestLine.html

0reactions
javadbacommented, Jan 24, 2019

The following works:

t.getRenderer().setCWC(new CWC_LongestLine())

This project would benefit from better out-of-the-box functionality like this: I was about to dump it: but with this it is useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

width - CSS: Cascading Style Sheets - MDN Web Docs
The width CSS property sets an element's width. By default, it sets the width of the content area, but if box-sizing is set...
Read more >
Change the column width and row height - Microsoft Support
Select the column or columns that you want to change. On the Home tab, in the Cells group, click Format. ... Under Cell...
Read more >
"column-width" | Can I use... Support tables for HTML5, CSS3 ...
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >
Doesn't SVG support auto width and height for images?
The SVG 1.1 specification requires the width and height attributes for the <image> element. Most browsers today implement that, so the answer is...
Read more >
Support explicit table width when autowidth option is set #519
In this case, autowidth enables automatic column sizing only. ... In addition to honoring the explicit width attribute, the converter should also ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found