I am attempting to generate an XLSX file from a JSON object, where one of the fields contains Markdown text. While generating the XLSX file, I want to preserve the styling present in the Markdown text. I’ve tried using the xlsx module, but I haven’t been successful in retaining the styling.
const data = [
{
id: 1,
markdownField: "Testing **How** to format the *data* n1. Point 1n2. Point 2"
},
{
id: 2,
markdownField: "Another **example** of *Markdown* text n- Item 1n- Item 2"
}
];
const XLSX = require('xlsx');
const ws = XLSX.utils.json_to_sheet(data);
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Data');
XLSX.writeFile(wb, 'output.xlsx');
In the resulting XLSX file, the Markdown styling (e.g., bold, italic, list) is not retained. How can I preserve the Markdown styling when generating the XLSX file?
Also i tried to convert markdown
text to html and then generate xlsx but still not luck, Here is generated html
Testing <strong>How</strong> to format the <em>data</em></span><ol><li>Point 1</li><li>Point 2</li></ol>