//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet ws = workbook.Worksheets[0]; var data = "https://w1.weather.gov/xml/current_obs/KAKR.xml"; ws.Range["A1"].Value = data; ws.Range["A2"].Formula = "=WEBSERVICE(A1)"; ws.Range["A3"].Value = "//location"; ws.Range["A4"].Value = "//observation_time"; ws.Range["A5"].Value = "//weather"; ws.Range["A6"].Value = "//temperature_string"; ws.Range["A7"].Formula = "=FILTERXML(A2,A3)"; ws.Range["A8"].Formula = "=FILTERXML(A2,A4)"; ws.Range["A9"].Formula = "=FILTERXML(A2,A5)"; ws.Range["A10"].Formula = "=FILTERXML(A2,A6)"; ws.Range["A:A"].EntireColumn.AutoFit(); // Save to an excel file workbook.Save("WebServiceAndFilterXml.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim data = "https://w1.weather.gov/xml/current_obs/KAKR.xml" With worksheet.Range !A1.Value = data !A2.Formula = "=WEBSERVICE(A1)" !A3.Value = "//location" !A4.Value = "//observation_time" !A5.Value = "//weather" !A6.Value = "//temperature_string" !A7.Formula = "=FILTERXML(A2,A3)" !A8.Formula = "=FILTERXML(A2,A4)" !A9.Formula = "=FILTERXML(A2,A5)" !A10.Formula = "=FILTERXML(A2,A6)" End With worksheet.Range("A:A").EntireColumn.AutoFit() ' save to an excel file workbook.Save("WebServiceAndFilterXml.xlsx")