object missing = System.Reflection.Missing.Value;
object Visible=true;
object start1 = 0;
object end1 = 0;
string name = "edward";
_Application WordApp = new Application();
Document adoc = WordApp.Documents.Add(ref missing, ref missing, ref missing, ref missing);
Range rng = adoc.Range(ref start1, ref missing);
try
{
rng.Font.Name = "Verdana";
rng.InsertAfter("Hello World!" + "\r" + "Something in-between" + "\r" + "Hello World!");
object filename = @"C:\Users\edward\Documents\" + name + ".docx";
adoc.SaveAs(ref filename, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
WordApp.Visible = true;
}
catch (Exception ex)
{
keeper = "Bugger";
}
The current problem is I want a new line, but a single new line, the kind you'd get if you held down Shift while pressing the enter key in Word. I have tried /n and /r and they both seem to do the same.

New Topic/Question
Reply



MultiQuote





|