Jump to content

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...