cancel
Showing results for 
Search instead for 
Did you mean: 

SDK新手問題

Former Member
0 Kudos

hi,

我用getbykey的方式可抓到某一文件, 但有什麼property可以用來快速得知此文件有幾行資料嗎? 或有什麼方式可一行一行的讀出document line裡的資料?

Thanks....

Accepted Solutions (1)

Accepted Solutions (1)

YatseaLi
Product and Topic Expert
Product and Topic Expert
0 Kudos

是不是因为Docuemnt Lines的行很多才将Document保存成XML String or File, 然后,通过XML操作来获得Document信息

这是一个提高性能的好方法

1.如何知道Docuument_Lines有多少行?

oDocument.Lines.Count

2.如何一行一行读取Document Line信息

细节请参阅SDK帮助文档有关Document_Lines

1).如果是通过Document_Lines Object来一行一行读取, 细节请参阅SDK帮助文档有关Document_Lines

Dim oLines Document_Lines = oDocument.Lines

2).如果是要通过xml操作来获取DocumnetLine信息的话

Try
                    Dim oXmlDoc As Xml.XmlDocument = New Xml.XmlDocument

                    'u5EFAu8BAEu76F4u63A5u5C06u4ECEXML String
                    oXmlDoc.LoadXml(oDoc.GetAsXML())

                    'u5982u679Cu662Fu8981u4ECExmlu6587u4EF6u88C5u8F7D
          'oXmlDoc.Load("C:\\BP_SAPA.xml")

                    Dim oNodes As Xml.XmlNodeList = Nothing
                    'u901Au8FC7Xpathu53D6u5F97u6240u6709DocumentLine
                    oNodes = oXmlDoc.SelectNodes("//DocumentLine")

                    If (Not (oNodes Is Nothing)) Then
                        Dim oNode As Xml.XmlNode
                        Dim oChildNode As Xml.XmlNode
                        'u9010u4E2Au904Du5386DocumentLine
                        For Each oNode In oNodes
                            oChildNode = Nothing
                            'u53D6u5F97ItemCodeu4FE1u606F
              oChildNode = oNode.SelectSingleNode("ItemCode")
                            If (Not (oChildNode Is Nothing)) Then
                                Dim itemCode As String = oChildNode.InnerText
                            End If

                            'u53D6u5F97Quantityu4FE1u606F
              oChildNode = oNode.SelectSingleNode("Quantity")
                            If (Not (oChildNode Is Nothing)) Then
                                Dim qty As String = oChildNode.InnerText
                            End If

                           'u4F60u53EFu4EE5u5728u6DFBu52A0u81EAu5DF1u7684u64CDu4F5Cu4EE3u7801
                        Next

                    End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

Answers (1)

Answers (1)

Former Member
0 Kudos

存成xml是不是能满足你的要求,xml里有关于指定object的信息,包括行信息。方法是documents object里的SaveXML

如果你要知道行数,为什么不从通过query查询得到,SDK 的Recordset Object 支持查询的。