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 have a .net assembly that I did an xlst on the documentation file to generate nice html with proper header tags.

I need to paste this information into word so that I can create a table of contents. The table contents can be built automatically if you use Words built-in "Heading" styles (which happen to be 1-6!).

How do I copy/paste html headings into word that auto matchup to Word's concept of a heading?

I already know (and have seen) that Word retains the styles from the html heading tags, but that is not what I am looking for. The content MUST be styled from Word's built in heading styles.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Firstly I'm assuming you only want the HTML headings to automatically appear in the table of contents and not also gain the style of the appropriate heading from the word template (I'm not entirely sure from your last paragraph).

When you copy and paste headings in HTML into Word they gain appropriate outline levels. Outline levels are the basis of headings in a document (i.e Heading 1 -> Outline Level 1). You can simply modify your TOC field to pick up paragraphs with outline levels instead of heading styles.

  1. Right click on the TOC field
  2. Press Edit Field
  3. Choose Table of Contents
  4. Choose Options
  5. Tick the Outline Levels checkbox.

The field code of the TOC will end up looking like this: { TOC \o \u } and the headings from HTML should be included automatically.

share|improve this answer
    
This approach would work. I winded up using c# interop to automate the creation of on the fly docx files. –  Paul Knopf Feb 20 '13 at 20:05
add comment

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.