How to Save Microsoft Excel Sheet Chart/Graphs as PNG with Aspose.Cells REST API

Hi,

I’d like to get a PNG of a chart in a spreadsheet, but I’m unable to find the appropriate API call.

I can see from the API response that there should be additional API calls available to get more information about the chart, but most of them seem to respond with an error.

I believe chartDataTable and ChartObject sound most promising.

Can you file a request to get these calls implemented as well please?

 ["plotArea" {:error "", :status 404}]
 ["secondValueAxis" {:error "", :status 404}]
 ["categoryAxis" {:error "", :status 404}]
 ["Shapes" {:error "", :status 404}]
 ["PageSetup" {:error "", :status 404}]
 ["title"
  {:Title
   {:IsInnerMode false,
    :Shadow false,
    :Border
    {:Style "Solid",
     :WeightPt 0.0,
     :BeginArrowWidth "Medium",
     :DashType "Solid",
     :CapType "Flat",
     :BeginArrowLength "Medium",
     :GradientFill nil,
     :Transparency 0.0,
     :CompoundType "Single",
     :IsVisible false,
     :EndType "None",
     :BeginType "None",
     :IsAutomaticColor true,
     :JoinType "Round",
     :Weight "HairLine",
     :IsAuto false,
     :EndArrowWidth "Medium",
     :Color {:A 0, :R 0, :G 0, :B 0},
     :EndArrowLength "Medium"},
    :Area
    {:BackgroundColor {:A 0, :R 0, :G 0, :B 0},
     :FillFormat
     {:Type "None",
      :SolidFill nil,
      :PatternFill nil,
      :TextureFill nil,
      :GradientFill nil,
      :ImageData nil},
     :ForegroundColor {:A 0, :R 0, :G 0, :B 0},
     :Format "None",
     :InvertIfNegative false,
     :Transparency 0.0},
    :AutoScaleFont true,
    :LinkedSource nil,
    :BackgroundMode "Automatic",
    :ShapeProperties nil,
    :Font
    {:Underline "None",
     :Size 18,
     :IsBold false,
     :IsSubscript false,
     :IsStrikeout false,
     :DoubleSize 18.0,
     :Name "Calibri",
     :IsItalic false,
     :IsSuperscript false,
     :Color {:A 255, :R 0, :G 0, :B 0}},
    :IsAutomaticSize true,
    :link
    {:Href
     "http://api.aspose.cloud/v1.1/cells/aspose-chart.xlsx/worksheets/Sheet1/charts/0/title",
     :Rel "self",
     :Title nil,
     :Type nil},
    :Y 0,
    :Text "y vs. x",
    :TextVerticalAlignment "Center",
    :X 0,
    :Width 0,
    :IsVisible true,
    :TextHorizontalAlignment "Center",
    :TextDirection "LeftToRight",
    :Height 0,
    :RotationAngle 0},
   :Code 200,
   :Status "OK"}]
 ["valueAxis" {:error "", :status 404}]
 ["SideWall" {:error "", :status 404}]
 ["chartArea"
  {:ChartArea
   {:IsInnerMode false,
    :Shadow false,
    :Border
    {:Style "Solid",
     :WeightPt 0.0,
     :BeginArrowWidth "Medium",
     :DashType "Solid",
     :CapType "Flat",
     :BeginArrowLength "Medium",
     :GradientFill nil,
     :Transparency 0.0,
     :CompoundType "Single",
     :IsVisible true,
     :EndType "None",
     :BeginType "None",
     :IsAutomaticColor true,
     :JoinType "Round",
     :Weight "HairLine",
     :IsAuto true,
     :EndArrowWidth "Medium",
     :Color {:A 0, :R 0, :G 0, :B 0},
     :EndArrowLength "Medium"},
    :Area
    {:BackgroundColor {:A 0, :R 0, :G 0, :B 0},
     :FillFormat
     {:Type "Automatic",
      :SolidFill nil,
      :PatternFill nil,
      :TextureFill nil,
      :GradientFill nil,
      :ImageData nil},
     :ForegroundColor {:A 0, :R 0, :G 0, :B 0},
     :Format "Automatic",
     :InvertIfNegative false,
     :Transparency 0.0},
    :AutoScaleFont true,
    :BackgroundMode "Automatic",
    :ShapeProperties nil,
    :Font
    {:Underline "None",
     :Size 10,
     :IsBold false,
     :IsSubscript false,
     :IsStrikeout false,
     :DoubleSize 10.0,
     :Name "Calibri",
     :IsItalic false,
     :IsSuperscript false,
     :Color {:A 255, :R 0, :G 0, :B 0}},
    :IsAutomaticSize true,
    :link
    {:Href
     "http://api.aspose.cloud/v1.1/cells/aspose-chart.xlsx/worksheets/Sheet1/charts/0/chartArea",
     :Rel "self",
     :Title nil,
     :Type nil},
    :Y 0,
    :X 0,
    :Width 0,
    :Height 0},
   :Code 200,
   :Status "OK"}]
 ["NSeries" {:error "", :status 404}]
 ["legend"
  {:Legend
   {:IsInnerMode nil,
    :Shadow false,
    :Border
    {:Style "Solid",
     :WeightPt 0.0,
     :BeginArrowWidth "Medium",
     :DashType "Solid",
     :CapType "Flat",
     :BeginArrowLength "Medium",
     :GradientFill nil,
     :Transparency 0.0,
     :CompoundType "Single",
     :IsVisible true,
     :EndType "None",
     :BeginType "None",
     :IsAutomaticColor true,
     :JoinType "Round",
     :Weight "HairLine",
     :IsAuto true,
     :EndArrowWidth "Medium",
     :Color {:A 0, :R 0, :G 0, :B 0},
     :EndArrowLength "Medium"},
    :Area
    {:BackgroundColor {:A 0, :R 0, :G 0, :B 0},
     :FillFormat
     {:Type "Automatic",
      :SolidFill nil,
      :PatternFill nil,
      :TextureFill nil,
      :GradientFill nil,
      :ImageData nil},
     :ForegroundColor {:A 0, :R 0, :G 0, :B 0},
     :Format "Automatic",
     :InvertIfNegative false,
     :Transparency 0.0},
    :AutoScaleFont true,
    :BackgroundMode "Automatic",
    :LegendEntries
    {:link
     {:Href "/legendEntries", :Rel "self", :Title nil, :Type nil}},
    :ShapeProperties nil,
    :Font
    {:Underline "None",
     :Size 10,
     :IsBold false,
     :IsSubscript false,
     :IsStrikeout false,
     :DoubleSize 10.0,
     :Name "Calibri",
     :IsItalic false,
     :IsSuperscript false,
     :Color {:A 255, :R 0, :G 0, :B 0}},
    :IsAutomaticSize true,
    :link
    {:Href
     "http://api.aspose.cloud/v1.1/cells/aspose-chart.xlsx/worksheets/Sheet1/charts/0/legend",
     :Rel "self",
     :Title nil,
     :Type nil},
    :Y 0,
    :X 0,
    :Width 0,
    :Position "Right",
    :Height 0},
   :Code 200,
   :Status "OK"}]
 ["secondCategoryAxis" {:error "", :status 404}]
 ["chartDataTable" {:error "", :status 404}]
 ["ChartObject" {:error "", :status 404}])

