protected void Commit() { //XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); /* * Saved chart space must have the following namespaces Set: * <c:chartSpace * xmlns:c="http://schemas.Openxmlformats.org/drawingml/2006/chart" * xmlns:a="http://schemas.Openxmlformats.org/drawingml/2006/main" * xmlns:r="http://schemas.Openxmlformats.org/officeDocument/2006/relationships"> */ //xmlOptions.SetSaveSyntheticDocumentElement(new QName(CTChartSpace.type.GetName().GetNamespaceURI(), "chartSpace", "c")); Dictionary <String, String> map = new Dictionary <String, String>(); map[XSSFDrawing.NAMESPACE_A] = "a"; map[XSSFDrawing.NAMESPACE_C] = "c"; map[ST_RelationshipId.NamespaceURI] = "r"; //xmlOptions.SetSaveSuggestedPrefixes(map); PackagePart part = GetPackagePart(); Stream out1 = part.GetOutputStream(); chartSpace.Save(out1); out1.Close(); }
protected override void Commit() { //XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); /* * Saved chart space must have the following namespaces Set: * <c:chartSpace * xmlns:c="http://schemas.Openxmlformats.org/drawingml/2006/chart" * xmlns:a="http://schemas.Openxmlformats.org/drawingml/2006/main" * xmlns:r="http://schemas.Openxmlformats.org/officeDocument/2006/relationships"> */ XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces(); namespaces.Add("a", XSSFDrawing.NAMESPACE_A); namespaces.Add("c", XSSFDrawing.NAMESPACE_C); namespaces.Add("r", ST_RelationshipId.NamespaceURI); PackagePart part = GetPackagePart(); Stream out1 = part.GetOutputStream(); chartSpace.Save(out1, namespaces); out1.Close(); }