here’s a widget that generates DOCX or PDF files from HTML or Markdown. It’s as simple as that! It uses the awesome Googoose library and html2pdf libraries to do the heavy lifting.
Images are supported, too. You may insert them as external URLs or from your Grist attachments, in that case just provide “attachchment:n” (where ‘n’ is a valid attachment ID) as the image’s URL.
@Sylvain_Page Hm, that’s not supposed to happen. I haven’t tested it very thoroughly with Word as I have only sporadic access to the program. But I’ll look into it and see what I can come up with!
By the way, if you should happen to have some time on your hands, you might try to Google the problem yourself. You see, the docx files generated by this widget are actually html files, just with some special formatting inside and a .docx extension. Word is supposed to open such a file as if it were a “real” docx and then automatically convert it into one. I’m pretty certain the problem is related to that. Maybe Word dropped support for this feature at some point…
@Sylvain_Page You’re on macOS, right? After doing some reading, I have a suspicion this may be related to Word on Apple, but I’m not sure. I fixed a trifling little but in Googoose, you may want to try it again now, but my bet is this won’t do the trick. Would you have any way of trying it out on a Windows computer?
Or perhaps somebody else could help out here?
I’m on Linux myself and I don’t own Word, so that makes it a bit difficult.
@wunter8 Thanks for testing! That’s very strange. I tested this with both LibreOffice and Onlyoffice, and both work just fine. Will keep looking into it.
Hello,
Just found out about this cool widget so I tested it.
Docx → generated document could not be opened (Office 2013 / Win 10)
PDF → browser stalled and widget view ended up “all grey”