Skip to content

Commit 90aa94f

Browse files
add save as html table data UI option (#26)
1 parent 9d9e3f1 commit 90aa94f

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,5 @@ Add hide, freeze, and delete column context menu options
4848
Add data loading progress ring display
4949
- [#25](https://github.com/RandomFractals/tabular-data-viewer/issues/25)
5050
Add Save as CSV or JSON data UI options
51+
- [#26](https://github.com/RandomFractals/tabular-data-viewer/issues/26)
52+
Add Save as HTML data table UI option

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Tabular Data Viewer 🀄 provides custom Table View for `.csv`, `.tsv` and `.tab
2828
- Freeze or delete table rows
2929
- Perisist table settings per data file
3030
- Copy table data to Clipboard
31-
- Save table data in `CSV` or `JSON` data array format
31+
- Save table data in `CSV`, `HTML` table, or `JSON` data array format
3232

3333
...
3434

src/views/tableView.ts

+1
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ export class TableView {
351351
<option value="">📥&nbsp;Save</option>
352352
<option value="csv">,,, csv</option>
353353
<option value="json">{} &nbsp;json</option>
354+
<option value="html">&lt;&gt; &nbsp;html</option>
354355
</select>
355356
<vscode-button id="reload-button"
356357
appearance="icon" aria-label="Reload Data">

web/scripts/tableView.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,15 @@ function saveData() {
254254
const dataFileName = fileName.substring(0, fileName.lastIndexOf('.') + 1);
255255
saveDataFileName = dataFileName + dataFileType;
256256
console.log('tabView:saveData(): saving data:', saveDataFileName);
257-
table.download(dataFileType, saveDataFileName);
257+
switch (dataFileType) {
258+
case 'csv':
259+
case 'json':
260+
table.download(dataFileType, saveDataFileName);
261+
break;
262+
case 'html':
263+
table.download(dataFileType, saveDataFileName, { style: true});
264+
break;
265+
}
258266
}
259267

260268
/**

0 commit comments

Comments
 (0)