Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com May 18 '12 at 18:29

This question came from our site for professional and enthusiast programmers.

3  
Why would you do that? Word isn't meant for that. It tries to do it (HTML mail anyone) and fails miserably. –  PeeHaa May 18 '12 at 15:30
    
MS Word is a definite no no for making html. Use a free program like notepad++ –  Sam May 18 '12 at 15:34
    
Word will assign classes to styles. If you are trying to create a formatted Word document using HTML, this may help. –  Remou May 18 '12 at 15:36
    
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! –  Geekster May 18 '12 at 15:41
    
If you want a document containing HTML, use a PDF. –  Diodeus May 18 '12 at 15:42

2 Answers 2

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|improve this answer

Unfortunately Word has issues with many different HTML/CSS tags, so I'm afraid it's a case of trial and error. When it comes to dt and dd you could replicate the formatting you want by using CSS classes and then applying them to suitable HTML alternatives.

One good tip is that Word has big difficulties with different style sections (especially when it comes to mail.) So always only have only <style></style> section if you're using classes.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.