以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 远程图片下载 并引用 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=170610) |
-- 作者:yifan3429 -- 发布时间:2021/8/1 12:48:00 -- 远程图片下载 并引用 远程图片地址("https://weapp-1253522117.image.myqcloud.com//image/20210204/d7d3b458d91346ec.jpg") Network.DownloadFile("CurRow("商品图片"), "c:\\data\\d7d3b458d91346ec.jpg" ,"" ,"" ,True, 100000, True) rt.Cells(r + 1,2).Image = GetImage("c:\\data\\d7d3b458d91346ec.jpg") 如何全部下载到指定位置,新下载的文件如何动态指定 又如何以马上调用到下载的文件 |
-- 作者:有点蓝 -- 发布时间:2021/8/1 20:17:00 -- dim name as string = "c:\\data\\" & filesys.getname(CurRow("商品图片")) Network.DownloadFile(CurRow("商品图片"), name)rt.Cells(r + 1,2).Image = GetImage(name)
|
-- 作者:yifan3429 -- 发布时间:2021/8/2 14:38:00 -- 会有报错,需要下载当前表显示所有行的内容 此主题相关图片如下:企业微信截图_20210802143805.png |
-- 作者:有点蓝 -- 发布时间:2021/8/2 14:39:00 -- 判断一下,同名文件如果存在:http://www.foxtable.com/webhelp/topics/0337.htm,就跳过 |
-- 作者:yifan3429 -- 发布时间:2021/8/2 14:41:00 -- Dim doc As New PrintDoc Dim rt As Prt.RenderTable Dim rx As prt.RenderText \'Dim rm As New prt.RenderImage() \'定义一个图片对象 Dim CurRow As Row = Tables("活动家居产品库").Current Dim tbl As Table = Tables("活动家居产品库") Dim Rows As List(Of DataRow) Dim Regions As List(Of String) = tbl.DataTable.GetValues("产品系列") doc.Pagesetting.LandScape = True For Each Region As String In Regions rx = New prt.RenderText rx.Style.FontSize = 14 rx.Style.FontBold = True rx.Style.Spacing.Bottom = 2 rx.Text = "产品系列: " & Region doc.Body.Children.Add(rx) rt = New prt.RenderTable rt.Style.Font = Tables("活动家居产品库").Font rt.Style.TextAlignVert = prt.AlignVertEnum.Center rt.Style.GridLines.All = New prt.LineDef(0.3,Color.LightGray) rt.Style.Spacing.Bottom = 5 rt.CellStyle.Spacing.All = 1 rt.Style.Font = tbl.Font Rows = tbl.DataTable.Select("[产品系列] = \'" & Region & "\'") \'分组列为 Dim tb As Table = Tables("活动家居产品库") Dim ColNames As String() = New String(){"商品名称","商品图片","商品编码","多规格描述","价格","备注"} rt.Style.Font = tb.Font rt.Height = "Auto" \'设置表格的高度为80毫米 For c As Integer = 0 To ColNames.Length - 1 \'逐列设置和填入内容 rt.Cells(0,c).Text = ColNames(c) \'列名作为标题 rt.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'标题内容水平居中 If ColNames(c) <> "备注" Then \' rt.Cols(c).Width = tb.Cols(ColNames(c)).PrintWidth End If For r As Integer = 0 To tb.Rows.Count -1 \'开始填入该列内容 If ColNames(c) <>"商品图片" rt.Cells(r + 1, c).Text = tb.Rows(r)(ColNames(c)) Else Dim name As String = "d:\\data\\" & filesys.getname(CurRow("商品图片")) If FileSys.FileExists(name) Then Else Network.DownloadFile(CurRow("商品图片"), name) End If rt.Cells(r + 1,1).Image = GetImage(name) \'rt.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center \'居中显示 \' End If \' Next 显示的是同一张照片 每行都有对应不同的图片 [此贴子已经被作者于2021/8/2 14:46:58编辑过]
|
-- 作者:有点蓝 -- 发布时间:2021/8/2 15:14:00 -- For r As Integer = 0 To tb.Rows.Count -1 \'开始填入该列内容 If ColNames(c) <>"商品图片" rt.Cells(r + 1, c).Text = tb.Rows(r)(ColNames(c)) Else Dim name As String = "d:\\data\\" & filesys.getname(tb.Rows(r)("商品图片"))
|
-- 作者:yifan3429 -- 发布时间:2021/8/2 20:03:00 -- \'Dim e = args(0) Dim doc As New PrintDoc Dim rt As Prt.RenderTable Dim rx As prt.RenderText \'Dim rm As New prt.RenderImage() \'定义一个图片对象 Dim CurRow As Row = Tables("活动家居产品库").Current Dim tbl As Table = Tables("活动家居产品库") Dim Rows As List(Of DataRow) Dim Regions As List(Of String) = tbl.DataTable.GetValues("产品系列") doc.Pagesetting.LandScape = True For Each Region As String In Regions rx = New prt.RenderText rx.Style.FontSize = 14 rx.Style.FontBold = True rx.Style.Spacing.Bottom = 2 rx.Text = "产品系列: " & Region doc.Body.Children.Add(rx) rt = New prt.RenderTable rt.Style.Font = Tables("活动家居产品库").Font rt.Style.TextAlignVert = prt.AlignVertEnum.Center rt.Style.GridLines.All = New prt.LineDef(0.3,Color.LightGray) rt.Style.Spacing.Bottom = 5 rt.CellStyle.Spacing.All = 1 rt.Style.Font = tbl.Font Rows = tbl.DataTable.Select("[产品系列] = \'" & Region & "\'") \'分组列为 Dim tb As Table = Tables("活动家居产品库") Dim ColNames As String() = New String(){"商品名称","商品图片","商品编码","多规格描述","价格","备注"} rt.Style.Font = tb.Font rt.Height = "Auto" \'设置表格的高度为80毫米 For c As Integer = 0 To ColNames.Length - 1 \'逐列设置和填入内容 rt.Cells(0,c).Text = ColNames(c) \'列名作为标题 rt.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'标题内容水平居中 If ColNames(c) <> "备注" Then \' rt.Cols(c).Width = tb.Cols(ColNames(c)).PrintWidth End If For r As Integer = 0 To tb.Rows.Count -1 \'开始填入该列内容 If ColNames(c) <>"商品图片" rt.Cells(r + 1, c).Text = tb.Rows(r)(ColNames(c)) Else \'Dim name As String = "d:\\data\\" & filesys.getname(CurRow("商品图片")) Dim name As String = "d:\\data\\" & filesys.getname(tb.Rows(r)("商品图片")) If FileSys.FileExists(name) Then Else Network.DownloadFile(CurRow("商品图片"), name) End If rt.Cells(r + 1,1).Image = GetImage(name) \'rt.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center \'居中显示 \' End If \' Next Next rt.Style.GridLines.All = New prt.Linedef \'设置网格线 rt.Cols(0).Width = 15 \'设置前四列的宽度,剩余的宽度被分配给5列(显示图片的那列) rt.Cols(1).Width = 20 rt.Cols(2).Width = 40 rt.Cols(3).Width = 30 rt.Cols(4).Width = 30 rt.Cols(5).Width = 30 rt.CellStyle.Spacing.All = 0.5 \'内容距离网格线0.5毫米 rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'第一行内容水平居中 rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'第一行内容垂直居中 \'rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'第一行内容水平居中 \'rt.Rows(0).Style.TextAlignVert = prt.AlignVertEnum.Center \'第一行内容垂直居中 rt.Rows(0).Style.BackColor = Color.LightGray \'第一行背景颜色设为灰色. rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All \'将第一行作为表头.. doc.Body.Children.Add(rt) \'将表格加入到报表 Next doc.preview() 还是哪里不对,只显示当前行图片
|
-- 作者:有点蓝 -- 发布时间:2021/8/2 20:19:00 -- Network.DownloadFile(tb.Rows(r)("商品图片"), name) |
-- 作者:yifan3429 -- 发布时间:2021/8/2 21:02:00 -- 会有报错 此主题相关图片如下:企业微信截图_20210802210250.png |
-- 作者:有点蓝 -- 发布时间:2021/8/2 21:09:00 -- 图片单元格没有数据,判断一下有数据再下载 |