Cambiar la posición y el tamaño del gráfico

Aspose.Cells - Cambiar posición y tamaño del gráfico

Para cambiar la posición del gráfico (coordenadas X, Y) y el tamaño (alto, ancho), use estas propiedades usando Aspose.Cells:

  1. Gráfico.getChartObject().get/setWidth()
  2. Gráfico.getChartObject().get/setHeight()
  3. Gráfico.getChartObject().get/setX()
  4. Gráfico.getChartObject().get/setY()

Java

 Workbook workbook = new Workbook(dataDir + "AsposeChart.xls");

Worksheet worksheet = workbook.getWorksheets().get(0);

//Load the chart from source worksheet

Chart chart = worksheet.getCharts().get(0);

//Resize the chart

chart.getChartObject().setWidth(400);

chart.getChartObject().setHeight(300);

//Reposition the chart

chart.getChartObject().setX(250);

chart.getChartObject().setY(150);

Descargar código de ejecución

Descargar código de muestra