-- 作者:lisheng1971
-- 发布时间:2018/12/12 10:01:00
-- 强退问题求助!
Dim tb As WinForm.TabControl = e.Form.Controls("TabControl1") Dim pg As WinForm.TabPage = tb.SelectedPage Dim doc As PrintDoc = e.Form.GernatePrintDoc(pg) If tb.SelectedPage.Text = "报名登记汇总" Then Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "excel|*.xls" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 MessageBox.Show("你要保存为:" & dlg.FileName,"提示") \'提示用户选择的文件 Dim Book As New XLS.Book(ProjectPath & "Attachments\\报名登记汇总.xls") Book.Build() \'生成细节区 Book.Save(dlg.FileName) \'保存工作簿 MessageBox.Show("保存成功" ) End If ElseIf tb.SelectedPage.Text = "中高级工资审" Then Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "excel|*.xls" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 MessageBox.Show("你要保存为:" & dlg.FileName,"提示") \'提示用户选择的文件 Dim Book As New XLS.Book(ProjectPath & "Attachments\\报名资格验审.xls") Book.Build() \'生成细节区 Book.Save(dlg.FileName) \'保存工作簿 MessageBox.Show("保存成功" ) End If ElseIf tb.SelectedPage.Text = "中高级工考核" Then Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "excel|*.xls" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 MessageBox.Show("你要保存为:" & dlg.FileName,"提示") \'提示用户选择的文件 Dim Book As New XLS.Book(ProjectPath & "Attachments\\中高级工考核.xls") Book.Build() \'生成细节区 Book.Save(dlg.FileName) \'保存工作簿 MessageBox.Show("保存成功" ) End If ElseIf tb.SelectedPage.Text = "技师高技资审" Then Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "excel|*.xls" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 MessageBox.Show("你要保存为:" & dlg.FileName,"提示") \'提示用户选择的文件 Dim Book As New XLS.Book(ProjectPath & "Attachments\\报名资格验审.xls") Book.Build() \'生成细节区 Book.Save(dlg.FileName) \'保存工作簿 MessageBox.Show("保存成功" ) End If ElseIf tb.SelectedPage.Text = "技师高技理论" Then Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "excel|*.xls" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 MessageBox.Show("你要保存为:" & dlg.FileName,"提示") \'提示用户选择的文件 Dim Book As New XLS.Book(ProjectPath & "Attachments\\技师高技理论.xls") Book.Build() \'生成细节区 Book.Save(dlg.FileName) \'保存工作簿 MessageBox.Show("保存成功" ) End If ElseIf tb.SelectedPage.Text = "技师高技实潜" Then Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "excel|*.xls" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 MessageBox.Show("你要保存为:" & dlg.FileName,"提示") \'提示用户选择的文件 Dim Book As New XLS.Book(ProjectPath & "Attachments\\技师高技实潜.xls") Book.Build() \'生成细节区 Book.Save(dlg.FileName) \'保存工作簿 MessageBox.Show("保存成功" ) End If ElseIf tb.SelectedPage.Text = "上会评审汇总" Then Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "excel|*.xls" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 MessageBox.Show("你要保存为:" & dlg.FileName,"提示") \'提示用户选择的文件 Dim Book As New XLS.Book(ProjectPath & "Attachments\\参评汇总.xls") Book.Build() \'生成细节区 Book.Save(dlg.FileName) \'保存工作簿 MessageBox.Show("保存成功" ) End If ElseIf tb.SelectedPage.Text = "证书编号汇总" Then Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "excel|*.xls" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 MessageBox.Show("你要保存为:" & dlg.FileName,"提示") \'提示用户选择的文件 Dim Book As New XLS.Book(ProjectPath & "Attachments\\证书编号汇总.xls") Book.Build() \'生成细节区 Book.Save(dlg.FileName) \'保存工作簿 MessageBox.Show("保存成功" ) End If ElseIf tb.SelectedPage.Text = "地市公司统计" Then Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "excel|*.xls" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 MessageBox.Show("你要保存为:" & dlg.FileName,"提示") \'提示用户选择的文件 Dim Book As New XLS.Book(ProjectPath & "Attachments\\地市公司统计.xls") Book.Build() \'生成细节区 Book.Save(dlg.FileName) \'保存工作簿 MessageBox.Show("保存成功" ) End If ElseIf tb.SelectedPage.Text = "鉴定统计报表" Then Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "excel|*.xls" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 MessageBox.Show("你要保存为:" & dlg.FileName,"提示") \'提示用户选择的文件 Dim Book As New XLS.Book(ProjectPath & "Attachments\\鉴定统计报表.xls") Book.Build() \'生成细节区 Book.Save(dlg.FileName) \'保存工作簿 MessageBox.Show("保存成功" ) End If End If
1、上述是“导出”按钮代码,负责2个表的导出(在页面集合中,有几个页面是绑定其中1个表的副表),先前没什么数据的时候,貌似还正常,现在导入了数据,大概有10万来行,问题来了,点击没反应,最后强退,这是为什么?代码问题?
2、另外1个按钮也差不多的情况,只不过对应的是1个页面中的副表产生3个不同的EXCEL表,现在只能生成1个EXCEL表,还只能预览而不能存盘,代码如下:
Dim tb As WinForm.TabControl = e.Form.Controls("TabControl1") Dim pg As WinForm.TabPage = tb.SelectedPage Dim doc As PrintDoc = e.Form.GernatePrintDoc(pg) If tb.SelectedPage.Text = "上会评审汇总" Then Dim Book As New XLS.Book(ProjectPath & "Attachments\\参评汇总.xls") Dim fl As String = ProjectPath & "Reports\\上会评审.xls" 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) ShowAppWindow("上会评审汇总",2) App.Visible = True Ws.PrintPreview App.Quit ElseIf tb.SelectedPage.Text = "上会评审汇总" Then Dim Book As New XLS.Book(ProjectPath & "Attachments\\评审投票.xls") Dim fl As String = ProjectPath & "Reports\\上会评审.xls" 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(2) ShowAppWindow("上会评审汇总",2) App.Visible = True Ws.PrintPreview App.Quit ElseIf tb.SelectedPage.Text = "上会评审汇总" Then Dim Book As New XLS.Book(ProjectPath & "Attachments\\投票汇总.xls") Dim fl As String = ProjectPath & "Reports\\上会评审.xls" 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(3) ShowAppWindow("上会评审汇总",2) App.Visible = True Ws.PrintPreview App.Quit End If
请求版主指教!
|
-- 作者:lisheng1971
-- 发布时间:2018/12/12 12:39:00
--
这实例......,我这水平实在太低,做不出什么对应实例,就发我做的半成品发上来吧!目前还有很多表代码没写入!
目前问题:1、“评审表预览”按钮点击后应该生成3张表,但现在只生成了1张;
2、“导出”按钮点击后没反应,会强退;
3、窗口点开后,目录树就全部加载了数据,而同样的目录树在我先前的老版本项目上是数据为空,要我点击加载全部数据才会;点击“导入”按钮导入新批次数据后,目录树上不会及时体现,而是要关闭窗口后再进入才能看到导入的新批次数据;
4、在主窗口加了个“进度条”控件,在进度过程中显示“系统数据加载中,请稍候!”,项目启动完毕,“进度条”也进到100%,窗口“鉴定管理”自动开启,这个我学习了帮助文件,并在论坛上搜索了实例,还是没学会该怎么下手!
[此贴子已经被作者于2018/12/13 0:47:42编辑过]
|
-- 作者:有点甜
-- 发布时间:2018/12/12 15:04:00
--
1、
Dim tb As WinForm.TabControl = e.Form.Controls("TabControl1") Dim pg As WinForm.TabPage = tb.SelectedPage Dim doc As PrintDoc = e.Form.GernatePrintDoc(pg) If tb.SelectedPage.Text = "上会评审汇总" Then Dim Book As New XLS.Book(ProjectPath & "Attachments\\参评汇总.xls") Dim fl As String = ProjectPath & "Reports\\上会评审.xls" 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) ShowAppWindow("上会评审汇总",2) App.Visible = True Ws.PrintPreview App.Quit End If If tb.SelectedPage.Text = "上会评审汇总" Then Dim Book As New XLS.Book(ProjectPath & "Attachments\\评审投票.xls") Dim fl As String = ProjectPath & "Reports\\上会评审.xls" 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(2) ShowAppWindow("上会评审汇总",2) App.Visible = True Ws.PrintPreview App.Quit End If If tb.SelectedPage.Text = "上会评审汇总" Then Dim Book As New XLS.Book(ProjectPath & "Attachments\\投票汇总.xls") Dim fl As String = ProjectPath & "Reports\\上会评审.xls" 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(3) ShowAppWindow("上会评审汇总",2) App.Visible = True Ws.PrintPreview App.Quit End If
|