Rate this:
See more: , +
```using Microsoft.Office.Core;
using Microsoft.Office.Interop.Word;
using Word = Microsoft.Office.Interop.Word;
using System.Reflection;

object oMissing = System.Reflection.Missing.Value;
object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */

//Start Word and create a new document.
Word._Application oWord;
Word._Document oDoc;
oWord = new Word.Application();
oWord.Visible = true;
oDoc = oWord.Documents.Add(ref oMissing, ref oMissing,
ref oMissing, ref oMissing);```

This is where I run into the problem:

```//Insert a paragraph at the beginning of the document.
Word.Paragraph oPara1;
Word.Range rng = oPara1.Range;
rng.Font.Size = 14;
rng.Font.Name = "Arial";
rng.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
oPara1.Range.Font.Bold = 1;
oPara1.Range.Text = "SOCIAL ASSESSMENT";
oPara1.Format.SpaceAfter = 24;    //24 pt spacing after paragraph.
oPara1.Range.InsertParagraphAfter();

//Insert another paragraph.
object oRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
Word.Paragraph oPara2;
oRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oPara2.Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft;
oPara2.Range.Font.Underline = Word.WdUnderline.wdUnderlineSingle;
oPara2.Range.Font.Bold = 1;
oPara2.Range.Text = "Request for Services and Identifying Information";
oPara2.Format.SpaceAfter = 24;
oPara2.Range.InsertParagraphAfter();

//Insert another paragraph.
Word.Paragraph oPara3;
oRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oPara3.Range.Font.Bold = 0;
oPara3.Range.Text = "Applicants Name: " + textBox1.Text + " " + textBox7.Text + "\r\n" + "Referred by: "
+ textBox2.Text + "\r\n" + "Request for Evaluation by: " + textBox3.Text + "\r\n" +
"Reason for Referral: " + textBox4.Text + "\r\n" + "Service Request: " + textBox5.Text
+ "\r\n" + "Clients Primary Language: " + textBox6.Text + "\r\n" +
"Language of Informant/Advocate: " + textBox8.Text;
oPara3.Format.SpaceAfter = 24;
oPara3.Range.InsertParagraphAfter();```

The entire document ends up being left-aligned. How can I fix this?

Thank you,
Posted 1-Apr-12 20:27pm
Edited 1-Apr-12 21:20pm
v4

Hi I have the same problem in my project but your solution 2 is not working so any other solutions??
manikantaer - 8-Feb-13 3:45am

Rate this:

## Solution 2

I was able to solve this myself. I had to specify exactly which range to align:

```            Word.Range rng = oPara1.Range;
rng.Font.Size = 14;
rng.Font.Name = "Arial";
rng.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;```

And now left align the next paragraph:

```            Word.Range rng2 = oPara2.Range;
rng2.Font.Size = 12;
rng2.Font.Name = "Arial";
rng2.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft;```

This centers the first line of text, while left aligning the rest
v4

Rate this:

## Solution 3

Hi
I have the same problem in my project but your solution 2 is not working
so any other solutions??
Use "Have a Question or Comment?" button if you want to comment on a solution, so that the original poster will be notified. I would suggest you to ask this as a new question here[^]. And please delete this solution as its not an answer.
__TR__ - 8-Feb-13 2:46am

Rate this:

## Solution 1

I'm sorry but it did not. The first link is for a data table, and the second link is for something I'm not even using. If you take a closer look at my problem, the text align properties that I set are acting for the entire document and not each paragraph separately. Thank you, vlad