[英]How do I open and populate a .XML file in a sheet in Excel using VB.Net?
I am looking for a way to open and populate a new sheet while population the sheet from a file.xml. 我正在寻找一种从file.xml填充工作表的同时打开并填充新工作表的方法。
Any ideas? 有任何想法吗?
Thanks 谢谢
Imports Microsoft.Office.Interop.Excel Public Class ReadExcel Public Sub OpenDoc(ByVal Filename As String) Dim excelApp As New Microsoft.Office.Interop.Excel.Application excelApp.Workbooks.OpenXML(Filename) ' do something here... End Sub End Class
In addition to what Derek Tomes has answered, you can specify the loading options for the openXML method. 除了Derek Tomes回答的内容之外,您还可以指定openXML方法的加载选项。
You may use xlXmlLoadImportToList to open a new workbook with the xml data you want to load or you may use xlXmlLoadOpenXml to open the xml file itself in excel. 您可以使用xlXmlLoadImportToList打开要包含要加载的xml数据的新工作簿,也可以使用xlXmlLoadOpenXml在excel中打开xml文件本身。
you can hide the alerts with the DisplayAlerts property set to false when loading your xml then just set it to true afterwards. 您可以在加载xml时将DisplayAlerts属性设置为false来隐藏警报,然后再将其设置为true。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.