Thanks for your inquiry.
Yes, you can insert excel charts as images within word without saving excel sheets on the hard drive.
Secondly, of course you need to combine Aspose.Word & Aspose.Excel to generate graphs.
<o:p> </o:p>
//Initialize Document
Document objDocument = new Document();
//Create DocumentBuilder so we can modify the
document.
DocumentBuilder objDocumentBuilder = new
DocumentBuilder(objDocument);
DataTable datatable; //get your datatable from
any datasource
//Add Area3D chart image into the document.
objImage = GetArea3DImage(ChartType.Area3D, datatable, "title");
objDocumentBuilder.InsertImage(objImage);
objDocument.Save(@"C:\WordReports\NetworkSummary-ASP-NET.docx",
Aspose.Words.SaveFormat.Doc);
private System.Drawing.Image
GetArea3DImage(ChartType chartType, DataTable objDataTable, string chartTitle)
{
// Initialize DataLabels
DataLabels objDataLabels=null;
// Initialize Workbook
Workbook objWorkbook = new Workbook();
// Initialize worksheet
Worksheet objWorksheet =
objWorkbook.Worksheets[0];
// Initialize Cells
Aspose.Cells.Cells objCells = objWorksheet.Cells;
objCells.ImportDataTable(objDataTable, true,
"A1");
int chartIndex =
objWorksheet.Charts.Add(chartType, 2, 3, 30, 12);
Chart objChart = objWorksheet.Charts[chartIndex];
// Set some visual options.
objChart.PlotArea.Area.ForegroundColor = Color.White;
objChart.PlotArea.Border.IsVisible = false;
// Set input data ranges.
objChart.NSeries.Add("C2:C"
+ (objDataTable.Rows.Count + 1).ToString(), true);
objChart.NSeries.CategoryData = "A2:A"
+ (objDataTable.Rows.Count + 1).ToString();
objChart.NSeries.IsColorVaried = true;
//Set properties of chart title
objChart.Title.Text = chartTitle;
objChart.Title.TextFont.Color = Color.Black;
objChart.Title.TextFont.IsBold = true;
objChart.Title.TextFont.Size = 12;
//Set the legend position type
objChart.Legend.Position = LegendPositionType.Top;
for (int
i = 0; i < objChart.NSeries.Count; i++)
{
objDataLabels =
objChart.NSeries[i].DataLabels;
objDataLabels.ShowValue = true;
objDataLabels.TextFont.Size = 14;
objDataLabels.TextFont.IsBold = true;
objDataLabels.Position =
LabelPositionType.Above;
objChart.NSeries[i].Name =
objCells[1+i, 1].Value.ToString();
}
return objChart.ToImage();
}
In case of any ambiguity, please let me know.