1

# CustomXmlPart Incompatible with Microsoft SDK for Open XML Formats

## description

In the Content Control Toolkit clicking "Create a new custom XML Part" creates a part with the path "customXml\item1" or similar.

Creating a CustomXmlPart using the Microsoft SDK for Open XML Formats creates a part with the path "customXML\item" or similar. (Note the difference in case)

The effect of this is that custom XML parts added in the tool cannot be manipulated easily using the SDK.

i.e. MainDocumentPart.CustomXmlParts does not return the parts created by the Tool.
Closed Feb 13, 2008 at 3:50 AM by mrscott
Does not repro. The Content Control Toolkit is compatible with the MS OOXML SDK. See steps on 2/11/2008

wrote Feb 11, 2008 at 9:31 AM

Great find, thanks Andrew. Note that I'm classifying this as a feature rather than an issue. The feature is compatibility with the SDK.

wrote Feb 11, 2008 at 9:31 AM

wrote Feb 11, 2008 at 10:24 AM

First thank you again Andrew for your contribution of this bug but after an investigation I do not repro this issue. Here's what I've done:
1. Start Word
2. Save empty document to c:\temp\test.docx
3. Close Word
4. Start the Content Control Toolkit
5. Open c:\temp\test.docx
6. Add a new part, with the following xml: <root>x</root>
7. Save the document and close the Content Control Toolkit
9. Start VS2005 and create a new project. Added the OpenXml.Packaging namespace and required assemblies.
10. Created a C# winforms solution and added the following code so that it may execute upon clicking a button:
  WordprocessingDocument doc = WordprocessingDocument.Open(@"c:\temp\test.docx", true);
foreach (CustomXmlPart part in doc.MainDocumentPart.CustomXmlParts)
{
if (part.Uri.ToString() == @"/customXml/item1.xml")
{
}
}

11. Run the solution and click the button.
ACTUAL RESULTS:

## A message box appears with "<root>x</root>"

Please let me know if there are any additional \ different steps you performed that let you see this error. If you find the error still reproduces please reopen this bug or if CodePlex doesn't let you, make a new bug.

Thanks
Matt

wrote Feb 11, 2008 at 10:24 AM

wrote Feb 11, 2008 at 10:25 AM

wrote Feb 11, 2008 at 10:27 AM

Because I was unable to reproduce this bug I am closing the work item.

** Closed by mrscott 2/11/2008 3:25 AM

wrote Feb 11, 2008 at 10:27 AM

wrote Feb 11, 2008 at 10:27 AM

wrote Feb 11, 2008 at 10:28 AM

Hi Andrew, I reopened the bug so that you can confirm whether or not the issue is resolved. Thanks.

wrote Feb 11, 2008 at 10:28 AM

wrote Feb 13, 2008 at 3:50 AM

wrote Jun 10, 2009 at 6:46 PM

The SDK does not list the Custom XML part added with the toolkit when interrogating the document by using the following code:

WordprocessingDocument _report = WordprocessingDocument.Open(reportStream.File, false);
IEnumerable<CustomXmlPart> customXmlparts = _report.MainDocumentPart.CustomXmlParts;

The field customXmlparts does not list the custom XML added with the Toolkit.

wrote Jun 10, 2009 at 7:39 PM

Now I see the part. Please disregard my previous comment.

wrote Feb 21, 2013 at 11:32 PM

wrote May 16, 2013 at 11:02 AM