以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  关于打印预览没有最法最大化  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=69045)

--  作者:dj68301367
--  发布时间:2015/5/29 13:51:00
--  关于打印预览没有最法最大化
目前做了一个打印预览,但是预览的窗口比较小,怎么样才可以最大化

Dim Book As New XLS.Book(ProjectPath & "Attachments\\" & Mname & ".xls") \'打开模板
Dim fl As String = ProjectPath & pname
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Book.Build() \'生成报表
Book.Save(fl)
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fl)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Dim Rg As MSExcel.Range = Ws.Cells
\'Rg.EntireColumn.AutoFit   \'自动调整列宽
Rg.EntireRow.AutoFit  \'自动调整行高
App.Visible = True
Ws.PrintPreview
wb.DisplayFullScreen = True ‘全屏显示

--  作者:大红袍
--  发布时间:2015/5/29 14:35:00
--  

 加一句

 

ShowAppWindow(pname,2)

 

http://www.foxtable.com/help/topics/2713.htm

 


--  作者:dj68301367
--  发布时间:2015/6/3 10:26:00
--  
经调试不行!用ShowAppWindow(pname,2) 也不行

Function MyPrintAll(Mname As String,PName As String)
Dim Book As New XLS.Book(ProjectPath & "Attachments\\" & Mname & ".xls") \'打开模板
Dim fl As String = ProjectPath & pname
Dim Sheet As XLS.Sheet = Book.Sheets(0)

Book.Build() \'生成报表
Book.Save(fl)

Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fl)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Dim Rg As MSExcel.Range = Ws.Cells
\'Rg.EntireColumn.AutoFit   \'自动调整列宽
Rg.EntireRow.AutoFit  \'自动调整行高
App.Visible = True
Ws.PrintPreview
ShowAppWindow(fl,2)
End Function

--  作者:大红袍
--  发布时间:2015/6/3 10:31:00
--  
Function MyPrintAll(Mname As String,PName As String)
Dim Book As New XLS.Book(ProjectPath & "Attachments\\" & Mname & ".xls") \'打开模板
Dim fl As String = ProjectPath & pname
Dim Sheet As XLS.Sheet = Book.Sheets(0)

Book.Build() \'生成报表
Book.Save(fl)

Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fl)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Dim Rg As MSExcel.Range = Ws.Cells
\'Rg.EntireColumn.AutoFit   \'自动调整列宽
Rg.EntireRow.AutoFit  \'自动调整行高
App.Visible = True
ShowAppWindow(pname,2)
Ws.PrintPreview
End Function

--  作者:dj68301367
--  发布时间:2015/6/3 10:53:00
--  
请看图片,还是不行!!
Function MyPrintAll(Mname As String,PName As String)
Dim Book As New XLS.Book(ProjectPath & "Attachments\\" & Mname & ".xls") \'打开模板
Dim fl As String = ProjectPath & pname
Dim Sheet As XLS.Sheet = Book.Sheets(0)

Book.Build() \'生成报表
Book.Save(fl)

Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fl)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Dim Rg As MSExcel.Range = Ws.Cells
\'Rg.EntireColumn.AutoFit   \'自动调整列宽
Rg.EntireRow.AutoFit  \'自动调整行高
App.Visible = True

ShowAppWindow(Pname,2)
Ws.PrintPreview
End Function

--  作者:dj68301367
--  发布时间:2015/6/3 10:54:00
--  

图片点击可在新窗口打开查看此主题相关图片如下:as.png
图片点击可在新窗口打开查看

再传一次

--  作者:大红袍
--  发布时间:2015/6/3 10:55:00
--  

 不可能,测试没有问题。http://www.foxtable.com/help/topics/2713.htm

 


--  作者:dj68301367
--  发布时间:2015/6/3 11:53:00
--  
可是我的就是不行 ,会不会是因为|Excel的问题呀,
你也看得到我的代码,我是直接复制上来的

--  作者:大红袍
--  发布时间:2015/6/3 12:40:00
--  
 pname 直接改成文字比如 12345.xls
--  作者:大红袍
--  发布时间:2015/6/3 12:42:00
--  

我这样测试

 

Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("d:\\test.xls")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Dim Rg As MSExcel.Range = Ws.Cells
\'Rg.EntireColumn.AutoFit   \'自动调整列宽
Rg.EntireRow.AutoFit  \'自动调整行高
App.Visible = True


ShowAppWindow("test.xls",2)
Ws.PrintPreview