Dim dlg As New SaveFileDialog '定义一个新的SaveFileDialog
Dim strFields0 As String = "Work_Work as 工作内容,Work_Importance as 重要性,Work_Status As 状态,Work_Sys as 对应系统,Work_Types as 类型,"
Dim strFields1 As String = "Work_startDate As 开始时间,Work_EndDate As 结束时间,Work_FinishDate As 完成时间,"
Dim strFields2 As String = "Work_StartMan As 发起人,Work_WorkMan As 责任人,Work_VerifyMan As 审核人,Work_Demo As 补充说明,"
Dim strFields3 As String = "Work_RecordDate As 记录时间,Work_RecordMan As 记录人"
Dim strFields As String = strFields0 & strFields1 & strFields2 & strFields3
Dim strFileName As String
If CurrentTable.Name = "Work_Info" Then
dlg.Filter= "Excel文件|*.xls" '设置筛选器
dlg.OverwritePrompt = False
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
Dim ex As New Exporter
ex.SourceTableName = "Work_Info" '指定导出表
strFileName = dlg.FileName '指定目标文件
If FileSys.FileExists( strFileName ) = True Then
MessageBox.Show("文件已经存在,为防止覆盖正常的文件内容,请重新进行导出操作并输入新的文件名称","提示",MessageBoxButtons.OK,MessageBoxIcon.Information )
Return
End If
ex.filepath = strFileName
ex.Fields = strFields
ex.Format = "Excel"
ex.Export() '开始导出
End If
Else
MessageBox.Show( "请先切换到工作记录单窗口后在进行该操作","提示",MessageBoxButtons.OK,MessageBoxIcon.Information )
End If
其他说明:我使用了分页显示,然后在进行导出时出现的问题,之前没有分页的时候,是成功的。请问为什么?