DOCX.js
DOCX.js copied to clipboard
Any Documentation?
Just wondering if you have any documentation on how to implement docx.js with JSZip? Or anything that can help me understand how DOCX.js works with JSZip.
Thanks.
I'll second this request - even just a simple example would go a long way to helping understand how best to use DOCX.js
I'll third the request...
Yes, please include a simple example.
This would be so helpful.
+1!
The topic of DOCx to html convertion has be long on going for a few years now and this is excellent work thank for this contribution. I have tested it as well with simple call and could not get the script to function. I would appreciate as well if you could provide a tutorial. Thanks in advance.
Joining the request.
Count me in on this request, too. I'll try and figure out how to work DOCX.js, if I do I'll make a pull request with a simple readme.
+1 , i am breaking my head on how to get this to work with no success. i simply dont know what the file object that need to pass the function. i keep getting Corrupted zip : can't find end of central directory
+1 :)
PLEASE ADD SOME DOCS! Even if you just copy and paste some random code you've used it in into a "demo" folder, it would go a long way. I'm completely lost at what "input" is suppose to be.
Here's a semi-working example. The "input" variable is actually a JSZip object that you have to create first. I REPEAT: YOU HAVE TO UNZIP THE DOCX FILE FIRST! I think that's what is causing the confusion.
Has any body found any samples yet?
I was able to get some imperfect results after I made a couple of small modifications to docx.js. The modifications I made are:
Line 74: changed if (inNode.style.textAlign) {...}; to if ('style' in inNode && 'textAlign' in inNode.style) {...};
Line 132: changed sharedStrings = [[], 0]; to //sharedStrings = [[], 0]; as the sharedStrings variable is referenced nowhere else.
Then...
I was able to get a non-working word document by doing the following:
document.getElementById('docxLink').href = docx({DOM: document.getElementById('content')}).href();
I was able to click my anchor tag with the id of docxLink and download a .docx file but word reported an error and could not open it. After examining the contents of the resulting .docx I saw that there was badly formatted xml in the document.xml (end tags without start tags). You can examine the contents of the .docx if you change the extension to .zip.
You do, of course, need to include JSZip (available here: http://stuk.github.io/jszip/) as it's required by docx.js.
Excellent work Christopther
The problem with the output .docx is not that there are end tags without start tags as I mentioned above. All of the tags in the document.xml are balanced correctly. I noticed that the document.xml had nested <w:body> tags. I fixed that but still get errors in the document.xml. Perhaps,later, I'll fork this and push my changes even though I'm still not able to create a working .docx.
Another +1 for this request. The most recent chatter here (and lack of response from the original author) inclines me to think this project is dead/unusable/broken.
That would be a pity, as this is something that would be really useful. Certainly would be great if someone could conjure up some working demo code or barebones docs!
I found this project - and it was a good example for how to use this project: https://github.com/PinZhang/docx.js-demo
I tried to have some clear documentation on a fork here, though the methods in the fork are changed quite a bit from the original.
Hi folks, found this great module and i think this might be useful for everyone on this page :
https://github.com/mwilliamson/mammoth.js
Thank you krokhale! I'm moving my attention to that project. While this one is interesting, the license agreement is, at best, confusing and, quite possibly, impossible to comply with. My comment on that problem has gone unanswered.
Why such a crazy license? Esp. "Platform Restriction"