xlsx2md
v0.7.3
Published
Library to support conversion from OpenXML spreadsheet documents to Pandoc's markdown grid tables.
Downloads
10
Readme
xlsx2md
Library to support conversion from OpenXML spreadsheet documents to Pandoc's markdown grid tables.
Usage
const xlsx2md = require('xlsx2md');
const fs = require('fs');
const archive = fs.readFileSync('./tests/sample.xlsx');
const configString = `<?xml version="1.0" encoding="utf-8" ?>
<xlsx2md>
<SheetLoader>
<Sheet name="">
<Title><![CDATA[Table 1. A sample table name]]></Title>
</Sheet>
</SheetLoader>
</xlsx2md>`;
const result = xlsx2md.convert(archive, 80, configString);
fs.writeFileSync('./tests/output.md', result, {
encoding: 'utf-8'
});
Result
Table: Table 1. A sample table name
+:--------:+:-------------:+:--------------:+:--------------------------------:+
|**№** |{{B1}} |**Amount** |**Unit Price** |
+----------+---------------+----------------+----------------------------------+
|1 |Unit A |1 |$100\.00 |
+----------+---------------+----------------+----------------------------------+
|2 |Unit B |2 |$2\,000\,000\.00 |
+----------+---------------+----------------+----------------------------------+
|3 |Unit C |3 |$300\.58 |
+----------+---------------+----------------+----------------------------------+
|**Original Price** |**$2\,000\,400\.58** |
+----------+---------------+----------------+----------------------------------+
|**Discount** |**30\.3%** |
+ +----------------------------------+
| |**\-$606\,782** |
+----------+---------------+----------------+----------------------------------+
|**Current Price** |**$1\,393\,619\.07** |
+----------+---------------+----------------+----------------------------------+
|**Expiration Date** |2023/10/1 09\:10\:01\.234 |
+----------+---------------+----------------+----------------------------------+
---
'meta-Table 1. A sample table name':
'@align-r2c2': 'AlignLeft'
'@align-r2c4': 'AlignRight'
'@align-r3c2': 'AlignLeft'
'@align-r3c4': 'AlignRight'
'@align-r4c2': 'AlignLeft'
'@align-r4c4': 'AlignRight'
'@align-r5c2': 'AlignRight'
'@align-r6c2': 'AlignRight'
'@align-r7c1': 'AlignRight'
'@align-r8c2': 'AlignRight'
'@align-r9c2': 'AlignRight'
'B1': |
**Unit Name**
---