Remove heading but keep format

S

Sjaakve

Hi,

Imagine, a document generated by another program in rtf format. This
document contains calculations of structural components, not that this
is important. The output needs to be copied to another document. Now a
problem surfaces. Apparently, when generated, a layout style (heading
1 or heading 2 / with or without underline) is added to random lines
of text. This implies that some lines of this calculation appear in
the automatic 'table of contents'.
In the past i would just select the line that appeared in the
'document map' and change the style to 'no spacing' followed by a re-
application of the correct layout.
Now, i was wondering if a macro could recognize the layout of the
line, remove the heading and restore the original layout. And repeat
this for all lines in the document.

Below an example:

line heading
Text Layout
1 yes
Material Courier
New, Bolt, Bottom border, point 8
2 no beams steel
S235 Courier New, point 8
3 yes columns steel
S235 Courier New, point 8

This should be:

line heading
Text Layout
1 no
Material Courier
New, Bolt, Bottom border, point 8
2 no beams steel
S235 Courier New, point 8
3 no columns steel
S235 Courier New, point 8

I've been thinking how to set up a macro, but my novice level didn't
suffice.

Can anybody be of any help.

Thanx,

Sjaak
 
M

macropod

Hi Sjaakve,

You could possibly use Find/Replace to search for all text formatted in the 'Heading 1' Style, and choose on a global or
case-by-case basis whether to change the Style to another (eg 'no spacing'). No macros required.
 
S

Sjaakve

No, not really.

I'm not sure how the style gets there. The document is generated as
flat text. When opend in word 2007 the titles of the various
paragraphs (should be flat courier new, bolt) show op in the docoment
map and the auto contents.

I've been trying to find a VBA command that eliminates the style
status, this being the fact of the text showing in the document map.

when applied to text nothing should change in the layout, only no
references should remain in the document map.

I really dont know how to do this, but i should be possible.

Maybe something like this:
line 1 save font/size/bolt/italic/etc of line 1 to variable
change style to standard
re-apply font/size/bolt/italic/etc from variable to line
line 2 save font/size/bolt/italic/etc of line 2 to variable
change style to standard
re-apply font/size/bolt/italic/etc from variable to line
etc...

I just dont know how to detect the values for the variables.

gtz,

Sjaak
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top