@@ -762,7 +762,16 @@ internal static ExcelChart GetChart(ExcelDrawings drawings, XmlNode node, ExcelG
762762
763763 internal static ExcelChartEx GetChartEx ( ExcelDrawings drawings , XmlNode node , ExcelGroupShape parent = null )
764764 {
765- XmlNode chartDrawingNode = node . SelectSingleNode ( "mc:AlternateContent/mc:Choice/xdr:graphicFrame/a:graphic/a:graphicData/cx:chart" , drawings . NameSpaceManager ) ;
765+ XmlNode chartDrawingNode ;
766+ if ( node . Name == "mc:AlternateContent" )
767+ {
768+ chartDrawingNode = node . SelectSingleNode ( "mc:Choice/xdr:graphicFrame/a:graphic/a:graphicData/cx:chart" , drawings . NameSpaceManager ) ;
769+ }
770+ else
771+ {
772+ chartDrawingNode = node . SelectSingleNode ( "mc:AlternateContent/mc:Choice/xdr:graphicFrame/a:graphic/a:graphicData/cx:chart" , drawings . NameSpaceManager ) ;
773+ }
774+
766775 if ( chartDrawingNode != null )
767776 {
768777 var drawingRelation = drawings . Part . GetRelationship ( chartDrawingNode . Attributes [ "r:id" ] . Value ) ;
@@ -776,25 +785,25 @@ internal static ExcelChartEx GetChartEx(ExcelDrawings drawings, XmlNode node, Ex
776785 var layoutId = chartNode . SelectSingleNode ( "cx:plotArea/cx:plotAreaRegion/cx:series[1]/@layoutId" , drawings . NameSpaceManager ) ;
777786 if ( layoutId == null )
778787 {
779- return new ExcelTreemapChart ( drawings , node , uriChart , part , chartXml , chartNode ) ;
788+ return new ExcelTreemapChart ( drawings , node , uriChart , part , chartXml , chartNode , parent ) ;
780789 }
781790 switch ( layoutId . Value )
782791 {
783792 case "treemap" :
784- return new ExcelTreemapChart ( drawings , node , uriChart , part , chartXml , chartNode ) ;
793+ return new ExcelTreemapChart ( drawings , node , uriChart , part , chartXml , chartNode , parent ) ;
785794 case "sunburst" :
786- return new ExcelSunburstChart ( drawings , node , uriChart , part , chartXml , chartNode ) ;
795+ return new ExcelSunburstChart ( drawings , node , uriChart , part , chartXml , chartNode , parent ) ;
787796 case "boxWhisker" :
788- return new ExcelBoxWhiskerChart ( drawings , node , uriChart , part , chartXml , chartNode ) ;
797+ return new ExcelBoxWhiskerChart ( drawings , node , uriChart , part , chartXml , chartNode , parent ) ;
789798 case "clusteredColumn" :
790799 case "pareto" :
791- return new ExcelHistogramChart ( drawings , node , uriChart , part , chartXml , chartNode ) ;
800+ return new ExcelHistogramChart ( drawings , node , uriChart , part , chartXml , chartNode , parent ) ;
792801 case "funnel" :
793- return new ExcelFunnelChart ( drawings , node , uriChart , part , chartXml , chartNode ) ;
802+ return new ExcelFunnelChart ( drawings , node , uriChart , part , chartXml , chartNode , parent ) ;
794803 case "waterfall" :
795- return new ExcelWaterfallChart ( drawings , node , uriChart , part , chartXml , chartNode ) ;
804+ return new ExcelWaterfallChart ( drawings , node , uriChart , part , chartXml , chartNode , parent ) ;
796805 case "regionMap" :
797- return new ExcelRegionMapChart ( drawings , node , uriChart , part , chartXml , chartNode ) ;
806+ return new ExcelRegionMapChart ( drawings , node , uriChart , part , chartXml , chartNode , parent ) ;
798807 default :
799808 throw new NotSupportedException ( $ "Unsupported chart layout { layoutId . Value } ") ;
800809 }
0 commit comments