We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Can I create an Image from a newly created Chart?

I want to create a Chart in Aspose.Cells and insert it into a newly created Document in Aspose.Words.

I understand that "there are no plans to allow inserting new embedded objects at this time" for Aspose.Words. (http://www.aspose.com/Community/forums/AddPost.aspx?PostID=58093) So I cannot embed such a Chart into a Document.

But is it possible in Aspose.Cells to create an image of my newly created Chart? Then I can use insertImage in Aspose.Words.

Chart2image feature is not supported yet but we have started to work on it. It may take 6-9 months to totally support this feature.

Currently you can try to create chart with Aspose.Chart and insert the image in Aspose.Words.

@robdfish,

You can convert the Excel Charts to images and PDF formats via Aspose.Cells without requirement MS Excel or any other tool (to be installed). The feature has become more robust and efficient now, so you may concert all types of MS Excel to image format on the fly. In order to provide rendering support, the Chart class has exposed ToImage & ToPdf methods with a verity of overloads to best suit the application requirements.

See the following sample code for your reference:
e.g
Sample code:

// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Adding a new worksheet to the Workbook
int sheetIndex = workbook.Worksheets.Add();
// Obtaining the reference of the newly added worksheet by passing its index to WorksheetCollection
Worksheet worksheet = workbook.Worksheets[sheetIndex];

// Adding sample values to cells
worksheet.Cells["A1"].PutValue(50);
worksheet.Cells["A2"].PutValue(100);
worksheet.Cells["A3"].PutValue(150);
worksheet.Cells["B1"].PutValue(4);
worksheet.Cells["B2"].PutValue(20);
worksheet.Cells["B3"].PutValue(50);

// Adding a chart to the worksheet
int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Column, 5, 0, 15, 5);
// Accessing the instance of the newly added chart
Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex];
// Adding Series Collection (chart data source) to the chart ranging from "A1" cell to "B3"
chart.NSeries.Add("A1:B3", true);

// Create an instance of ImageOrPrintOptions and set a few properties
ImageOrPrintOptions options = new ImageOrPrintOptions()
{
    VerticalResolution = 300,
    HorizontalResolution = 300,
    SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias
};
// Convert chart to image with additional settings
chart.ToImage("chartPNG_out.png", options);

See the document for your further reference:
https://docs.aspose.com/display/cellsnet/Chart+Rendering

You may also download the up-to-date examples/demos here.