I wanted to get your advice about working with ChartEx objects, if I may.
Let’s say I have a PPTX file that contains one slide, and on that slide is a ChartEx, which contains some sample data and has been formatted to look at certain way. I’m pulling some data from a database to populate the ChartDataWorkbook.
My challenge is that when I clear the Series data (using chart.CahrtData.Series.Clear()) and the Category data, the formatting that was previously specified on the “template” is cleared too, and thus my output PPTX has the right data, just not the same formatting choices as the “template”.
Since objects like the ChartDataLabelsEx aren’t clonable, I can’t easily make a copy of those values from the template, and then apply them later to the output PPTX.
So my current strategy is simply to set the original Chart as “Hidden”, create a new Chart (which gets populated with the data) and then attempt to copy anything that can be formatted from the “source chart” to the “target chart”.
So my question is: do you have any suggestions on copying the formatting form one ChartEx to another? It’s just a painstaking operation to copy each property from say ChartFormat.Effect object, since there are so many properties.
Any advice on transferring the format of one chart to another would be appreciated.
Unfortunately I’ll have to go with the more difficult path because the templates are built by a wide variety of people and I won’t be able to enforce that they’ll have enough dummy data to ensure it’ll work every time.