Ajout d'un exemple basique dans la démo

This commit is contained in:
Vincent Calame 2022-08-09 00:54:00 +02:00
parent 272992b10e
commit 2ff64863ee
1 changed files with 15 additions and 9 deletions

View File

@ -8,10 +8,10 @@
<script type="text/javascript" src="../build/html2ods.js"></script> <script type="text/javascript" src="../build/html2ods.js"></script>
<script> <script>
function fodsLink() { function fodsLink(linkdId, tableId) {
let link = document.getElementById("link"); let link = document.getElementById(linkdId);
link.href = URL.createObjectURL( link.href = URL.createObjectURL(
Html2Ods.blob("table", { Html2Ods.blob(tableId, {
currency: "EUR", currency: "EUR",
datePattern: "DD/MM/YYYY" datePattern: "DD/MM/YYYY"
}) })
@ -24,11 +24,18 @@ function fodsLink() {
</script> </script>
</head> </head>
<body> <body>
<h1>Exemple dutilisation de jsHtml2Ods</h1> <h1>Exemples dutilisation de jsHtml2Ods</h1>
<p>Basée sur la compilation dans le répertoire build/</p> <h2>Table réduite à sa plus simple expression</h2>
<div> <p><a href="blob:" download="table.fods" id="link1" onclick="fodsLink('link1', 'table1')">Version ODS</a></p>
<p><a href="blob:" download="table.fods" id="link" onclick="fodsLink()">Version ODS</a></p> <table id="table1">
<table id="table" <tr><td>Cellule 1.1</td><td>Cellule 1.2</td><td>Cellule 1.3</td></tr>
<tr><td colspan="2">Cellule 2.1 + 2.2</td><td>Cellule 2.3</td></tr>
</table>
<h2>Table plus complexe</h2>
<p><a href="blob:" download="table.fods" id="link2" onclick="fodsLink('link2', 'table2')">Version ODS</a></p>
<table id="table2"
data-od-sheetname="Tableau des projets" data-od-sheetname="Tableau des projets"
data-od-fixed-rows="2" data-od-fixed-rows="2"
data-od-fixed-columns="1"> data-od-fixed-columns="1">
@ -135,6 +142,5 @@ function fodsLink() {
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
</body> </body>
</html> </html>