Search posts, tags, users, and pages
Dude, you asked this on twitter less than an hour ago, give people time to answer stuff before spamming it in other places. Also try googling "export html text keep formatting" or something. What's the use case? Also, what about ctrl+p?
Also search through stackoverflow.com
Dude, you have an interesting definition of spamming. I simply posted a question on two different platforms, what's the big fuzz?
Also I tried googling, closest I got to an answer was "no, it's not possible" which is obviously not what I was looking for, hence why I posted.
My usecase is: I have automated some very repetitive string manipulation for work (work computer is very secure, because it's a gov. job, no access to the OS or anything, can't even install stuff). I opted for pure front-end JavaScript to do this, but I still have to manually recreate the formatting when copy/pasting the generated text in my word file.
Here you go, even though I have a feeling you were just feeling a bit douchy and have no interest in answering my question anyway.
Perhaps my use of the word spam is not correct, however you can't just expect an instant answer from people. And I don't appreciate your insults, but I'll look past it. Did you look at stackoverflow?
Another possible method would be htmltopdf or something like this: cloudconvert.com/html-to-docx
I'm still finding it difficult to actually understand why you need this. Are you trying to create a report with formatted text from the web and .docx formating too? If so, why do you want two different formats? That's bad practise.
I apologize, but I felt unnecessarily attacked, since I didn't expect immediate answers at all and you gave me stick for it.
Unfortunately I'm not allowed to upload files from my work PC, so the cloud thing might actually be the perfect solution for me, if I could use it 😐.
The whole situation is very "hacky", basically, I have to create a series of docs, which differ in very overseeable properties, like names, dates and such. The conventional way (aka how my bureaucratic colleagues do it) is to just manually create text for each individual document. Braindead work freshly imported from the 19th century. I'm having none of it and automated the whole process via some 200 lines of simple vanilla JS that creates the text and I paste it into a docx. This works like a charm, buuuut I have to still manually recreate the correct formatting which is annoying.
This is not at all a job correlated with coding, this just pays the bills and nobody really knows I did this (which naturally results in quite a bit of spare time and very pleased bosses, so win-win ;))
Oh and yes I did search stackoverflow, no luck as far as I was able to see :S
I'm glad we could get past that. hmmm, that is an interesting set of limitations you have. Perhaps you could do it the other way round and create the document online then export as pdf through the ctrl+p command? This could be achieved by setting up the whole thing in standard HTML +JS + CSS or you could use markdown/.md within the webpage. This would create a template which can just be filed in. If you have a list of information to be filed in from a .xls or something you can also format that as a JSON string in javascript and automate the creation of the documents as well. If the content is always the same (same number of fields/inputs), then this would be very easy to do.
Otherwise I would look at github.com etc and see if you could find any libraries or something that would do what you've built but with the formatting you need. Also, I applaud you on automating it :).
Those are really smart approaches! I'm definitely going to try them after lunch, thanks so much mate.
No worries, drop me a DM if you wish to discuss further. :)