.NET and MS Word : setting rightAlignment ???

C

cc

Hi,

I'm writing a .NET-application from which I work with a Word document.

In the document do I create a table and set some properties of the cells in
the table.


Word.Table table1 = m_doc.Tables.Add(m_wordapp.Selection.Range, MAXROWS,
MAXCOLS, ref missing, ref missing)

Word.Cell cell = table1.Cell(1,1)
cell.Range.Bold = 1
cell.Width = 120
cell.Range.Text = "Description"

But how do you set the rightAlignment for text in the cell ?

thx
Chris
 
V

vbnetdev

This should get you started. Off the cuff code....

oDoc.Selection.Tables.Item(1).Cell(4, 1).Range.Select()
With oDoc.Selection.Tables.Item(1).Cell(4, 1)
.Range.Text = ""
.Row.Alignment = 0
.VerticalAlignment = 0
End With
 
A

Armin Zingler

cc said:
Hi,

I'm writing a .NET-application from which I work with a Word
document.

In the document do I create a table and set some properties of the
cells in the table.


Word.Table table1 = m_doc.Tables.Add(m_wordapp.Selection.Range,
MAXROWS, MAXCOLS, ref missing, ref missing)

Word.Cell cell = table1.Cell(1,1)
cell.Range.Bold = 1
cell.Width = 120
cell.Range.Text = "Description"

But how do you set the rightAlignment for text in the cell ?


Actually a Word VBA question, but...

Set cell.Range.ParagraphFormat.Alignment to wdAlignParagraphRight.

You can use the macro recorder in Word to find this out.


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top