Paste HTML into Word

35,937

I have found a suitable answer to this.

  • By stylizing each HTML object in the source, Word will then apply styles if you "paste" with the option "Keep source formatting", most of the kinds of CSS will be converted into a Word style.

eg:

This will have the same formatting in HTML when you copy/paste to Word with "Keep Formatting" selected.

<h1 style="border:1px solid #CCC;font-size:1.5em">Title</h1>
Share:
35,937

Related videos on Youtube

Geekster
Author by

Geekster

Updated on September 18, 2022

Comments

  • Geekster
    Geekster over 1 year

    I'm have a tough time getting my HTML that I am pasting into word to be converted to the proper styles I want.

    My HTML includes: dt, dd, h1-h7, p, li, ul... etc.

    dt and dd are not working. Word thinks they are paragraphs and applies the "Normal" style to them.

    h1-h7 work great.

    li works great.

    What can I put into word so that when I paste in these dt & dd they will select a proper style?

    EDIT: I certainly appreciate the responses received so far, however nobody has really answered this yet. I cannot decide what the export medium is for this job, as I am not the decision maker. The requirement is MS Word files. There will be headers and footers, page numbering and a table of contents to the project, but whenever I paste HTML into Word the same problem happens: certain tags are styled and others are ignored.

    My guess is that this is a deficiency/bug in MS Word, so I will go ahead and open a ticket with Microsoft.

    • PeeHaa
      PeeHaa almost 12 years
      Why would you do that? Word isn't meant for that. It tries to do it (HTML mail anyone) and fails miserably.
    • Sam
      Sam almost 12 years
      MS Word is a definite no no for making html. Use a free program like notepad++
    • Remou
      Remou almost 12 years
      Word will assign classes to styles. If you are trying to create a formatted Word document using HTML, this may help.
    • Admin
      Admin almost 12 years
      Remou: so if there is a style in Word that has a class name that matches it should apply the style? This is hugely helpful if that's gonna work!
    • Diodeus - James MacFarlane
      Diodeus - James MacFarlane almost 12 years
      If you want a document containing HTML, use a PDF.
    • Remou
      Remou almost 12 years
    • asfallows
      asfallows almost 12 years
      Have you tried saving it as a .html file and then opening that file with Word? I just tried this on a file I have and it appeared to be formatted correctly. The file I used isn't heavily styled, though, so I don't know if you'll get the desired results all the time.