question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using arraybuffer strips list styles and indents

See original GitHub issue

Hi,

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:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mwilliamsoncommented, May 19, 2018

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.

0reactions
mwilliamsoncommented, May 30, 2018

Glad you got it working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

html-minifier - Product Documentation - 1E
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF...
Read more >
Sorts property list and print out each key=value pair ...
Sorts property list and print out each key=value pair prepended with specific indentation. : Properties « Collections « Java Tutorial.
Read more >
Removing leading whitespace from indented HTML source in ...
The question asks if there's a JavaScript solution or a simpler method for removing leading whitespace. There's a simpler method:.
Read more >
Use Custom Font for PDF Export | SpreadJS 13 - GrapeCity
SpreadJS allows you to embed both standard fonts and custom fonts while exporting a workbook to a PDF format.
Read more >
Comparing Python and JavaScript: A Guide for Developers
See a list in the Python magic methods section. ... Python style guides recommend using multiples of four spaces for indentation and not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found