sometimes \r and sometimes \r\n

B

Bob Eaton

I'm creating a COM add-in for Word and I was processing the text in the
files with Range objects.

I've noticed that when I edit original Word documents (i.e. *.doc), the end
of paragraph is '\r' in the Paragraph.Range.Text string, but when I edit a
text file, the paragraph ends have '\r\n' (presumably, because the original
program that edited those plain text documents put them there...)

Is there a way to detect this with the Interop.Word framework? I thought I
saw a method called "IsCRLF" or something like that off of some object...
but I can't find it anymore...

Thanks,
Bob
 
C

Cindy M.

Hi Bob,

This is already fairly old and you may have gotten a reply by now...

FWIW, I don't think there is anything exactly like the function you're looking
for in the Word object model. But often using Find to check for the presence
of ANSI 10 would do the trick (Word uses ANSI 13 for the paragraph marks). The
search text would be: ^10
I'm creating a COM add-in for Word and I was processing the text in the
files with Range objects.

I've noticed that when I edit original Word documents (i.e. *.doc), the end
of paragraph is '\r' in the Paragraph.Range.Text string, but when I edit a
text file, the paragraph ends have '\r\n' (presumably, because the original
program that edited those plain text documents put them there...)

Is there a way to detect this with the Interop.Word framework? I thought I
saw a method called "IsCRLF" or something like that off of some object...
but I can't find it anymore...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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