word 设置

Set WordApp = New Word.Application
WordApp.Documents.Add
Set doc = WordApp.ActiveDocument
Set se1 = WordApp.Selection

      
With doc.PageSetup
            .LineNumbering.Active 
= False
            .Orientation 
= wdOrientLandscape
            .TopMargin 
= CentimetersToPoints(2)
            .BottomMargin 
= CentimetersToPoints(2)
            .LeftMargin 
= CentimetersToPoints(2)
            .RightMargin 
= CentimetersToPoints(2)
            .Gutter 
= CentimetersToPoints(0)
            .HeaderDistance 
= CentimetersToPoints(1.5)
            .FooterDistance 
= CentimetersToPoints(1.75)
            .PageWidth 
= CentimetersToPoints(29.7)
            .PageHeight 
= CentimetersToPoints(21)
            .FirstPageTray 
= wdPrinterDefaultBin
            .OtherPagesTray 
= wdPrinterDefaultBin
            .SectionStart 
= wdSectionNewPage
            .OddAndEvenPagesHeaderFooter 
= False
            .DifferentFirstPageHeaderFooter 
= False
            .VerticalAlignment 
= wdAlignVerticalTop
            .SuppressEndnotes 
= False
            .MirrorMargins 
= False
            .TwoPagesOnOne 
= False
            .GutterPos 
= wdGutterPosLeft
            .LayoutMode 
= wdLayoutModeLineGrid
        
End With

 字体:
 wordApp.Selection.Font.Size 
= 9

'表格:
'
本例只简单地设置了表格居中、自动调整表格列宽、表头居中、标题行重复、设置表格边框线、设置表格纵向居中 
Temp_Table.Rows.Alignment = wdAlignRowCenter 
Temp_Table.AutoFitBehavior wdAutoFitContent 
Temp_Table.Rows(
1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter 
Temp_Table.Rows(
1).Range.Rows.HeadingFormat = wdToggle 
Temp_Table.Borders(wdBorderLeft).LineWidth 
= wdLineWidth150pt 
Temp_Table.Borders(wdBorderRight).LineWidth 
= wdLineWidth150pt 
Temp_Table.Borders(wdBorderTop).LineWidth 
= wdLineWidth150pt 
Temp_Table.Borders(wdBorderBottom).LineWidth 
= wdLineWidth150pt 
Temp_Table.Range.Cells.VerticalAlignment 
= wdCellAlignVerticalCenter 


'调用word打开word文档:

 
Dim wordApp As New Word.Application
            
Dim myDoc As Word.Document
            wordApp 
= CreateObject("Word.Application")

            
With wordApp
                .Visible 
= True
                .Documents.Open(strPath)
            
End With

            
''释放变量 
            'wordApp.DisplayAlerts = False
            'wordApp.Quit()
            'myDoc = Nothing
            'GC.Collect() '强制垃圾回收
           'System.Runtime.InteropServices.Marshal.ReleaseC

'在表格里插入图片:
  oTable.Rows(1).Cells(1).Range.InlineShapes.AddPicture("c: est.jpg")
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值