Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Sep 19, 2019 1:43 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: MS Word OLE - Find/Replace and EOL
PostPosted: Thu Aug 18, 2011 12:22 pm 
Offline

Joined: Wed Apr 27, 2011 12:33 pm
Posts: 13
I'm doing a find/replace in a word document using nearly identical code to what is found in the documentation and it's all working fine except: Word is either not recognizing my EOL's or RS is not sending them.

Anyone run into this before and found a solution?

The reason I need the EOL's is because the number of lines that I'd need is unknown so I cannot add a new FIND text for each one.


Top
 Profile  
Reply with quote  
 Post subject: Re: MS Word OLE - Find/Replace and EOL
PostPosted: Mon Aug 22, 2011 2:21 pm 
Offline

Joined: Wed Apr 27, 2011 12:33 pm
Posts: 13
36 views and no replies doesn't give a guy a lot of hope...


Top
 Profile  
Reply with quote  
 Post subject: Re: MS Word OLE - Find/Replace and EOL
PostPosted: Fri Sep 02, 2011 4:13 pm 
Offline

Joined: Fri Sep 30, 2005 9:29 am
Posts: 732
Location: California
Can you restate the question? I'm not clear on what it is you are trying to accomplish.


Top
 Profile  
Reply with quote  
 Post subject: Re: MS Word OLE - Find/Replace and EOL
PostPosted: Fri Sep 02, 2011 4:58 pm 
Offline

Joined: Wed Apr 27, 2011 12:33 pm
Posts: 13
Hey dglass, thanks for taking a look. Maybe I'm putting too much of what I foresee to be the answer and mudding up the situation.

My program is customizing contracts for window salesmen. So a salesman walks through a house, enters data into the program that the customer is interested in. At the end, if the customer agrees, then the program will print out contracts. One of the contracts has a place that requires that I list each window type that customer has ordered. So something like this:

*contract jargon*
Window Types:
Double Hung -> double hung description
Sliding Window -> sliding window description
Picture Window -> Picture Window description.


So my client has given me his contracts (in word format). Any place where my program needs to "fill in the blank" I have put in variables (ex <name>, <address>). The variable for the window types is <styles>. I had set it up to do a Find/Replace just like in the RS examples and it's working with no problems except one. The output I got was this:

*contract jargon*
Window Types:
Double Hung -> double hung description Sliding Window -> sliding window description Picture Window -> Picture Window description.


So I attempted to insert EOL's between each window stype (double hung, sliding, etc) and Word was not inserting them as line breaks and continued to run the lines together.

While this may seem like a small issue, not only does the formatting make it look ugly it also makes it hard to read, precisely in an area where the government is very critical of companies who may try and make contracts difficult to understand by their customers.

So, after having said all that, what I really need is to be able to replace 1 variable (<styles>) with text that appears on multiple lines.

Make sense?


Top
 Profile  
Reply with quote  
 Post subject: Re: MS Word OLE - Find/Replace and EOL
PostPosted: Fri Sep 02, 2011 6:45 pm 
Offline

Joined: Fri Sep 30, 2005 9:29 am
Posts: 732
Location: California
You might want to try constructing your replacement text with '^p' separators between each item. Without the apostrophes, of course.


Top
 Profile  
Reply with quote  
 Post subject: Re: MS Word OLE - Find/Replace and EOL
PostPosted: Sun Sep 04, 2011 9:09 am 
Offline

Joined: Wed Apr 27, 2011 12:33 pm
Posts: 13
Thanks! I'll give a try later today. I had read on the net a few people suggesting chr(10) or 12 or something like that but that did not work. First I've heard of ^p... thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: MS Word OLE - Find/Replace and EOL
PostPosted: Sun Sep 04, 2011 9:25 am 
Offline

Joined: Mon May 30, 2011 12:56 am
Posts: 702
Quote:
'or something like that' ..'did not work'

Not surprising really.
CHR(12) is new page if memory serves.

CHR(10) CHR(13) in combination is the windows end of line/line feed combination.


if you cant get that working, try:

wrdApplication.Selection.InsertParagraph


Top
 Profile  
Reply with quote  
 Post subject: Re: MS Word OLE - Find/Replace and EOL
PostPosted: Thu Sep 08, 2011 11:21 am 
Offline

Joined: Wed Apr 27, 2011 12:33 pm
Posts: 13
Yes, chr(10)+chr(13) was what I had read. Didn't have it in front of me and was no longer in the code...

I tried ^p and it worked! Thanks everyone for your help!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group