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.

Can mammoth read word documents created with html-docx-js?

See original GitHub issue

html-docx-js gets the given html and renders it as a word document. When reading this created document with mammoth, i get this: An unrecognised element was ignored: w:altChunk

Any ideas on how to get passed this? Can mammoth be used to do what it’s meant for but reverse? Can mammoth create word documents? Anyways that’d be pretty cool. I figured out the reason the code earlier wasn’t working was because I kept getting that error. It didn’t show up on the console, but it did show up on the mammoth example where the error messages go. Mammoth works perfectly fine with chrome apps, thanks for this and I hope you can improve it better by allowing it to read documents created with html-docx-js!

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
carleliesercommented, Mar 27, 2017

Working on an update for Writer, I managed to remedy the issue by checking if the provided .docx file had <w:altChunk r:id="htmlChunk" /> in it. If so, the substring method was used to retrieve the text in between html body tags, effectively returning the HTML.

Not sure exactly how you would be able to implement this into mammoth, but that’s basically how I did it. Also, I’d like to note that the whole system would pretty much go to shit if someone were to explicitly say ‘<w:altChunk r:id=“htmlChunk” />’ in an actual Word document created by Word, so I don’t know how you’d handle that. Just wanted to update the issue, hope this helps.

0reactions
MCTaylor17commented, Apr 6, 2017

I don’t think you need to worry about your search string appearing in the document. Beyond being incredibly unlikely, angle brackets have to be escaped by Word otherwise it would invalidate the underlying XML.

Read more comments on GitHub >

github_iconTop Results From Across the Web

mammoth.js render word docx on Browser Example demo
Mammoth.js can convert word .docx documents into HTML, text format, and Markdown format. The ability to convert word to HTML via mammoth.js also...
Read more >
Mammoth .docx to HTML converter - npm
Mammoth is designed to convert .docx documents, such as those created by Microsoft Word, and convert them to HTML. Mammoth aims to produce ......
Read more >
How to Convert DOCX To Html With Python Mammoth
By default, Mammoth converts your document into HTML but it does not give you a valid HTML page. While web browsers can display...
Read more >
Create Simple & Clean HTML From Word
For the most part, Mammoth does map common Microsoft Word DOCX styles from an original Word document into the HTML end result. Elements...
Read more >
Mammoth .docx converter – WordPress plugin
Mammoth is designed to convert .docx documents, such as those created by Microsoft Word, Google Docs and LibreOffice, and convert them to HTML....
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