利用OWC空間做Web報表以及列印

來源:互聯網
上載者:User
這裡只說列印

            sub printexcel()

                        on error resume next                 

                        parent.parent.BodyFrame.Form1.excelData.Export "c:\tempreport.htm", 0, 2

                        set xlApp = CreateObject("EXCEL.Application")

                        xlApp.Workbooks.Open("c:\tempreport.htm")                        

                        str = parent.parent.BodyFrame.Form1.printset.value

                        str = split(str,"|")

                        for t = lbound(str) to ubound(str)

                              j = InStr(str(t),"=")

                              attr = left(str(t),j-1)

                              aval = right(str(t),len(str(t))-j)

                              if (aval <> "")      then

                                    if (attr = "PagerSize") then

                                          xlApp.ActiveSheet.PageSetup.PaperSize = aval

                                    elseif (attr = "Orientation") then

                                          xlApp.ActiveSheet.PageSetup.Orientation = aval

                                    elseif (attr = "LeftMargin") then

                                          xlApp.ActiveSheet.PageSetup.LeftMargin = aval/0.035                       

                                    elseif (attr = "RightMargin") then

                                          xlApp.ActiveSheet.PageSetup.RightMargin = aval/0.035                       

                                    elseif (attr = "TopMargin") then

                                          xlApp.ActiveSheet.PageSetup.TopMargin = aval/0.035                 

                                    elseif (attr = "BottomMargin") then

                                          xlApp.ActiveSheet.PageSetup.BottomMargin = aval/0.035           

                                    elseif (attr = "HeaderMargin") then

                                          xlApp.ActiveSheet.PageSetup.HeaderMargin = aval/0.035           

                                    elseif (attr = "FooterMargin") then                                                     

                                          xlApp.ActiveSheet.PageSetup.FooterMargin = aval/0.035           

                                    end if           

                              end if

                        Next

                        xlApp.Workbooks(1).Save                       

                        if (pv=1) then

                              xlApp.Visible = true

                              xlApp.Range(parent.parent.BodyFrame.Form1.excelData.ActiveWindow.ViewableRange).PrintPreview

                        else

                              xlApp.Range(parent.parent.BodyFrame.Form1.excelData.ActiveWindow.ViewableRange).PrintOut

                        end if

                        xlApp.Quit

                                               

                        'Set fs = CreateObject("Scripting.FileSystemObject")

                        'if fs.FileExists("c:\tempreport.htm") then

                        '      fs.DeleteFile "c:\tempreport.htm",True

                        'end if

                  end sub

                 

                  sub printpreview()

                        pv=1

                        call printexcel()                       

                  end sub

                 

                  sub printout()

                        pv=0

                        call printexcel()           

                  end sub

意思還是利用Excel來列印

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.