Its pretty much the same code just tweaked to match the available functions in 2.5.4:
public AsposeTest() throws Exception
{
//Instantiate a Workbook object that represents Excel file.
Workbook wb = new Workbook();
//Note when you create a new workbook, a default worksheet
//"Sheet1" is added (by default) to the workbook.
//Access the first worksheet "Sheet1" in the book.
Worksheet sheet = wb.getWorksheets().getSheet(0);
//Adding some sample value to cells
Cells cells = sheet.getCells();
Cell cell = cells.getCell("A1");
cell.setValue(50);
cell = cells.getCell("A2");
cell.setValue(100);
cell = cells.getCell("A3");
cell.setValue(150);
cell = cells.getCell("B1");
cell.setValue(4);
cell = cells.getCell("B2");
cell.setValue(20);
cell = cells.getCell("B3");
cell.setValue(50);
Charts charts = sheet.getCharts();
//Adding a chart to the worksheet
Chart chart = charts.addChart(ChartType.COLUMN_CLUSTERED, 5, 0, 15, 5);
//Getting Chart Area
ChartArea chartArea = chart.getChartArea();
//Setting the foreground color of the chart area
//chartArea.getArea().setTransparency( 1 );
//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
NSeries serieses = chart.getNSeries();
serieses.add("A1:B3", true);
//Save the Excel file.
//wb.save("D:\\MyBook.xlsx", FileFormatType.EXCEL_2007_XLSX);
// save the chart image to stream
ByteArrayOutputStream imageStream = new ByteArrayOutputStream();
chart.toImage(imageStream, new ImageOptions() );
// save the workbook to stream
ByteArrayOutputStream bout = new ByteArrayOutputStream();
wb.save( bout, FileFormatType.EXCEL2003 );
// create presentation and slide
PresentationEx presentation = new PresentationEx();
SlideEx slide = presentation.getSlides().get( 0 );
// add workbook to slide
addExcelChartToPresentation(presentation, slide, bout.toByteArray(), imageStream.toByteArray() );
// save presentation
presentation.write( new FileOutputStream( "D:\\testPresentation.ppt" ) );
}
private void addExcelChartToPresentation( PresentationEx presentation, SlideEx slide, byte[] wbArray, byte[] imgChart ) throws Exception
{
double oleHeight = presentation.getSlideSize().getSize().getHeight();
double oleWidth = presentation.getSlideSize().getSize().getWidth();
Workbook wb = new Workbook();
wb.loadData( new ByteArrayInputStream(wbArray) );
OleObjectFrameEx oof = slide.getShapes().addOleObjectFrame(0f, 0f, (float)oleWidth, (float)oleHeight, "Excel.Sheet", wbArray);
BufferedImage image = ImageIO.read(new ByteArrayInputStream(imgChart));
oof.setImage(presentation.getImages().addImage(image));
}
public static void main(String[] args) throws Exception
{
AsposeTest t = new AsposeTest();
}