privateOmega / html-to-docx

HTML to DOCX converter
MIT License
373 stars 140 forks source link

Refactoring work done #232

Open Cruaier opened 8 months ago

Cruaier commented 8 months ago

Hi @privateOmega,

I was delighted stumbling over your lib and took some steps further to improve it a little. My main concern was the bundle size and the usage in a browser. I started to work on it and had some success with it. If you are interested in it please have a look here: https://github.com/Cruaier/html-to-docx. I replaced virtual-dom with htmlparser2, removed all (not anymore) needed dependencies and switched to UintArray and Blob instead of Buffer. Bundling is done with vite instead of rollup (it was working better for me).

I tested my changes with your prepared tests and the result document is pretty much the same. The main benefit is the bundle size though as the artifacts are now less than half the size as before.

Feel free to take my changes (or the parts you like) and put them into your lib.

BR

traycho commented 5 months ago

@Cruaier Can you publish this version into npm I am interested to compare with existing one ? Looks a cool work, thank you !

Cruaier commented 4 months ago

@traycho here you go: https://www.npmjs.com/package/html-to-docx-lite I'll add to it when I have more time

349989153 commented 4 months ago

@traycho here you go: https://www.npmjs.com/package/html-to-docx-lite I'll add to it when I have more time

Thank you for ur work, however, I tried to open the exported .docx or .doc via Microsoft® Word 适用于 Microsoft 365MSO ( 2403 Build 16.0.17425.20176) 64 on Windows system, but I failed.

Cruaier commented 4 months ago

I don't know if that's related to my version or not. Please create an issue here https://github.com/Dobe-Solutions/html-to-docx-lite/issues and give me some example html to have a look.