I have a function that imports xml data into a range in Excel. This have been working fine using the Excel interop, but when I changed to NetOffice it didn't work anymore.
I've tried to use the function differently, but no luck so far....
Sample:
strXML contains the XML to be inserted
```
Dim excel As NetOffice.ExcelApi.Application = Nothing
Dim exWb As NetOffice.ExcelApi.Workbook
Dim sht As NetOffice.ExcelApi.Worksheet
excel = New NetOffice.ExcelApi.Application
Dim xsd As NetOffice.ExcelApi.XmlMap = Nothing
exWb.XmlImportXml(strXML, xsd, True, sht.Range("A1"))
```
Error:
Parameter not optional. (Exception from HRESULT: 0x8002000F (DISP_E_PARAMNOTOPTIONAL))
All parameters has been filled. The xsd parameter is an out parameter...
I've tried to reduce to (strXML, xsd) parameters. But same result.
I've also tried to go directly from a dataset with dataset.GetXML and dataset.GetXmlSchema
Same result.
Comments: Sorry, forgot the contents of example.xml: ``` <?xml version="1.0" encoding="utf-8"?> <ArrayOfCommentInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <CommentInfo> <CommentId>80</CommentId> <NodeId>156</NodeId> <TicketTitle>Blabla</TicketTitle> <DateFormatted>6-4-2016</DateFormatted> <Complaint>false</Complaint> </CommentInfo> <CommentInfo> <CommentId>81</CommentId> <NodeId>159</NodeId> <TicketTitle>Blabla2</TicketTitle> <DateFormatted>6-4-2016</DateFormatted> <Complaint>false</Complaint> </CommentInfo> </ArrayOfCommentInfo> ```
I've tried to use the function differently, but no luck so far....
Sample:
strXML contains the XML to be inserted
```
Dim excel As NetOffice.ExcelApi.Application = Nothing
Dim exWb As NetOffice.ExcelApi.Workbook
Dim sht As NetOffice.ExcelApi.Worksheet
excel = New NetOffice.ExcelApi.Application
Dim xsd As NetOffice.ExcelApi.XmlMap = Nothing
exWb.XmlImportXml(strXML, xsd, True, sht.Range("A1"))
```
Error:
Parameter not optional. (Exception from HRESULT: 0x8002000F (DISP_E_PARAMNOTOPTIONAL))
All parameters has been filled. The xsd parameter is an out parameter...
I've tried to reduce to (strXML, xsd) parameters. But same result.
I've also tried to go directly from a dataset with dataset.GetXML and dataset.GetXmlSchema
Same result.
Comments: Sorry, forgot the contents of example.xml: ``` <?xml version="1.0" encoding="utf-8"?> <ArrayOfCommentInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <CommentInfo> <CommentId>80</CommentId> <NodeId>156</NodeId> <TicketTitle>Blabla</TicketTitle> <DateFormatted>6-4-2016</DateFormatted> <Complaint>false</Complaint> </CommentInfo> <CommentInfo> <CommentId>81</CommentId> <NodeId>159</NodeId> <TicketTitle>Blabla2</TicketTitle> <DateFormatted>6-4-2016</DateFormatted> <Complaint>false</Complaint> </CommentInfo> </ArrayOfCommentInfo> ```