Generating ASCII-tables with spanning cells: manual labour still needed
Posted by jpluimers on 2026/05/28
Every now and then, documentation in source code requires an ASCII table. Sometimes table cells are spanning multiple rows or/and column.
TL;DR: The tools I tried did not support that, so manual labour is still needed.
Queste
I started with the trusty [Wayback/Archive] HTML Tables generator – TablesGenerator.com to generate this HTML table:
<table> <tbody> <tr> <td rowspan="2"></td> <td colspan="3"></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> </tbody> </table>
Then I tried generating ASCII tables using these sites:
- [Wayback/Archive] HTML Table to ASCII
- [Wayback/Archive] Convert HTML Table to ASCII Table – Table Convert Online
- [Wayback/Archive] ASCII Table Generator – Quickly format ASCII table. Great for source code comments and markdown!
- Cannot support it as the input format is plain text
- Repository at[Wayback/Archive] ozh/ascii-tables: ⚡ Quickly format table in ASCII. Great for code comments, or Github Markdown! showing how many output styles (including Markdown, reStructuredText and others)
- [Wayback/Archive] asciitable
- Does not have plain text input, but requires you to write Java code. It has flexible output though.
- Repository is at [Wayback/Archive] jeeshell/asciitable
- [Wayback/Archive] vdmeer/asciitable: Several implementations of a text table, originally using ASCII and UTF-8 characters for borders.
- Too does not have plain text input and too requires you to write Java code. Not sure about the flexible output as the documentation does not provide example output.
Cells spanning multiple rows and columns?
Yup, next to spreadsheets, HTML too allows for a cell to span multiple rows and columns.
Figuring that out was not easy, as [Wayback/Archive] html cell span “both” row and column – Google Search returned many irrelevant results. Luckily it returned [Wayback/Archive] Web Review: Spanning Columns and Rows with HTML Tables
Spanning rows and columns
Our example table has four empty cells in the upper left corner, corresponding to the two header rows and header columns. We specified all four cells explicitly, but could have used just one cell, spanning both rows and columns.If the first cell in the first row were defined as:<th rowspan="2" colspan="2"></th>the cell would span the first two cells of the first two rows. The resulting HTML is somewhat smaller:<table border="1"> <tr> <th rowspan="2" colspan="2"></th> <th colspan="2">Fruit</th> </tr> <tr> <th>Oranges</th> <th>Grapefruit</th> </tr> <tr> <th rowspan="2">Feature</th> <th>Flavor</th> <td>Sweet</td> <td>Tart</td> </tr> <tr> <th>Size</th> <td>Small</td> <td>Large</td> </tr> </table>Since this cell is the equivalent of two cells wide, it replaces the first two cells in the second row.Spanning cells are not limited to the edges of a table. Here is a 4×4 table with the center spanning both rows and columns:
A B C D E F G H I J K L M See if you can write HTML to produce this table, before you peek at this document’s source to get the answer.
Queries
I did the below queries:
- [Wayback/Archive] ascii diagram – Google Search
- [Wayback/Archive] table to ascii online width height – Google Search
- [Wayback/Archive] vdmeer asciitable “online” – Google Search
- [Wayback/Archive] asciitable online – Google Search
- [Wayback/Archive] html table to ascii table – Google Search
–jeroen






Leave a comment