How can I write some C# code to turn off markers in an existing Excel chart using OOXML? Basically, I want to change the frequency of the markers. I can do this from within Excel using a VBA code but it takes a long time to turn each marker off (even with screen refresh turned off).
From looking through an Excel package, the symbol for the data point can be set in \xl\charts\chart1.xml and navigating the XML it is under:
<c:chartSpace>
<c:chart>
<c:plotArea>
<c:scatterPlot>
<c:ser>
Here is what the XML for the marker looks like:
<c:dPt>
<c:idx val ="3"/>
<c:marker>
<c:symbol val="none"/>
</c:marker>
<c:bubble3D val="0"/>
</c:dPt>
Thanks in advance for your help,
There are several approaches to this kind of change using Open XML. The PowerTools for Open XML examples use the XDocument/XElement classes to make modifications. The PowerTools also loads entire documents into memory so that modifications don't immediately affect the original. There is also an approach that uses the XDocument/XElement classes to directly modify a document file. You could also use the Open XML SDK v2.0 approach that has specific methods for each element. I'm sure there are other approaches as well.
If you are asking exactly how to find and remove the markers, I would suggest using Linq to XML. Linq to XML is supported by the XDocument/XElement classes and is the reason I prefer using those. Again, the PowerTools for Open XML contains many examples of this approach.