CellRangeAddress[] cellrangeaddressChart =
new CellRangeAddress[ 1 ];
cellrangeaddressChart[ 0 ] = cellrangeaddress;
// Get the table charts supplier of the spreadsheet.
XTableChartsSupplier xtablechartssupplier = ( XTableChartsSupplier )
UnoRuntime.queryInterface( XTableChartsSupplier.class, xspreadsheet );
// Get all table charts of the spreadsheet.
XTableCharts xtablecharts = xtablechartssupplier.getCharts();
// Create a table chart with all written values.
xtablecharts.addNewByName( "Example", rectangle,
cellrangeaddressChart, true, true );