vb控制word输出报告,其中的一页需要将页面设置为横向,请高手大虾们帮助!

解决方案 »

  1.   

    ActiveDocument.Orientation = wdOrientLandscape
      

  2.   

    http://download.csdn.net/source/1627134
      

  3.   

    Word 文档的页面设置中有“应用于”下拉框,可以分开设置。按需要多次设置不同的纸张方向即可。
      

  4.   

    '先创建WORD对象
      Private   wordApp   As   Object                       'word.application对象
      If   wordApp   Is   Nothing   Then
              Set   wordApp   =   CreateObject(;Word.Application;)
              If   wordApp   Is   Nothing   Then
                      DoPrintToFile.Result   =   ;启动Word失败;
                      Exit   Function
              End   If
      End   If  '打开word文档
      wordApp.Visible   =   False
      wordApp.Documents.Open   fileName:=fileName,   Revert:=False,   ReadOnly:=True
      wordApp.Documents(fileName).Activate  '设置打印属性
        With wordApp.ActiveDocument.Styles(wdStyleNormal).Font
            If .NameFarEast = .NameAscii Then
                .NameAscii = ""
            End If
            .NameFarEast = ""
        End With
        With wordApp.ActiveDocument.PageSetup
            .LineNumbering.Active = False
            .Orientation = wdOrientLandscape
            .TopMargin = CentimetersToPoints(3.17)
            .BottomMargin = CentimetersToPoints(3.17)
            .LeftMargin = CentimetersToPoints(2.54)
            .RightMargin = CentimetersToPoints(2.54)
            .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
            .BookFoldPrinting = False
            .BookFoldRevPrinting = False
            .BookFoldPrintingSheets = 1
            .GutterPos = wdGutterPosLeft
            .LayoutMode = wdLayoutModeDefault
        End With