Inserting A Line Break (Not A Paragraph Break) Programatically To A Word Document

user3731528 picture user3731528 · Jun 12, 2014 · Viewed 20.5k times · Source

I am using the Office Developer Tools for Visual Studio 2013 in C#. Ever since Word 2007, adding a "\n" character adds a paragraph break (which adds more space than the line break in Word). How can I add a line break to a document? I've tried "\n", "\r", and "\r\n" all of which seem to add a paragraph break.

Answer

user3731528 picture user3731528 · Jun 17, 2014

It turns out that Word uses Vertical Tabs for its line breaks. I was able to add them using the "\v" character to ranges. See What is a vertical tab? for more details.