Foxtable(狐表)用户栏目专家坐堂 → 求助生成XML


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

主题:求助生成XML

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


加好友 发短信
等级:超级版主 帖子:110574 积分:562760 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/11/12 14:17:00 [显示全部帖子]

大概这样,细节自行补充完整

Dim tx As Table = Tables("AAA")
Dim ab As String = "91350200737855820M"
Dim cd As String = "专用fa piao"
Dim cnt,cnsp As Integer

cnsp = DataTables("AAA").Compute("Count([fa piao号码])","金额 > '0'")
Dim jo As New Foxtable.XObject
jo("body") = New JObject
jo("body")("head") = New JObject
jo("body")("head")("Rows") = cnsp
jo("body")("data") = New JObject
Dim ja As New JArray
'jo("ink")=ja

Dim lst As List(of DataRow)=DataTables("AAA").Select("金额 > '0' ")
For i As Integer=0 To lst.count-1
    Dim kr As DataRow=lst(i)
    Dim j2 As New JObject
    j2("@id")= kr("序号").Tostring()
    j2("dm")=kr("fa piao代码").Tostring()
    j2("dm")=kr("fa piao代码").Tostring()
    j2("hm")=kr("fa piao号码").Tostring()
    j2("gf")=ab.Tostring()
    j2("xf")=kr("销方税号").Tostring()
    j2("kq")=kr("开piao日期").Tostring()
    j2("je")=kr("金额").Tostring()
    j2("se")=kr("税额").Tostring()
    j2("rq")=kr("认证日期").Tostring()
    j2("lb")=cd.Tostring()
    ja.Add(j2)
Next
jo("body")("data")("row") = ja

Dim str As String  = jo.ToXML
'Output.Show(str)


'str = "<?xml version=""1.0"" encoding=""GBK"" ?> <!--DOCTYPE RZ00102 SYSTEM "RZ00102.dtd" -->  " & str & "</data></body>"
'Output.Show(str)

Dim fl As String=ProjectPath & "Reports\" & format(Date.today,"yyyyMMdd") & "fa piao数据XML" & ".xml"
If FileSys.FileExists(fl) Then
    FileSys.DeleteFile(fl)
End If
FileSys.WriteAllText(fl,str, True, Encoding.Default)

'以下代码是用IE打开生成的xml
Dim proc As new Process
proc.file = ProjectPath & "Reports\" & format(Date.today,"yyyyMMdd") & "fa piao数据XML"  & ".xml"
proc.Start

 回到顶部