How do we insert MS Word allignment in c#?

Posted by Gudevg under C# on 4/26/2012 | Points: 10 | Views : 1583 | Status : [Member] | Replies : 1
After creating a new word file using C#, How do we insert Word allignment with the same?

Deepakkumar G.


Responses

Posted by: Sabarimahesh on: 4/26/2012 [Member] Bronze | Points: 25

Up
0
Down
using Microsoft.Office.Interop.Word;

class Program
{
static void Main(string[] args)
{
DocumentClass document = new DocumentClass();
object defaultTableBehavior = null, autoFitBehavior = null;
Table tbl = document.Content.Tables.Add(document.Content, 2, 2, ref defaultTableBehavior,
ref autoFitBehavior);
tbl.Rows[2].Cells[2].Range.InsertAfter("This is a test.");
tbl.Rows[2].Cells[2].Range.ParagraphFormat.SpaceAfter = 0f;
tbl.Rows[2].Cells.Height = 50f;
tbl.Range.Rows[2].Cells.VerticalAlignment = WdCellVerticalAlignment.wdCellAlignVerticalBottom;
}
}


Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

Gudevg, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response