2

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.

1 Answer 1

1

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.

1
  • This approach would work. I winded up using c# interop to automate the creation of on the fly docx files.
    – Paul Knopf
    Feb 20, 2013 at 20:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .