How to Save Excel Chart as JPG using Node.js

This brief tutorial discusses how to save Excel chart as JPG using Node.js. It has a list of instructions to set the IDE for using the required resources, a list of programming tasks depicting the program logic, and a runnable sample code demonstrating how to convert Excel graph to JPG using Node.js. You will learn different options to customize the output image while saving the chart as an image using the toImage() method.

Steps to Convert Excel Chart to JPG using Node.js

  1. Set the IDE to use Aspose.Cells for Node.js via Java to save a chart as an image
  2. Load the input Excel file having a chart into the Workbook class object
  3. Access the first chart in the first sheet for conversion to JPG in Node.js
  4. Save the chart as JPG using the toImage() method in the Chart class

These steps present the process of how to convert Excel chart to JPG using Node.js. The process is initiated by loading the source workbook from a file or a stream using the Workbook class object followed by accessing the target worksheet, and the desired chart in it using the indexes. In the final step, the toImage() method is called to save the selected chart as an image in Node.js.

Code to Convert Excel Graph to JPG using Node.js

The aforementioned code demonstrates how to save Excel graph as JPG using Node.js. It uses the simplest overloaded function toImage() with a file name only however you may use other overloaded methods where you may set the image options like horizontal and vertical resolution using the ImageOrPrintOptions class, image type using an enumerator for instance ImageType.Bmp, ImageType.Gif, ImageType.Png to list a few.

This article has taught us how to convert Excel chart to JPG using Node.js. If you want to learn the process to convert an Excel file to a PDF file, refer to the article on how to convert XLSX to PDF using Node.js.

 English