This project has moved. For the latest updates, please go here.

How do I get rid of the xmlns="" in autoFilter/filterColumn?

Feb 24, 2015 at 4:00 PM
I am creating an autoFilter and the saved XML looks like this:
<autoFilter ref="A1:E114">
    <filterColumn colId="2" xmlns="">
        <filters blank="1" />
and the code used to create it:
        XmlNamespaceManager ns = new XmlNamespaceManager(Parent.OwnerDocument.NameTable);

        XmlElement result = Parent.OwnerDocument.CreateElement(Name, ns.LookupNamespace(""));


        return (result);
where Parent is the autoFilter element from the WorksheetXml.SelectSingleNode("//d:autoFilter").

So, how do I get rid of the xmlns=""???
Feb 24, 2015 at 7:47 PM
Edited Feb 24, 2015 at 7:48 PM
I figured it out.

Drop the XmlNamespaceManager as it is not needed. Add Parent.NamespaceURI as the second parameter to CreateElement (...) and it workds.