Tinderbox Forum

HTML table exporting as Excel view

Back with my excel view.

I have been attempting to create a table using html and export it as is.(Far less complex than the previous one)

I have used 2 other attributes as columns and called them over at display. The export code is almost as expected except some minor issue.

Being : 1) The first child of table being called is displayed at the bottom of the table.
2) All of the children are called using ^title^ tag due to with I cannot create a correct a table head. (Can I use any other naming convention for titles and headings)
3) Still no clue as to how i use rowspans and colspans.

My current output :

My expected output and notes are created in the following format :

And my HTML code is :

^children(/Templates/HTML page/HTML item)

^title^

^text^
^value($QBStatus)^ ^value($WorkType)^

Surely, you’d want something like

<table>
<tr>
<td>^title^ ^text^</td>
<td>^value($QBStatus)^</td>
<td>^value($WorkType)^</td>
</tr>
</table>

Or the ‘wrapper’ template used for the 'Output of Outline note:

<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
	<title>^title^</title>
	<style>
	table, th, td {border: 1px solid black}
	.empty {border: none}
	</style>
</head>
<body>
<table>
<tr>
	<th>Title</th>
	<th>Status</th>
	<th>Work Type</th>
</tr>
^children("t_table-item")^
</table>
</body>
</html>

Now the child (per-row) data uses template “t_table-item”

<tr>
	<td>^title^^if($Text!="")^
          ^text^^endIf^
	</td>
	<td ^if($QBStatus=="") class="empty"^endIf^>^value($QBStatus)^</td>
	<td ^if($WorkType=="") class="empty"^endIf^>^value($WorkType)^</td>
</tr>

Now the CSS class empty can be styled used to make empty class render without a border.

Trying to compute-on-the-fly rowspan/colspan in this sort of setting is a fool’s errand. I tried this recently with another user and it is fragile code and works poorly with the way Tinderbox HTML export works. I hguess it depends on how much time you want to expend.

An HTML table exporter wizard could be a feature suggestion for someone to make, by showing the need and the ROI for the engineering needed to ‘just’ make a table.

HTML tables have long been a mess and I recall, from the days when the wrote a lot of HTML code, by the 2000s people were dumbing <table> for arrays of styled <div>s for better control styling. Of course, if one doesn’t like HTML and doesn’t want to learn how to use it that is moot and the above is the way to go.

Limited time but here are the bare bones of a solution. CSS is an exercise for the user to implement as so chosen. Table-export-simple.tbx (104.0 KB)

Tip: it would help fellow users (this being a user-to-user forum) if you could upload the the TBX above as it saves each of us wasting time recreating the test data just to get to the place were we can test a solution. People are volunteering their time, so it allows people to spend available time on helping rather than re-keying from screen-grabs. :slight_smile:

†. The forum allows upload of TBX files.

Don’t use any emailed replies to the above - I made some edits (wrong code in template). Above is now correct.

Okay… This was a lot easier to understand this time. Thank you a ton for all the help.

Noted sir !!

I can finally go on a holiday not thinking about tables. Have a Happy and prosperous Diwali to you all as well !! :slight_smile:

1 Like