Using arraybuffer strips list styles and indents
See original GitHub issueHi,
Following is the code in a React app:
const arrayBuffer = await readAsArrayBuffer(this.state.file); const options = { styleMap: ['ol => ul'], }; const newDocument = await mammoth.convertToHtml({ arrayBuffer, }, options);
I am trying to parse a docx in browser and get all the indents and styles for each paragraph from a docx that has following pattern going on: https://image.ibb.co/mxVBWT/Selection_028.png
There are nested lists with ^ that kind of formatting that I want to retain. There are comments as well that I want to retain as well. Whenever I am parsing, the value
always contains a bunch of <ol><li>
tags whenever there is an ordered list, like this:
<ol><li><strong><em>[First Name Last Name]</em></strong>, an individual, residing at <strong><em>[Address]</em></strong> (“<strong><em>[First Name]</em></strong>”); </li><li><strong><em>[First Name Last Name]</em></strong>, an individual, residing at <strong><em>[Address]</em></strong> (“<strong><em>[First Name]</em></strong>”); and</li><li><strong><em>[HoundCo]</em>, </strong>a corporation incorporated provincially in the Province of Ontario with corporation number <strong><em> [•] </em></strong>(the "<strong>Corporation</strong>" and together with <em>[</em><strong><em>First Name]</em></strong>, <em>[</em><strong><em>First Name]</em></strong>, and <em>[</em><strong><em>First Name]</em></strong> each a “<strong>Party</strong>” and collectively, the “<strong>Parties</strong>”).</li></ol>
I am sure I am missing something silly but I can’t seem to fetch the list styles.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
You’ll need to write a style mapping that gives each relevant paragraph style a CSS class, and then add the indentation and bullet formatting to that CSS class.
Glad you got it working.