[RESOLVED] [2005] MS Word and .NET formatting
I can't find the option to align my text. Could someone (probably Rob :)) put me out of my misery (here's a little bit of the code that I have). So taking the text "Collaboration Report", how can I centre it?
vb Code:
oWord = CType(CreateObject("Word.Application"), Word.Application)
oWord.Visible = False
oDoc = oWord.Documents.Add
'Insert a paragraph at the beginning of the Word Doc
oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "Collaboration Report"
'Want to specify centre alignment here if I can ???
oPara1.Range.Font.Bold = 1
oPara1.Format.SpaceAfter = 6
oPara1.Range.InsertParagraphAfter()
Re: [2005] MS Word and .NET formatting
Something like this is what you need?
Code:
Dim oPara1 As Microsoft.Office.Interop.Word.Paragraph = oWord.Documents(1).Content.Paragraphs.Add
oPara1.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter
Re: [2005] MS Word and .NET formatting
Sigh. yes, that's it. I don't know what I was thinking.
I tried every option from oParar1.Range. onwards. Still getting used to using vb and word. Thanks again.
Re: [RESOLVED] [2005] MS Word and .NET formatting
No prob. Glad to help.
Ps, sorry for the 7 minute delay in my reply. :(
:lol:
Re: [RESOLVED] [2005] MS Word and .NET formatting
a whole 7 mins! A terrible wait. Time to up your game Rob. You are starting to slip. :)