我需要幫助這個.... 我有Excel文件的數據。 我需要將它導出到XMLFILE,使用XML文本在VB.NET
我需要一些XMLFILE AA結果:從Excel導出到XML使用XML文字+ VB.NET
<?xml version="1.0" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://...">
<soapenv:Header/>
<soapenv:Body xmlns:wsu="http://....xsd">
<Header>
<Verb>cancel</Verb>
</Header>
<Request>
<ID>VALUE-1</ID>
<ID>VALUE-2</ID>
<ID>VALUE-3</ID>
......
</Request>
</soapenv:Body>
</soapenv:Envelope>
其中value-1,值2,...等等 - 我讓他們從羅恩NUMER細胞i和列數= 2 在VB.NET中環我這樣做是這樣的:
While Not this condition
While Not (String.IsNullOrEmpty(Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet.Cells(iRow, 1).Value))
'Check next condition with IF
If LCase(Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet.Cells(iRow, 25).Value) = "y" Then
'Add XElement object into another one XML Element from main XDocument
objRequestCANCEL.Add(objIDCANCEL)
'Add Value for this new Element
objIDCANCEL.Value = Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet.Cells(iRow, 2).Value
End If
'Go to next Row and do the same - add XELement if condition is OK here
iRow = iRow + 1
End While
這裏objIDCANCEL作爲的XElement在主要的XDocument 我在這種情況下XElements使用像Variables.But現在我需要像創建文檔沒有像這樣的變量:
Dim XDoc As XDocument = <?xml version="1.0" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://...">
<soapenv:Header/>
<soapenv:Body xmlns:wsu="http://....xsd">
<Header>
<Verb>create</Verb>
<ID><%= varValue %> </ID>
.....HERE I NEED ADD IN LOOP ALL VALUES FROM ALL ROWS IN EXCEL FILE.....
</Header>
<Request>
</Request>
</RequestMessage>
</soapenv:Body>
</soapenv:Envelope>
請給我寫信,我該如何重寫這個Loop?
你不能在那裏放入任何循環語句,你只能使用LINQ'From .. Select'表達式。 –
但我的情況如何看起來像LINQ而不是循環? –