Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all articles
Browse latest Browse all 1741

Created Unassigned: CustomXMLNode.AddNode throws exception; type mismatch [22309]

$
0
0
CustomXMLNode.AddNode seems to throw an exception due to a type mismatch. Tested in Excel 2007.


This is a copy of Microsoft's example for Custom XML Parts found under
https://msdn.microsoft.com/en-us/library/office/ff864167.aspx

```

NetOffice.ExcelApi.Workbook workbook = /* .... this is set to a proper workbook reference */;

NetOffice.OfficeAPI.CustomXMLPart cxp1 = workbook.CustomXMLParts.Add("<invoice />");
NetOffice.OfficeApi.CustomXMLNode cxn = cxp1.SelectSingleNode("/invoice");


// the following line will throw a COMException exception
// InnerException: Exception has been thrown by the target of an invocation
// -> InnerException: {"Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))"}
cxp1.AddNode(( NetOffice.OfficeApi.CustomXMLNode)cxn, (string)"upcode", (string)"urn:invoice:namespace");

```

Viewing all articles
Browse latest Browse all 1741

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>