以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- For的用法 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=194547) |
-- 作者:hongye -- 发布时间:2024/12/20 10:55:00 -- For的用法 "CommodityPrice": [ { "row": "1", "word": "29.2035398230089" }, { "row": "2", "word": "29.2035398230089" }, { "row": "3", "word": "29.2035398230089" }, { "row": "4", "word": "29.2035398230089" }, { "row": "5", "word": "29.2035398230089" }, { "row": "6", "word": "35.3982300884956" }, { "row": "7", "word": "35.3982300884956" }, { "row": "8", "word": "35.3982300884956" }, { "row": "9", "word": "35.3982300884956" }, { "row": "10", "word": "35.3982300884956" } ], 如上文本行数有时候为10行有时候只有1行,请问怎么用For写代码?
|
-- 作者:有点蓝 -- 发布时间:2024/12/20 11:07:00 -- http://www.foxtable.com/mobilehelp/topics/0140.htm,看里面数组的用法 |
-- 作者:hongye -- 发布时间:2024/12/20 12:41:00 -- Dim jo As JObject = JObject.Parse(result.Tostring) Dim Value1 As String For Each jt As JToken In jo("words_result")("CommodityName") Value1 = jt("row").ToString & "|" & jt("word").ToString Next 这个可以用一个数组,但是还有其他的数组,怎么写代码? "CommodityNum": [ { "row": "1", "word": "360" }, { "row": "2", "word": "480" }, { "row": "3", "word": "240" }, { "row": "4", "word": "60" }, { "row": "5", "word": "60" }, { "row": "6", "word": "360" }, { "row": "7", "word": "480" }, { "row": "8", "word": "240" }, { "row": "9", "word": "60" }, { "row": "10", "word": "60" } ], "CommodityAmount": [ { "row": "1", "word": "10513.27" }, { "row": "2", "word": "14017.70" }, { "row": "3", "word": "7008.85" }, { "row": "4", "word": "1752.21" }, { "row": "5", "word": "1752.21" }, { "row": "6", "word": "12743.36" }, { "row": "7", "word": "16991.15" }, { "row": "8", "word": "8495.58" }, { "row": "9", "word": "2123.89" }, { "row": "10", "word": "2123.89" } ], "InvoiceType": "电子发票(专用发票)", "AmountInWords": "捌万柒仟陆佰圆整", "TotalTax": "10077.89", "MachineCode": "", "City": "", "InvoiceNumDigit": "", "Checker": "", "InvoiceCode": "", "SellerAddress": "", "CommodityPrice": [ { "row": "1", "word": "29.2035398230089" }, { "row": "2", "word": "29.2035398230089" }, { "row": "3", "word": "29.2035398230089" }, { "row": "4", "word": "29.2035398230089" }, { "row": "5", "word": "29.2035398230089" }, { "row": "6", "word": "35.3982300884956" }, { "row": "7", "word": "35.3982300884956" }, { "row": "8", "word": "35.3982300884956" }, { "row": "9", "word": "35.3982300884956" }, { "row": "10", "word": "35.3982300884956" } |
-- 作者:y2287958 -- 发布时间:2024/12/20 13:23:00 -- 想得到啥结果,还不如用正则表达式呢 |
-- 作者:hongye -- 发布时间:2024/12/20 13:30:00 -- 怎么写? |
-- 作者:y2287958 -- 发布时间:2024/12/20 13:32:00 -- 想得到啥结果? |
-- 作者:hongye -- 发布时间:2024/12/20 13:33:00 -- 每一项的每行结果添加到表中 |
-- 作者:hongye -- 发布时间:2024/12/20 13:41:00 -- CommodityName,CommodityType,CommodityUnit,CommodityNum,CommodityPrice,CommodityAmount,CommodityTaxRate,CommodityTax,中的每行数据分别填入表中以下列 货物名称,规格型号,单位,数量,单价,金额,税率,税额
|
-- 作者:有点蓝 -- 发布时间:2024/12/20 13:46:00 -- For Each jt As JToken In jo("words_result")("CommodityName") Value1 = jt("row").ToString & "|" & jt("word").ToString Next For Each jt As JToken In jo("words_result")("CommodityType") Value1 = jt("row").ToString & "|" & jt("word").ToString Next …… |
-- 作者:hongye -- 发布时间:2024/12/20 13:49:00 -- 这样是可以,但是咋样能将数据填入表的每一行呢 也就是增加行放哪里?
[此贴子已经被作者于2024/12/20 14:01:39编辑过]
|