none
How to get chart type and name of that from a slide? RRS feed

  • Question

  • I have to find following information from a chart. chartType,ChartName in it.

    http://i.stack.imgur.com/EGEQz.png

    from the above image I want to find the below information

    1. type: Column
    2. name: clustered Column.

    with or with out using interop Till now by using interop I can able to get the type of a chart with propertyChartType (Below is the code). but it gives me xlColumnClustered from that I come to know what was that but I want exact name and type.

    if (shape.HasChart == MsoTriState.msoTrue)
    {
        var val1 = shape.Chart;
        string category = val1.ChartType.ToString();
        Console.WriteLine("Smartart : {0} \tCategory : {1}\t Name : {2}", (i++).ToString(), category, 1);
    }
    Wednesday, November 4, 2015 12:24 PM

Answers

  • >>>from the above image i want to find the below information

    1.type: column

    2.name: clustered column.<<<

    According to description, I have seached vba(excel) reference to try to overcome this issue, unfortunately, I can't find excel object to achieve your requirement.

    It's just an enum, so I suggest that you could implement your own logic to convert those enum values to a more descriptive text for display.

    You could refer to below code:

    Dim xltype as xlcharttype
    
    xltype = activesheet.chartobjects("chart 4").chart.charttype
    
    Select case xltype
    
        case xlcharttype.xlcolumnclustered:
    
           curtype = "column"
    
           cutname = "clustered column"
    
    End select
    

    For more information, click here to refer about chart.charttype property (excel)

    and here to refer about xlcharttype enumeration (excel)

    Friday, November 6, 2015 8:40 AM