Foxtable(狐表)用户栏目专家坐堂 → 用Excel报表生成网页问题


  共有31人关注过本帖树形打印复制链接

主题:用Excel报表生成网页问题

帅哥哟,离线,有人找我吗?
YDS
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:645 积分:3705 威望:0 精华:0 注册:2011/5/21 18:05:00
用Excel报表生成网页问题  发帖心情 Post By:2025/4/25 14:05:00 [只看该作者]

自定义函数--HttpRequest
'服务器连接的第一函数 
Dim e As RequestEventArgs = args(0)
Dim url As String = e.Path
If url > "" Then
    If url.Contains(".") Then
        If Functions.Contains(url.Split(".")(0)) Then
            Functions.Execute(url.Split(".")(0), e)
        Else
            Functions.Execute("cw", e) '没有指向页面
        End If 
    Else
        If Functions.Contains(url) Then
            Functions.Execute(url, e)
        Else
            Functions.Execute("cw", e) '没有指向页面
        End If 
    End If 
Else
    Functions.Execute("index", e) '首页 
End If

自定义函数--xmgl
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
wb.Title = "项目管理汇总"
If e.PostValues.ContainsKey("pw") Then
    Dim pw As String = e.PostValues("pw")
    If pw = Functions.Execute("Get", "设置", 6) Then
        Dim Book As New XLS.Book(ProjectPath & "Attachments\项目管理.xls")
        e.WriteBookAsHTML(Book)
    Else
        wb.AddForm("", "form1", "xmgl.htm")
        With wb.AddMsgPage("", "msgpage", "密码错误", "密码输入错误,请重新输入。")
            .Icon = "warn"
            .AddButton("btn1", "重新输入", "xmgl.htm")
        End With
        e.WriteString(wb.Build) '生成网页
    End If 
Else
    wb.AddForm("", "form1", "xmgl.htm")
    With wb.AddInputGroup("form1", "ipg1", "请输入项目管理密码")
        .AddInput("pw", "密码", "password")
    End With
    With wb.AddButtonGroup("form1", "btg1", True)
        .Add("btn1", "查看项目管理汇总", "submit")
    End With
    e.WriteString(wb.Build) '生成网页
End If

测试没有问题,发布以后一直提示页面【4caa846a1c.files\sheet001.htm】不存在或者您没有该页面的访问权限,要如何处理?


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:113590 积分:578463 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2025/4/25 14:24:00 [只看该作者]

execl生成网页比较特殊,会生成一堆临时文件,要特别注意使用路径:http://www.foxtable.com/mobilehelp/topics/0288.htm

注意下面红色代码,都有特殊意义的,不能省略

If e.Path.StartsWith("Reports\")

    e.ResponseEncoding = "gb2312"
    Select Case e.Path
        Case  "Reports\jianli.htm"
            Dim Book As New XLS.Book(ProjectPath & 
"Attachments\
资料卡.xls")
            e.WriteBookAsHTML(Book,False
'
第二个参数设置为False,表示这不是模板,直接发送即可
        Case Else
            e.AsReportServer("Reports\")

    
End Select
End
 If




 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:113590 积分:578463 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2025/4/25 14:25:00 [只看该作者]

所以最好是单独处理这些页面,不要使用1楼这种url.Split方法,会出错的

 回到顶部
帅哥哟,离线,有人找我吗?
YDS
  4楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:645 积分:3705 威望:0 精华:0 注册:2011/5/21 18:05:00
  发帖心情 Post By:2025/4/25 15:15:00 [只看该作者]

好的,谢谢

 回到顶部