I have created a HTML table with values from Json file like this. I have the json data inline and I create the table using some css.
<style>
table {
width: 60%;
line-height: inherit;
text-align: left;
}
table td {
padding: 5px;
vertical-align: top;
}
table tr.top table td.title {
font-size: 45px;
line-height: 45px;
color: #333;
}
</style>
</head>
<body>
<div id="box"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.7.0/mustache.min.js"></script>
<script type="mustache/x-tmpl" id="helloTmpl">
<h1>number {{number}}</h1>
<table cellpadding="0" cellspacing="0" id="t01">
<tr class="top">
<td colspan="1">
<table>
<tr>
<td class="title">
</td>
<td>
Number #: {{number}}
</td>
</tr>
</table>
</td>
</tr>
<tr class="information">
<td colspan="1 ">
<table>
<tr>
<td>Name<br>
{{seller.name}}<br>
</td>
</tr>
</table>
</td>
</tr></br>
</table>
</script>
<script>
var data = {
"number": "123",
"seller": {
"name": "TestName"
}
};
var tmpl = document.getElementById("helloTmpl").innerHTML;
var html = Mustache.to_html(tmpl, data);
var box = document.getElementById("box");
box.innerHTML = html;
</script>
Now I need to download this table with the format I have used in css in a txt file. I haven't found everything about how can I save it in txt file. And also I have no idea how can I keep having the format (css). Maybe should I use Ascii Art? But I have no idea how can I make the connection. Can anybody guide me please?