473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

.NET and MS Word : setting rightAlignment ???

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

Mar 3 '06 #1
2 2529
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
--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com

"cc" <cm****@yahoo.com> wrote in message
news:44***********************@news.skynet.be...
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

Mar 3 '06 #2
"cc" <cm****@yahoo.com> schrieb
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
Mar 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Jaime Rios | last post by:
Hi, I created a COM AddIn for Word that performs the functions that it needs to, but I needed to add the ability for the toolbar created by the COM AddIn to remember it's last position and...
1
by: Stephen Barrett | last post by:
I am doing word automation with Word 2003. Everything works great except for one thing. When I set the word object's ActivePrinter to a different printer, it changes the system default. I looked...
4
by: s.subbarayan | last post by:
Dear all, I would like to know the easiest efficient way to set or inject a particular value in the given word or byte?The problem is: I have to implement a function which will set a value from...
0
by: srivalli chavali via DotNetMonster.com | last post by:
Hi, I have to print a word document using C#.NET. I also have to customize the printing option, the Printer tray, programmatically. So, I have used the PrintDocument class available in C#....
1
by: Jonas | last post by:
Hi ! Perhaps this isn't the right group to send to, but... I have exported my report (Crystal Report) to a stream formatted as Word-document. Both the exporting and streaming works just fine...
12
by: Rob Nicholson | last post by:
We've implemented functionality to allow a user to download a document (any document type) from the IIS server using the following code: Response.Clear() Response.ContentType =...
4
by: Rob | last post by:
Here is my issue: I am trying to load word through vb.net code behind an ASP.NET webform. I know it is possible to use the Automation and COM classes because a co-worker has it working on his...
3
by: tigrrgrr42 | last post by:
I am working(vb.net03and05) with word documents stored in a sql db and I am currently bringing them from a byte array into a temp file to pop into word and make word do its thing as a com object. ...
2
by: cc | last post by:
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 =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.