odfjs/scripts/node.js
David Bruant 57e0145ec7
Create ods file (#5)
* Ajout de création de fichier .ods

* Ajout d'un outil pour créer un fichier .ods + rajout de styles.xml et meta.xml pour peut-être plaire à LibreOffice

* Créer des fichiers considérés corrompus-mais-réparables LibreOffice

* Creating libre-office-validated ods files

* readme with ods creation
2024-10-23 19:13:29 +02:00

54 lines
1.1 KiB
JavaScript

//@ts-check
import {DOMParser} from '@xmldom/xmldom'
import {
_getODSTableRawContent,
_getXLSXTableRawContent
} from './shared.js'
function parseXML(str){
return (new DOMParser()).parseFromString(str, 'application/xml');
}
/**
* @param {ArrayBuffer} odsArrBuff
* @returns {ReturnType<_getODSTableRawContent>}
*/
export function getODSTableRawContent(odsArrBuff){
return _getODSTableRawContent(odsArrBuff, parseXML)
}
/**
* @param {ArrayBuffer} xlsxArrBuff
* @returns {ReturnType<_getXLSXTableRawContent>}
*/
export function getXLSXTableRawContent(xlsxArrBuff){
return _getXLSXTableRawContent(xlsxArrBuff, parseXML)
}
export {createOdsFile} from './createOdsFile.js'
export {
// table-level exports
tableWithoutEmptyRows,
tableRawContentToValues,
tableRawContentToStrings,
tableRawContentToObjects,
// sheet-level exports
sheetRawContentToObjects,
sheetRawContentToStrings,
// row-level exports
rowRawContentToStrings,
isRowNotEmpty,
// cell-level exports
cellRawContentToStrings,
convertCellValue
} from './shared.js'