API response -

  "Chart": {
    "AutoScaling": true,
    "BackWall": {
      "link": {
        "Href": "/BackWall",
        "Rel": "self",
        "Title": null,
        "Type": null
      }
    },
    "CategoryAxis": {
      "link": {
        "Href": "/categoryAxis",
        "Rel": "self",
        "Title": null,
        "Type": null
      }
    },
    "ChartArea": {
      "link": {
        "Href": "/chartArea",
        "Rel": "self",
        "Title": null,
        "Type": null
      }
    },
    "ChartDataTable": {
      "link": {
        "Href": "/chartDataTable",
        "Rel": "self",
        "Title": null,
        "Type": null
      }
    },
    "ChartObject": {
      "link": {
        "Href": "/ChartObject",
        "Rel": "self",
        "Title": null,
        "Type": null
      }
    },
    "DepthPercent": 100,
    "Elevation": 15,
    "FirstSliceAngle": 0,
    "Floor": null,
    "GapDepth": 150,
    "GapWidth": 150,
    "HeightPercent": 100,
    "HidePivotFieldButtons": true,
    "Is3D": false,
    "IsRectangularCornered": true,
    "Legend": {
      "link": {
        "Href": "/legend",
        "Rel": "self",
        "Title": null,
        "Type": null
      }
    },
    "Name": "Chart 1",
    "NSeries": {
      "link": {
        "Href": "/NSeries",
        "Rel": "self",
        "Title": null,
        "Type": null
      }
    },
    "PageSetup": {
      "link": {
        "Href": "/PageSetup",
        "Rel": "self",
        "Title": null,
        "Type": null
      }
    },
    "Perspective": 15,
    "PivotSource": null,
    "Placement": "MoveAndSize",
    "PlotArea": {
      "link": {
        "Href": "/plotArea",
        "Rel": "self",
        "Title": null,
        "Type": null
      }
    },
    "PlotEmptyCellsType": "NotPlotted",
    "PlotVisibleCells": false,
    "PrintSize": "Full",
    "RightAngleAxes": true,
    "RotationAngle": 20,
    "SecondCategoryAxis": {
      "link": {
        "Href": "/secondCategoryAxis",
        "Rel": "self",
        "Title": null,
        "Type": null
      }
    },
    "SecondValueAxis": {
      "link": {
        "Href": "/secondValueAxis",
        "Rel": "self",
        "Title": null,
        "Type": null
      }
    },
    "SeriesAxis": null,
    "Shapes": {
      "link": {
        "Href": "/Shapes",
        "Rel": "self",
        "Title": null,
        "Type": null
      }
    },
    "ShowDataTable": false,
    "ShowLegend": true,
    "SideWall": {
      "link": {
        "Href": "/SideWall",
        "Rel": "self",
        "Title": null,
        "Type": null
      }
    },
    "SizeWithWindow": true,
    "Style": -1,
    "Title": {
      "link": {
        "Href": "/title",
        "Rel": "self",
        "Title": null,
        "Type": null
      }
    },
    "Type": "Column",
    "ValueAxis": {
      "link": {
        "Href": "/valueAxis",
        "Rel": "self",
        "Title": null,
        "Type": null
      }
    },
    "Walls": null,
    "WallsAndGridlines2D": false,
    "link": {
      "Href": "http://api.aspose.cloud/v1.1/cells/aspose-chart.xlsx/worksheets/Sheet1/charts/0",
      "Rel": "self",
      "Title": null,
      "Type": null
    }
  },
  "Code": 200,
  "Status": "OK"
}

Sample spreadsheet -

Thanks!

@alpeware

Thank you for contacting Aspose Support.

We have logged a request (CELLSCLOUD-10132) for our Development team to implement an API that lets the user save Chart in a spreadsheet as PNG.

We will update you here as soon the requested API is implemented.

@alpeware

We are pleased to inform you that now you can save Chart in a spreadsheet as PNG. I have written following Postman example for your convenience:

API: https://api.aspose.cloud/v1.1/cells/aspose-chart.xlsx/worksheets/Sheet1/charts/0?format=png
Input File: aspose-chart.xlsx.zip (5.2 KB)

P.S. Cloud SDKs has also been updated with this new API.

Fantastic, thanks!

Thanks. Please keep using our APIs.