Line & Paragraph breaks in Word from C#

Line & Paragraph breaks in Word from C#

Post by Evan Ston » Sun, 09 Oct 2005 01:30:21


What are the characters that one needs to use when adding line (equivalent
to Shift-Enter) and paragraph breaks (equivalent to Enter) when adding text
to Word from C# via automation?

In my initial tests, simply appending "\n" seems to produce an escape-like
character -- which is not what I'm looking for -- so I'm assuming I'm
missing something here.

Thanks!

evan stone | software engineer
----------------------------------------
santa rosa, ca, usa
 
 
 

Line & Paragraph breaks in Word from C#

Post by Evan Ston » Sun, 09 Oct 2005 01:51:24

Well, I answered my own question by recording a macro and looking at the
resultant code that Word generated.

It looks like appending Chr(11) (or "x0B" in C#) handles the line break
issue (which is what I was _really_ after), and calling
Selection.TypeParagraph inserts a paragraph break -- which info I'll just
set aside for future use... ;)

Thanks!

evan stone | software engineer
----------------------------------------
santa rosa, ca, usa