Chart types in Office 2007 chart templates.

O

Oliver Bock

Is there any way to determine the chart type for an particular chart
template in Office 2007, without applying the template?
 
C

Colbert Zhou [MSFT]

The Word.Chart object has a ChartType propert that indicates the chart
type. In codes, we can get or set it,
----------------------------------------------------------------------------
-
wdChart.ChartType = Office.XlChartType.xl3DArea;
----------------------------------------------------------------------------
-

Is this what you are looking for?


Best regards,
Ji Zhou
Microsoft Online Community Support
 
O

Oliver Bock

Hi Ji,

I want to know how to detect the chart type of a template (in the Office
2007 Templates\Charts directory) before using it, not how to detect the
chart type of a chart that already exists.


Regards,
Oliver
 
C

Colbert Zhou [MSFT]

Hello Oliver,

Thanks for the clarification. So you are saving charts as template into the
folder,
"C:\Users\colbertz\AppData\Roaming\Microsoft\Templates\Charts"

And before you want to apply a saved chart template, you want to know the
chart type, right?

From the Office COM object model, there is no way to get the information
directly because the template is even not loaded into the current Office
application. But the chart template .crtx file is also stored as OpenXML
format. So we can read its content to find the information.


If we change .crtx to .zip, then we can observe a chart.xml in \chart\
folder. From the chart.xml file, we can read some lines like, (In my side,
I have a bar chart)
<c:plotArea>
<c:layout />
<c:barChart>
<c:barDir val="col" />
.....
This indicates the chart type is bar.

Here is a document that lists all possible types' corresponding OpenXML
elments,
http://msdn.microsoft.com/en-us/library/documentformat.openxml.drawing.chart
s.plotarea(office.14).aspx

Hope this helps!


Best regards,
Ji Zhou
Microsoft Online Community Support
 
O

Oliver Bock

... But the chart template .crtx file is also stored as OpenXML
format. So we can read its content to find the information.
...

Very clever! Thanks!


Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top