Compare commits
2 Commits
c3695ad5fa
...
5f90ed0439
Author | SHA1 | Date | |
---|---|---|---|
5f90ed0439 | |||
15cfce1837 |
18
Jakefile.js
18
Jakefile.js
@ -2,16 +2,24 @@
|
|||||||
/**
|
/**
|
||||||
* Installer Jake avec npm install -g jake (NodeJs doit être installé préalablement)
|
* Installer Jake avec npm install -g jake (NodeJs doit être installé préalablement)
|
||||||
*
|
*
|
||||||
* Lancer la compilation avec jake build[$version] où $version est le numéro de version
|
* Lancer la compilation avec jake build[$version] où $version est le numéro de version.
|
||||||
|
*
|
||||||
|
* Si $version commence par v, le répertoire de destination est dist, sinon c'est build.
|
||||||
|
*
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var fs = require('fs')
|
var fs = require('fs')
|
||||||
, exec = require('child_process').exec;
|
, exec = require('child_process').exec;
|
||||||
|
|
||||||
task('build', function (version) {
|
task('build', function (version) {
|
||||||
jake.rmRf('dist');
|
var destinationDir = 'build';
|
||||||
jake.mkdirP('dist');
|
if (version.startsWith("v")) {
|
||||||
compileJs(version, 'html2ods.js');
|
destinationDir = 'dist';
|
||||||
|
}
|
||||||
|
jake.rmRf(destinationDir);
|
||||||
|
jake.mkdirP(destinationDir);
|
||||||
|
compileJs(version, destinationDir + '/html2ods.js');
|
||||||
});
|
});
|
||||||
|
|
||||||
task('default', ['build']);
|
task('default', ['build']);
|
||||||
@ -42,5 +50,5 @@ function compileJs(version, destination) {
|
|||||||
moduleContent = "/* version: " + version + " */\n" + moduleContent.replace(/\/\*[\s\S]*?\*\//g,'');
|
moduleContent = "/* version: " + version + " */\n" + moduleContent.replace(/\/\*[\s\S]*?\*\//g,'');
|
||||||
moduleContent = moduleContent.replace("//compile target", result);
|
moduleContent = moduleContent.replace("//compile target", result);
|
||||||
|
|
||||||
fs.writeFileSync('dist/' + destination, moduleContent, 'utf8');
|
fs.writeFileSync(destination, moduleContent, 'utf8');
|
||||||
}
|
}
|
||||||
|
34
demos/build.css
Normal file
34
demos/build.css
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
body {
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin-left: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
border-width: 1px;
|
||||||
|
border-color: #2e3436;
|
||||||
|
border-style: solid;
|
||||||
|
font-size: small;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.small {
|
||||||
|
font-size: smaller;
|
||||||
|
}
|
||||||
|
|
||||||
|
.number {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***************************
|
||||||
|
* Styles ODS
|
||||||
|
* *************************/
|
||||||
|
|
||||||
|
column.Date {
|
||||||
|
width: 2cm;
|
||||||
|
}
|
65
demos/build.html
Normal file
65
demos/build.html
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<title>Exemple après compilation dans Dist</title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta http-equiv="Content-Script-Type" content="text/javascript">
|
||||||
|
<link href="dist.css" rel="stylesheet" type="text/css">
|
||||||
|
<script type="text/javascript" src="../dist/html2ods.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function fodsLink() {
|
||||||
|
let link = document.getElementById("link");
|
||||||
|
link.href = URL.createObjectURL(
|
||||||
|
Html2Ods.blob("table")
|
||||||
|
);
|
||||||
|
setTimeout(function () {
|
||||||
|
URL.revokeObjectURL(link.href);
|
||||||
|
}, 4E4); // 40s
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Exemple d'utilisation de jsHtml2Ods</h1>
|
||||||
|
<div>
|
||||||
|
<p><a href="blob:" download="table.fods" id="link" onclick="fodsLink()" id="link">Version ODS</a></p>
|
||||||
|
<table id="table"
|
||||||
|
data-od-sheetname="Tableau des clients"
|
||||||
|
data-od-currency="EUR"
|
||||||
|
data-od-fixed-rows="2"
|
||||||
|
data-od-fixed-columns="1">
|
||||||
|
<colgroup>
|
||||||
|
<col data-od-width="4cm">
|
||||||
|
<col span="2" data-od-style="Date">
|
||||||
|
<col>
|
||||||
|
<col>
|
||||||
|
</colgroup>
|
||||||
|
<colgroup span="2" class="moyennecolonne">
|
||||||
|
</colgroup>
|
||||||
|
<thead>
|
||||||
|
<tr data-od-style="Entete">
|
||||||
|
<th rowspan="2">Client</th>
|
||||||
|
<th colspan="2">Dates</th>
|
||||||
|
<th rowspan="2">Nuitées</th>
|
||||||
|
<th rowspan="2">Facture</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="small">Départ</th>
|
||||||
|
<th class="small">Arrivée</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Victor Hugo</td>
|
||||||
|
<td data-od-type="date" data-od-text="2020-12-01">01/12/2020</td>
|
||||||
|
<td data-od-type="date" data-od-text="2021-01-11">11/01/2021</td>
|
||||||
|
<td data-od-type="number" class="number">40</td>
|
||||||
|
<td data-od-type="currency" data-od-text="1250" class="number">1 250 €</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user