"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写代码?
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": "电子fa piao(专用fa piao)",
"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"
}
CommodityName,CommodityType,CommodityUnit,CommodityNum,CommodityPrice,CommodityAmount,CommodityTaxRate,CommodityTax,中的每行数据分别填入表中以下列
货物名称,规格型号,单位,数量,单价,金额,税率,税额
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
……
这样是可以,但是咋样能将数据填入表的每一行呢
也就是增加行放哪里?
[此贴子已经被作者于2024/12/20 14:01:39编辑过]