Comments (22)
Removed the libtidy dependency.
from html-to-docx.
Guys, I am delighted to know that people have noticed my very first OSS package, thanks for the following.
But I am extremely sorry that I haven't been able to spend some time to follow up on the issues created in this repo, being quite busy with my work.
All that apart I was able to spend some time to figure out the issue at hand finally and I have good news and bad news.
Good news - Figured out the problematic dependency and removed it in feature/browser-example branch, a minifier plugin called html-minifier
was the culprit. And I tested this out in react environment and it seems to work well, except for some white-spacing issue.
Replacement is plain regex as of now. :/
Bad news - In browser, I am getting an error of an import from html-to-vdom
is giving me undefined instead of the function it should be returning, but from some googling I am certain that it is due to a circular dependency, which I will try to resolve ASAP and this should be good to ship for browser usage as well.
Cheers
NB: People who want to try out this change in react, I guess for now you could do
Edit:
Some issue is there with this command npm install git://github.com/privateOmega/html-to-docx.git#feature/browser-example
Try yarn add git://github.com/privateOmega/html-to-docx.git#feature/browser-example
from html-to-docx.
@BikashKNayak @anirudh-modi Sorry for the late reply, I haven't been following this project as much as I would like to due to other commitments. The problem with implementing this package in browser is exactly like @josx said, I started working on this project with an aim to support both ends of the stack but I had to import node-libtidy into the package which essentially cleans up HTML and only works in node environment. Since I have multiple people interested in this being implemented at browser, I will try to work on the package ASAP, removing node-libtidy dependency and supporting browsers. Anyone who is interested can also take this up.
from html-to-docx.
Same here, would love to see it working in the browser. Thanks a lot!
from html-to-docx.
@privateOmega i got Cannot call a class as a function
using the latest version 1.2.2 when tsconfig is targeting es5
import * as HTMLtoDOCX from 'html-to-docx'; or import HTMLtoDOCX from 'html-to-docx'; const HTMLtoDOCX = require('html-to-docx');
did not help
the project have to target ES2015 then it will work.
from html-to-docx.
I'm interested on how this can work with browser
from html-to-docx.
+1 for browser support. I'll comment so I'm notified of progress.
from html-to-docx.
@QQCif Currently this project was made targeting both Node and Frontend frameworks like React, Vue etc. But I will try to add direct browser support ASAP.
from html-to-docx.
Working on this under feature/browser-example
from html-to-docx.
I installed this in my react typescript application but gives node js related errors such as
Error: Can't resolve 'child_process' in \node_modules\libtidy-updated\node_modules\detect-libc\lib'
Is there any specific instructions that need to be followed to use this in React.
from html-to-docx.
@privateOmega what will be the state of the branch for the browser support? Can we have this feature of browser support?
from html-to-docx.
The problem is:
https://github.com/gagern/node-libtidy dont support browser.
from html-to-docx.
great!
from html-to-docx.
Is there any update on how this can work with browser now?
from html-to-docx.
hi, @privateOmega, Help please, sorry i just can't get it to work in browser.
i installed the feature/browser-example branch, and only got '/example' and '/node_modules' 2 directories in my 'html-to-docx' package
I thought some key files might be lost, so i copied '/src', '/template', 'index.js' into the package folder, just got the same error of Can't resolve 'crypto', 'fs', 'path' when i run from "generateContainer" in index.js
So is it possible to use this package in a react or an angular project for browser?
from html-to-docx.
hi @ronanjia !
Currently, this project isn't functional in browser, that's why this issue is open. It'll be closed when browser support is released.
Until then, try using another, such as https://github.com/evidenceprime/html-docx-js . Not as good, but browser supported.
from html-to-docx.
hi @ronanjia !
Currently, this project isn't functional in browser, that's why this issue is open. It'll be closed when browser support is released.
Until then, try using another, such as https://github.com/evidenceprime/html-docx-js . Not as good, but browser supported.
Thank you so much for your advice, it really would help!
from html-to-docx.
Guys, I am extremely sorry about turning a blind eye towards this much requested feature for so long, I was so occupied with other things, that I wasn't able to put in any time on this and get this feature out, but today I did spend some time and it seems like there's some issue that I am facing with npm
specifically and not yarn
and seems like that was the culprit all along and it was misleading me as well when I last worked on this. I will raise a PR now itself after rebasing the branch and hopefully this should be out with next version release.
from html-to-docx.
@ronanjia Thanks a lot for posting this, it helped me find that this happens only when you try installing with npm and not yarn. Could you please try with yarn and post the result here?
yarn add https://github.com/privateOmega/html-to-docx.git#feature/browser-example
if you are trying directly from git.
or
yarn add file:../html-to-docx
if you are trying with cloned repo and when you are on feature/browser-example branch. Please do change the relative path appropriately.
from html-to-docx.
Finally released a new version which contains the changes for browser support, even though it doesn't have support for direct usage using script tag, but it does work with React, so yay. :D
Closing this issue.
from html-to-docx.
As a workaround, you can use
// @ts-ignore
from html-to-docx.
could you check please this error with doc/docx?
ERROR Export type is not supported.
I can't export data into docx... changed es2020 to es2015 and seems no changes. All other types are working except doc/docx(
from html-to-docx.
Related Issues (20)
- support for line breaks like <br> tag HOT 2
- imgs with src as base64 do not come over
- Is width = 100% achievable?
- How to resize images - is it possible?
- Images & style doesn't apply well in .docx file HOT 4
- html to docx conversion raise an error when it transform a table with merged cell
- Margins don't work
- ADD page break if content doesn't have enough room
- XML error when using with Vite (React or Vue)
- browser webpack error
- How to preserve border-bottom without table
- Refactoring work done HOT 4
- bug: when an image is nested under spans, xml-builder doesn't pick up the img tag
- README.md does not show how to load the HTMLtoDOCX function HOT 2
- Nested formatting tags are not getting applied
- STRIKE THROUGH Not working HOT 1
- Reference error : ReferenceError: HTMLToDOCX is not defined.
- Uncaught TypeError: Class extends value undefined is not a constructor or null
- ul element not properly displayed HOT 1
- Nuxt 3 (no SSR)+ Vite not working - Cannot read properties of undefined (reading 'prototype')
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html-to-docx.