0

I want to export some data from a database. I can do so in plain text. However, I would like to add formatting tags. Afterwards I want to be able to open the files in Microsoft Word.

Of course, I could use html-formatting and save the file as a .docx file. I was wondering though, if there is a better way to do this.

I aim at a few simple formatting types: bold, italics, font size change and font change.

8
  • Word understands lots of formats. HTML sprung to mind even before reading your whole question, but there's also RTF. What kind of things are you trying to do? – Mr Lister Jan 16 '20 at 7:50
  • @MrLister: I updated my question. Just a few basic ones. – MWB Jan 16 '20 at 7:51
  • I think HTML and RTF are your best bets. Most other formats Word recognises aren't plain text, so those are out. – Mr Lister Jan 16 '20 at 8:07
  • RTF seems a bit verbose. I saved a file from word to rtf and it had a lot of code/tags in there. Or is there a way to strip a lot of the code? – MWB Jan 16 '20 at 8:08
  • 2
    Heh, if you save a Word file as HTML you get the same bloating. AFAIK the simplest RTF starts with {rtf1 on a line by itself and ends with }, and everything in between is content. See pindari.com/rtf1.html But I don't know if there's a cleanup tool for existing RTF documents if that's what you mean. – Mr Lister Jan 16 '20 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.