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

Checkbox Form Field Not Supported

Open rosenbauerwillbacker opened this issue 1 year ago • 12 comments

Thank you for open sourcing mammoth. I want to use Mammoth to digitalize docx files for hospitals.

My biggest issue however is that Form Field Checkboxes are ignored: image Our docx files have hundreds of checkboxes, so it would be awesome if I could get this working.

Form Field Checkbox: Form Checkbox.docx

The docx produces: <p> Laboratory professional</p><p> Other medical professionals</p>

Goal: I want the form checkbox to be exported like a normal checkbox. Default Checkbox.docx

This docx produces the right output: <p>☐ Checkbox not ticked</p><p>☒ Checkbox ticked</p>

End note: Form checkboxes have become a standard feature in Word in the business world. Thus, I think this would be a crucial feature to support.

rosenbauerwillbacker avatar Aug 24 '24 12:08 rosenbauerwillbacker

Checkboxes are also very important for my use case. Could you perhaps look into this @mwilliamson?

mariatahler avatar Aug 27 '24 21:08 mariatahler

I will also sponsor broad checkbox support with $150. @mwilliamson checkboxes are also really important for our upcoming production test. Do you think Mammoth could support it? Thank you in advance :)

jan-schweiger avatar Aug 30 '24 08:08 jan-schweiger

I haven't had a chance to look at how checkboxes are represented yet, but I think the main question I have right now is what the output should be. The suggestion so far is to represent them as Unicode symbols: is that what everyone would expect, or are there some cases where HTML checkboxes (i.e. <input type="checkbox" />) would be expected?

mwilliamson avatar Aug 31 '24 12:08 mwilliamson

Thank you for your response @mwilliamson. I think both solutions (unicode characters or html checkbox-input) are fine. However, I think it would be great if we could have one common way checkboxes are represented in the output. So it should be only one of the two in my opinion.

I think Mammoth users might expect <input type="checkbox" /> and <input type="checkbox" checked />. But if that one is more complicated to implement, a unicode representation is perfectly fine as well.

Checkboxes really have become a common feature nowadays, so it would be great to have that in Mammoth.

jan-schweiger avatar Aug 31 '24 13:08 jan-schweiger

@mwilliamson Thank you for helping us out here. I agree, both solutions would work fine. However, I think <input type="checkbox" /> should be preferred, because you could have the unicode character ☒ in you Word file as well.

Do you see a way how we can identify form checkboxes?

rosenbauerwillbacker avatar Sep 01 '24 14:09 rosenbauerwillbacker

Any updates on this one? We are still looking for a solution.

rosenbauerwillbacker avatar Sep 06 '24 22:09 rosenbauerwillbacker

Nope, no update.

mwilliamson avatar Sep 06 '24 23:09 mwilliamson

Thank you for the reply. Hopefully there will be a solution.

rosenbauerwillbacker avatar Sep 07 '24 03:09 rosenbauerwillbacker

I also encountered this bug. Checkboxes disappear and are not even present as unicode characters when importing my Word file. Is there anything we can do about it?

marciaterzo avatar Sep 14 '24 12:09 marciaterzo

Mammoth doesn't pay the bills, so I'm afraid I don't spend much time working on it these days.

mwilliamson avatar Sep 15 '24 11:09 mwilliamson

It's very sad to hear that. But I understand. Thank you for the fantastic work you've put into Mammoth over the years. You've certainly made a difference ❤️.

marciaterzo avatar Sep 15 '24 11:09 marciaterzo

I think it would be very sad if Mammut is no longer supported and becomes stale.

My company is currently testing Mammoth unfortunately there are a few inconsistencies like this that we still need to fix. If we can do that, we can move it to production and I'm pretty sure I can get a sponsorship from my company for Mammoth.

Until then, I can offer to support Mammoth personally with $500/month. Unfortunately, that's all I can afford with my current salary.

Do you know others who use Mammoth in production @mwilliamson? Maybe you can also reach out to them, so that we can raise a small amount of funding for keeping Mammoth alive.

It would be really sad if Mammoth were to stop its support/development at all and becomes stale.

jan-schweiger avatar Sep 15 '24 11:09 jan-schweiger

Just to clarify: the status quo is that Mammoth is still maintained, that is, it receives bug fixes and occasional new features.

The main reason I work on the project is for fun, so I'm unlikely to start more actively trying to chase funding: at that point, it starts looking more like a job, and (a) I already have one of those, (b) the nature of providing an open source library is that, broadly speaking, I have no idea who's using it, and (c) I suspect that it wouldn't be a particularly well-paying job.

If I'm being entirely honest, another aspect is that a lot of requests come from commercial companies, and I'm increasingly unmotivated to implement new features for free or well below what I would be paid for commercial work when the beneficiary is a profit-making enterprise.

That might be too much information, or not the answer you were hoping to hear, but I hope it clarifies the situation!

mwilliamson avatar Sep 21 '24 08:09 mwilliamson

Got it!

As I mentioned before, I am trying to use Mammoth to digitize the documentation in our hospital. Our hospital is under a lot of pressure and saving time is really important. I honestly think it's a compliment to your great work that Mammoth can be used in business / NGOs and actually make a difference.

I'm sorry if the comments here demotivated you from working on Mammoth and enjoying it.

Thank you for the great work so far.

rosenbauerwillbacker avatar Sep 21 '24 08:09 rosenbauerwillbacker

Mammoth doesn't pay the bills, so I'm afraid I don't spend much time working on it these days.

Sorry, I misunderstood your message.

jan-schweiger avatar Sep 26 '24 22:09 jan-schweiger

I just wanted to help. Sorry :(

jan-schweiger avatar Sep 26 '24 22:09 jan-schweiger

No need to apologise, I didn't think your reply was out of place or anything! I just wanted to give a bit of clarity that Mammoth was still being maintained, but I'm unlikely to put vast amounts of time in in the near future.

mwilliamson avatar Sep 26 '24 22:09 mwilliamson

I've done a first pass at implementing support for form field checkboxes. Could you try out the latest commit on master and see if it correctly converts documents with checkboxes?

At the moment, there's a discrepancy between form field checkboxes (which get converted to inputs) and other checkboxes (which get converted to checkbox characters) which I can think more about once the handling for form field checkboxes is sorted out.

mwilliamson avatar Nov 30 '24 11:11 mwilliamson

@mwilliamson Thank you a lot for your work. I will try it out tomorrow and test it thoroughly. I will post my feedback here.

jan-schweiger avatar Nov 30 '24 17:11 jan-schweiger

Hi @mwilliamson,

Thank you so much for implementing this important capability. I tested it with our medical documents and it worked flawlessly.

I don’t have much to add, as this is exactly what I was looking for. Thank you again for your effort!!

rosenbauerwillbacker avatar Nov 30 '24 18:11 rosenbauerwillbacker

My tests were successful!! This really is a game-changer. Thank you so much 👍.

jan-schweiger avatar Dec 01 '24 16:12 jan-schweiger

This is really great. This is an important addition to Mammoth.js.

marciaterzo avatar Dec 07 '24 16:12 marciaterzo

Thanks for the reports! I've updated the handling of checkboxes represented as structured document tags so that they're also converted to checkbox inputs, and uploaded 1.9.0 with those changes to npm.

mwilliamson avatar Dec 30 '24 10:12 mwilliamson

Thank you, @mwilliamson!

I use Mammoth to automate the digitalization of medical files with a lot of checkboxes, so this update has been incredibly helpful. I truly appreciate your work - thank you!

rosenbauerwillbacker avatar Jan 02 '25 12:01 rosenbauerwillbacker