odfjs/scripts/App.svelte

44 lines
884 B
Svelte
Raw Normal View History

2024-06-14 16:57:20 +02:00
<script>
2024-06-15 12:54:53 +02:00
import getTableRawContentFromFile from './getTableRawContentFromFile.js'
const ODS_TYPE = "application/vnd.oasis.opendocument.spreadsheet";
const XLSX_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
let files
let tableRawContent;
/** @type {File} */
$: file = files && files[0]
$: console.log('file', file)
$: tableRawContent = file && getTableRawContentFromFile(file)
$: console.log('tableRawContent', tableRawContent)
2024-06-14 16:57:20 +02:00
</script>
2024-06-15 12:54:53 +02:00
<h1>Import fichier .ods et .xslx</h1>
<section>
<label>
Fichier à importer:
<input bind:files type="file" id="file-input" accept="{ ['.ods', '.xlsx', ODS_TYPE, XLSX_TYPE].join(',') }" />
</label>
</section>
2024-06-14 16:57:20 +02:00
<style lang="scss">
:global(main) {
text-align: center;
padding: 1em;
max-width: 240px;
margin: 0 auto;
@media (min-width: 640px) {
max-width: none;
}
}
</style>