find&replace

F

Felipe Garcia

i'm using find replace(the find/replace works fine), but some documents are
loosing its font formatting.
what's happening ?
 
K

Klaus Linke

Hi Felipe,

The replacement will get the formatting that was applied at the start of the matched text.
If you have "on 07/05/2004", with "on" regular, and "07/05/2004" italic, and replace with "on the day 07/05/2004", the result will
loose the italic.

You can often smartly use wildcard replacements to keep the formatting, say, check "Match wildcards",
Find what: (on )([0-9]@/[0-9]@/[0-9]{4})
Replace with: \1the day \2

In this case, if the date had some special formatting to start with, it'll keep the formatting after the replacement (since it's
simply re-inserted using \2).

Can you give an example where you loose the formatting? Perhaps there's a work-around.

Regards,
Klaus
 
F

Felipe Garcia

Hi Klaus, actually i'm making documents based on legal templates for my
company, and each template has your inherent formatting. The process of
find/replace consists of the following thing: gather data from sql, and then
cross the gathered data with the template variables. We have two type of
variables: Automatic(ie: [VAR]) and Manual variables(ie: *VAR*). The
Automatic Variables receives data from SQL, and Manual Variables receives
data from text fields of the web page.
Those Legal templates had annoying formatting, so if anything in the final
document becomes messy, it's invalidated. And the majority of templates have
tables, pictures, borders, tabs, indentation, text boxes, lines... (think in
every format of word that you can remember..... YES! probably the templates
will had one of those).

Thanks Man.
Cheers.
Klaus Linke said:
Hi Felipe,

The replacement will get the formatting that was applied at the start of the matched text.
If you have "on 07/05/2004", with "on" regular, and "07/05/2004" italic,
and replace with "on the day 07/05/2004", the result will
loose the italic.

You can often smartly use wildcard replacements to keep the formatting, say, check "Match wildcards",
Find what: (on )([0-9]@/[0-9]@/[0-9]{4})
Replace with: \1the day \2

In this case, if the date had some special formatting to start with, it'll
keep the formatting after the replacement (since it's
 
K

Klaus Linke

Hi Felipe,

I'm not 100% sure what your file looks like, and what you want to replace with what.

Say you have "[VAR]" in some weird formatting, followed by "Name:" in the formatting you want to keep.

Then use a wildcard replacement:
Find what: \[VAR\](Name:)
Replace with: \1

The backslashes \ are needed since the angular brackets [ ] have a special meaning in wildcard searches (and therefore have to be
"escaped").
\1 inserts the stuff from the 1st round (brackets).

If that doesn't help, please post some real-world example from your files!
Klaus




Felipe Garcia said:
Hi Klaus, actually i'm making documents based on legal templates for my
company, and each template has your inherent formatting. The process of
find/replace consists of the following thing: gather data from sql, and then
cross the gathered data with the template variables. We have two type of
variables: Automatic(ie: [VAR]) and Manual variables(ie: *VAR*). The
Automatic Variables receives data from SQL, and Manual Variables receives
data from text fields of the web page.
Those Legal templates had annoying formatting, so if anything in the final
document becomes messy, it's invalidated. And the majority of templates have
tables, pictures, borders, tabs, indentation, text boxes, lines... (think in
every format of word that you can remember..... YES! probably the templates
will had one of those).

Thanks Man.
Cheers.
Klaus Linke said:
Hi Felipe,

The replacement will get the formatting that was applied at the start of the matched text.
If you have "on 07/05/2004", with "on" regular, and "07/05/2004" italic,
and replace with "on the day 07/05/2004", the result will
loose the italic.

You can often smartly use wildcard replacements to keep the formatting, say, check "Match wildcards",
Find what: (on )([0-9]@/[0-9]@/[0-9]{4})
Replace with: \1the day \2

In this case, if the date had some special formatting to start with, it'll
keep the formatting after the replacement (since it's
simply re-inserted using \2).

Can you give an example where you loose the formatting? Perhaps there's a work-around.

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