以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  关于e.WriteReportAsPDF(doc)的一个问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=185066)

--  作者:benben325
--  发布时间:2023/2/2 15:13:00
--  关于e.WriteReportAsPDF(doc)的一个问题
rt所示,我用狐表做后台,给前端返回专业报表。。

图片点击可在新窗口打开查看此主题相关图片如下:123123.png
图片点击可在新窗口打开查看
可是,这个网页的标题是接口的名称,这个标题我能否修改?

--  作者:有点蓝
--  发布时间:2023/2/2 15:17:00
--  
贴出服务端完整代码
--  作者:benben325
--  发布时间:2023/2/2 15:26:00
--  
Dim e As RequestEventArgs = Args(0)

Dim dr As DataRow = Args(1)
Dim num As Integer = Args(2)
Dim ktou As String = Args(3)

Dim code As String = Functions.Execute("returnQRcode", dr("clid"), dr("varGuige"), dr("isOnlyCode"), dr("codeno"), ktou)


Dim doc As New PrintDoc
doc.PageSetting.Landscape = True
Doc.PageSetting.Width = 75
Doc.PageSetting.Height = 20
Doc.PageSetting.LeftMargin = 0
Doc.PageSetting.RightMargin = 0
Doc.PageSetting.TopMargin = 0
Doc.PageSetting.BottomMargin = 0

Dim ra As prt.RenderArea
Dim ra1 As prt.RenderArea
Dim rg As New prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Dim rs As prt.RenderText

For i As Integer = 1 To num
    ra = New prt.RenderArea
    ra.Style.Spacing.Top = 2
    ra.Stacking = prt.StackingRulesEnum.BlockLeftToRight
    
    rg = New prt.RenderGraphics
    Bar = New BarCodeBuilder
    Bar.Symbology = Barpro.Symbology.QRCode
    bar.Code = code
    Bar.QRCodeModuleSize = 0.5
    rg = New prt.RenderGraphics
    bar.DrawOnCanvas(rg.Graphics, 0, 0, 1)
    ra.Children.Add(rg)
    
    ra1 = New prt.RenderArea
    ra1.Stacking = prt.StackingRulesEnum.BlockTopToBottom
    
    rs = New prt.RenderText
    rs.Text = dr("varCode")
    rs.Style.F
    rs.Style.F
    rs.Style.FontBold = True
    rs.Style.FontItalic = False
    rs.Style.FontUnderline = False
    \'rs.Style.TextAlignHorz = prt.AlignHorzEnum.left
    ra1.Children.Add(rs)
    
    rs = New prt.RenderText
    rs.Text = dr("varClName")
    rs.Style.F
    rs.Style.F
    rs.Style.FontBold = False
    rs.Style.FontItalic = False
    rs.Style.FontUnderline = False
    \'rs.Style.TextAlignHorz = prt.AlignHorzEnum.left
    ra1.Children.Add(rs)
    
    rs = New prt.RenderText
    rs.Style.Spacing.Top = 1
    rs.Width = 40
    rs.Text = dr("varGuige")
    rs.Style.F
    rs.Style.F
    rs.Style.FontBold = False
    rs.Style.FontItalic = False
    rs.Style.FontUnderline = False
    \'rs.Style.TextAlignHorz = prt.AlignHorzEnum.left
    ra1.Children.Add(rs)
    
    ra.Children.Add(ra1)
    doc.Body.Children.Add(ra)
Next

e.WriteReportAsPDF(doc)

--  作者:有点蓝
--  发布时间:2023/2/2 15:36:00
--  
外部是怎么调用这个函数的?
--  作者:benben325
--  发布时间:2023/2/2 15:46:00
--  
外部发送get请求,发送get参数 到:Ck217_PrintQRcode
然后再 Ck217_PrintQRcode内部 调用  Functions.Execute("printQRcode", e, dr, num, ktou)

--  作者:有点蓝
--  发布时间:2023/2/2 16:00:00
--  
httprequest事件完整代码
--  作者:benben325
--  发布时间:2023/2/2 16:03:00
--  
If e.path = "Ck217_PrintQRcode" Then
    e.AsyncExecute = True
    Functions.AsyncExecute(epath, e)
    Return
End If

--  作者:有点蓝
--  发布时间:2023/2/2 16:23:00
--  
If e.path = "Ck217_PrintQRcode" Then
改为
If e.path = "某某标题名称.pdf" Then

然后访问pdf的网页地址改为:http://www.xxx.com/某某标题名称.pdf