Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#run").click(run);
- function run(){
- Excel.run(function (ctx) {
- var chart = ctx.workbook.worksheets.getItem("Sheet1").charts.getItem("Chart 1");
- var image = chart.getImage();
- return ctx.sync().then(function () {
- var srcImage = "data:image/png;base64, " + image.value;
- $("#chart").attr("src", srcImage);
- });
- }).catch(function (error) {
- console.log("Error: " + error);
- if (error instanceof OfficeExtension.Error) {
- console.log("Debug info: " + JSON.stringify(error.debugInfo));
- }
- });
- }
- <p class="ms-font-m">Shows the chart image below</p>
- <button id="run" class="ms-Button">
- <span class="ms-Button-label">Run code</span>
- </button><br/>
- <img id="chart" src="" alt="" />
Add Comment
Please, Sign In to add comment