none
What is the best practice to export charts as SVG format? RRS feed

  • Question

  • Hi everybody.

    What is the best practice to export charts in a presentation as SVG format?

    I found some tricks that suggest to export PPTX as PDF and then convert it to SVG using Inkscape, but I'm looking for a more reliable solution (using OpenXML SDK or Primary Interop Assembly library).

    Best regards,

    Giacomo

    === UPDATED ===

    Thanks Fei.

    Can I at least choose the size of the output image? :)



    Tuesday, May 20, 2014 10:09 AM

Answers

  • Hi Giacomo,

    Based on the description, you want to export charts in presentation to a SVG format file. As far as I know, we can use Chart.Export to export a chart in a graphic format. But Office doesn’t support the SVG graphic filter default, if you need to export it to SVG format you need to install the graphic filter. The following example exports the first chart in the active document as a GIF file.

    With ActiveDocument.InlineShapes(1)
    
        If .HasChart Then
    
            .Chart.Export _
    
                FileName:="current_sales.gif", FilterName:="GIF"
    
        End If
    
    End With
    

    Note, we need to install the PowerPoint application to use PowerPoint Primary Interop Assembly. And I think we can hardly export the chart to an image using Open XML. Because the chart in the presentation is not an image and there is no method we can convert it to an image.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by WickDeveloper Wednesday, May 21, 2014 1:37 PM
    Wednesday, May 21, 2014 7:08 AM
    Moderator

All replies

  • Hi Giacomo,

    Based on the description, you want to export charts in presentation to a SVG format file. As far as I know, we can use Chart.Export to export a chart in a graphic format. But Office doesn’t support the SVG graphic filter default, if you need to export it to SVG format you need to install the graphic filter. The following example exports the first chart in the active document as a GIF file.

    With ActiveDocument.InlineShapes(1)
    
        If .HasChart Then
    
            .Chart.Export _
    
                FileName:="current_sales.gif", FilterName:="GIF"
    
        End If
    
    End With
    

    Note, we need to install the PowerPoint application to use PowerPoint Primary Interop Assembly. And I think we can hardly export the chart to an image using Open XML. Because the chart in the presentation is not an image and there is no method we can convert it to an image.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by WickDeveloper Wednesday, May 21, 2014 1:37 PM
    Wednesday, May 21, 2014 7:08 AM
    Moderator
  • Hi,

    We can't set the size for the image exported, you can get more detail about the export method from link below:

     Chart.Export method

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, May 22, 2014 11:37 AM
    Moderator