DOCX.js icon indicating copy to clipboard operation
DOCX.js copied to clipboard

Any Documentation?

Open stephenhobson opened this issue 12 years ago • 22 comments
trafficstars

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.

stephenhobson avatar Mar 23 '13 18:03 stephenhobson

I'll second this request - even just a simple example would go a long way to helping understand how best to use DOCX.js

andymav avatar Apr 18 '13 18:04 andymav

I'll third the request...

lucidtech avatar May 02 '13 01:05 lucidtech

Yes, please include a simple example.

chanpory avatar May 16 '13 17:05 chanpory

This would be so helpful.

ferndot avatar May 30 '13 01:05 ferndot

+1!

krokhale avatar Jun 05 '13 09:06 krokhale

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.

gnetsys avatar Sep 03 '13 17:09 gnetsys

Joining the request.

stormcrow85 avatar Oct 10 '13 12:10 stormcrow85

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.

alexpls avatar Oct 22 '13 06:10 alexpls

+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

aloncarmel avatar Dec 07 '13 07:12 aloncarmel

+1 :)

darsen avatar Jan 30 '14 14:01 darsen

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.

mikeg2 avatar Feb 15 '14 00:02 mikeg2

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.

mikeg2 avatar Feb 15 '14 01:02 mikeg2

Has any body found any samples yet?

circleb avatar Mar 19 '14 19:03 circleb

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.

cmweiss avatar Apr 03 '14 18:04 cmweiss

Excellent work Christopther

gnetsys avatar Apr 03 '14 18:04 gnetsys

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.

cmweiss avatar Apr 03 '14 21:04 cmweiss

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!

herringtown avatar Apr 15 '14 00:04 herringtown

I found this project - and it was a good example for how to use this project: https://github.com/PinZhang/docx.js-demo

chenop avatar May 05 '14 06:05 chenop

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.

ZerdaH avatar Jun 05 '14 21:06 ZerdaH

Hi folks, found this great module and i think this might be useful for everyone on this page :

https://github.com/mwilliamson/mammoth.js

krokhale avatar Jul 06 '14 12:07 krokhale

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.

dgbutterworth avatar Aug 16 '14 04:08 dgbutterworth

Why such a crazy license? Esp. "Platform Restriction"

fr0z3nfyr avatar Aug 28 '18 07:08 fr0z3nfyr