Jump to content
Sign in to follow this  

Working with text in Microsoft Word

Recommended Posts


I have created a Microsoft word document. Then I output data into a table, I would like to set the alignment of each column (Vertical AND Horizontal. I cannot figure out how to do this. Any help would be greatly appreciated. I have searched msdn for hours and cannot figureo ut how to use the .Alignment properties. Thanks

Neither of the last 2 lines of this code did anything for me.

$oTable.cell(2+_GUICtrlListViewGetItemCount ( $lvItems ), 3).Range.Text = "SUBTOTAL"
            $oTable.cell(2+_GUICtrlListViewGetItemCount ( $lvItems ), 4).Range.Text = GUICtrlRead ( $lblLineItemsSubtotal )
            $oTable.cell(2+_GUICtrlListViewGetItemCount ( $lvItems ), 6).Range.Text = GUICtrlRead ( $lblProfitSubtotal )
            $oTable.cell(2+_GUICtrlListViewGetItemCount ( $lvItems ), 7).Range.Text = GUICtrlRead ( $lblTotalSubtotal )
            $oTable.cell(3+_GUICtrlListViewGetItemCount ( $lvItems ), 3).Range.Text = "SALES TAX"
            $oTable.cell(3+_GUICtrlListViewGetItemCount ( $lvItems ), 7).Range.Text = GUICtrlRead ( $lblTotalSalesTax )
            $oTable.cell(4+_GUICtrlListViewGetItemCount ( $lvItems ), 3).Range.Text = "TOTAL"
            $oTable.cell(4+_GUICtrlListViewGetItemCount ( $lvItems ), 7).Range.Text = GUICtrlRead ( $lblTotalTotal )
            $oTable.Rows.Item(1).Range.Font.Bold = True
            $oTable.Range.Font.Size = 8.5
            $oTable.Rows.Item(1).Range.Font.Size = 7.5
            $oTable.Range.Font.Name = "Trebuchet MS"
            $oTable.Columns.Item(1).Width = $oWordProfits.InchesToPoints("0.54")
            $oTable.Columns.Item(2).Width = $oWordProfits.InchesToPoints("2.16")
            $oTable.Columns.Item(3).Width = $oWordProfits.InchesToPoints("0.88")
            $oTable.Columns.Item(4).Width = $oWordProfits.InchesToPoints("1.08")
            $oTable.Columns.Item(5).Width = $oWordProfits.InchesToPoints("0.84")
            $oTable.Columns.Item(6).Width = $oWordProfits.InchesToPoints("0.77")
            $oTable.Columns.Item(7).Width = $oWordProfits.InchesToPoints("0.7")
            $oTable.Columns.Item(1).Alignment = "3"
            $oTable.Columns.Item(1).HorizontalLineFormat.Alignment = "wdHorizontalLineAlignRight"
Edited by Leykis101

Share this post

Link to post
Share on other sites

I don't have time to test this now, but you need to define the wd* constants.

Const $wdHorizontalLineAlignLeft = 0
Const $wdHorizontalLineAlignCenter = 1
Const $wdHorizontalLineAlignRight = 2

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.