以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  报错  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=174357)

--  作者:aaa1234
--  发布时间:2022/1/12 11:33:00
--  报错
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2022.1.10.2
错误所在事件:窗口,主控窗口,Button23,Click
详细错误信息:
流不支持写入。
button代码:
If FileSys.DirectoryExists("C:\\data") Then \'如果目录C:\\MyFolder存在
    FileSys.DeleteDirectory("C:\\data",2,3) \'则删除之
End If
Dim str As String = ProjectPath & "Images"
msgbox(str)
For Each File As String In FileSys.GetFiles(str)
If FileSys.GetName(File) Like "图片*"
 FileSys.DeleteFile(File,2,2)
End If
Next
Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog
dlg.Filter= "Excel文件|*.xlsx" \'设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮
Dim Book As New XLS.Book(ProjectPath & "Attachments\\111.xls") \'打开模板
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Book.Build() \'生成细节区
Book.Save( dlg.FileName) \'保存工作簿
Dim Proc As New Process \'打开工作簿
Proc.File = dlg.FileName
msgbox("导出成功")
Proc.Start()
End If

--  作者:aaa1234
--  发布时间:2022/1/12 11:34:00
--  

BuildDetail 代码

If e.Book.TempLate = "111" Then


    If e.region = "table_3" Then


Dim ftp1 As new ftpclient


ftp1.host="172.16.120.41"


ftp1.Account = "admin"


ftp1.password = "qw123"


If e.DataRow.IsNull("图片") = False Then \'身份证号码是否为空


Dim fls As List(of String) = e.DataRow.Lines("图片")


For i As Integer = 0 To fls.count - 1

Dim file As String = "c:\\data\\Desert" & i & ".jpg"


If ftp1.Download(fls(i),file) = True Then


Dim img As image = getImage(file)

If img IsNot Nothing

Dim bmp1 As new bitmap(img, 200,200 * (img.height / img.width))


bmp1.save(ProjectPath & "Images\\图片" & i+1 & ".jpg")


bmp1.Dispose


If fls.count = 1 Then


Dim bmp As new bitmap(1,1)

bmp.save(ProjectPath & "Images\\图片2.jpg")


bmp.Dispose

End If

End If

End If 


Next


Else


Dim bmp As new bitmap(1,1)

bmp.save(ProjectPath & "Images\\图片1.jpg")

bmp.Dispose

bmp = new bitmap(1,1)

bmp.save(ProjectPath & "Images\\图片2.jpg")


bmp.Dispose

End If 


End If



End If


--  作者:有点蓝
--  发布时间:2022/1/12 11:48:00
--  
保存到其它盘试试:Dim file As String = "c:\\data\\Desert" & i & ".jpg"

关闭电脑的杀毒软件、电脑管家、安全卫士
[此贴子已经被作者于2022/1/12 11:48:22编辑过]

--  作者:aaa1234
--  发布时间:2022/1/12 14:05:00
--  
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2022.1.10.2
错误所在事件:Excel报表,BuildDetail
详细错误信息:
GDI+ 中发生一般性错误。这个应该怎么解决,我已经放进d盘里面,火绒已经关了

--  作者:有点蓝
--  发布时间:2022/1/12 14:15:00
--  
1、不要一次性生成太多报表数据,特别是带图的
2、建议使用专业报表

另外可能是有比较大的图片,或者有问题的图片。

建议表格增加一个缩略图列,上传图片的同时就生成缩略图,把名称放入缩略图列