Mega macro with find and replace (HELP!)

G

Guest

Document example:


FISHING

This is a great sport. I wish everyone could get into it like many common
people have already. Spending days on the water with nothing to show for it
but wet clothes and a muddy dog.

SURFING

A sport that catches the water at it's best. Feel the pain, start today.


I have another program that is sending this text to a word document. I can
only control the text, not the formatting. I need to create a TOC based upon
this doc. The TOC must also have outline number formatting. I have done
this in the past with search and replace and formatting. I can's figure a
way to change the ALL CAPS words to header 1 with find and replace. I also
need a way to pull specific parts of the paragraphs into a header 2 level and
include in the TOC.

Here is what I need to end up with:

1. FISHING
1.1 nothing to show for it

2. SURFING
2.1 start today

I can use markers in the other program to indicate a start and stop
character for the search, but can't figure out how to get find and replace to
select between start and stop then change format. Any ideas?

dan
 
K

Klaus Linke

Hi Dan,

You can apply the heading style with two wildcard replacements:
Edit > Replace, check "Match wildcards",
Find what: (^13)([A-Z ]@^13)
Replace with: \1<h1>\2

Find what: \<h1\>(?)
Replace with: \1 ((and Format > Style = Heading 1))


You could remove the empty paragraphs at the same time, changing the first replacement to
Find what: (^13)[^13]@([A-Z ]@^13)[^13]@
The empty space before/after headings is better done with "Space before/after" in the heading's style definition.


The Word help has something on Find/Replace with "placeholders", or you can read more about it here if you're interested:
http://word.mvps.org/FAQs/General/UsingWildcards.htm


To pick up just a small random part of a chapter as a "heading" in the TOC, you could insert paragraph marks before and after the text,
FISHING¶
This is a great sport. I wish everyone could get into it like many common
people have already. Spending days on the water ¶
with nothing to show for it¶
but wet clothes and a muddy dog.¶

Then format "with nothing to show for it" in a new paragraph style, say "TOC_Level2", and pick that up in the TOC:
{ TOC \h \z \t "Heading 1;1;TOC_Level2;2" }

You could apply outline numbering to the TOC styles for the numbers, but I don't really see the sense in having numbers in the TOC that don't appear in the main text.

Regards,
Klaus
 

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