SCUtil.java (1dfd36f5) | SCUtil.java (5e5a8699) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 626 unchanged lines hidden (view full) --- 635 * @param xSpreadsheet 636 * @param rec a rectangle shape object 637 * @param dataRangeAddress the CellRangeAddress array of chart data source 638 * @param chartName 639 * @return 640 * @throws Exception 641 */ 642 public static XChartDocument createChart(XSpreadsheet xSpreadsheet, Rectangle rec, CellRangeAddress[] dataRangeAddress, String chartName) throws Exception { | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 626 unchanged lines hidden (view full) --- 635 * @param xSpreadsheet 636 * @param rec a rectangle shape object 637 * @param dataRangeAddress the CellRangeAddress array of chart data source 638 * @param chartName 639 * @return 640 * @throws Exception 641 */ 642 public static XChartDocument createChart(XSpreadsheet xSpreadsheet, Rectangle rec, CellRangeAddress[] dataRangeAddress, String chartName) throws Exception { |
643 644 return createChart(xSpreadsheet, rec, dataRangeAddress, chartName, true, false); 645 } 646 647 /** 648 * Create a spreadsheet chart with data in a specific cell range with column/row label enable/not. 649 * @param xSpreadsheet 650 * @param rec a rectangle shape object 651 * @param dataRangeAddress the CellRangeAddress array of chart data source 652 * @param chartName 653 * @param hasColumnLabel 654 * @param hasRowLabel 655 * @return 656 * @throws Exception 657 */ 658 public static XChartDocument createChart(XSpreadsheet xSpreadsheet, Rectangle rec, CellRangeAddress[] dataRangeAddress, String chartName, Boolean hasColumnLabel, Boolean hasRowLabel) throws Exception { |
|
643 XChartDocument xChartDocument = null; 644 XTableChartsSupplier xTChartSupplier = 645 (XTableChartsSupplier) UnoRuntime.queryInterface(XTableChartsSupplier.class, xSpreadsheet); 646 XTableCharts xTableCharts = xTChartSupplier.getCharts(); 647 XNameAccess xNameAccess = 648 (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xTableCharts); 649 if (xNameAccess != null && !xNameAccess.hasByName(chartName)) { 650 | 659 XChartDocument xChartDocument = null; 660 XTableChartsSupplier xTChartSupplier = 661 (XTableChartsSupplier) UnoRuntime.queryInterface(XTableChartsSupplier.class, xSpreadsheet); 662 XTableCharts xTableCharts = xTChartSupplier.getCharts(); 663 XNameAccess xNameAccess = 664 (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xTableCharts); 665 if (xNameAccess != null && !xNameAccess.hasByName(chartName)) { 666 |
651 xTableCharts.addNewByName(chartName, rec, dataRangeAddress, true, false); | 667 xTableCharts.addNewByName(chartName, rec, dataRangeAddress, hasColumnLabel, hasRowLabel); |
652 XTableChart xTableChart = (XTableChart) UnoRuntime.queryInterface( 653 XTableChart.class, xNameAccess.getByName(chartName)); 654 XEmbeddedObjectSupplier xEmbeddedObjectSupplier = (XEmbeddedObjectSupplier) UnoRuntime.queryInterface( 655 XEmbeddedObjectSupplier.class, xTableChart); 656 xChartDocument = (XChartDocument) UnoRuntime.queryInterface( 657 XChartDocument.class, xEmbeddedObjectSupplier.getEmbeddedObject()); 658 } 659 --- 53 unchanged lines hidden (view full) --- 713 714 /** 715 * Get the names of charts in specific sheet 716 * @param xSpreadsheet 717 * @return 718 * @throws Exception 719 */ 720 public static String[] getChartNameList(XSpreadsheet xSpreadsheet) throws Exception { | 668 XTableChart xTableChart = (XTableChart) UnoRuntime.queryInterface( 669 XTableChart.class, xNameAccess.getByName(chartName)); 670 XEmbeddedObjectSupplier xEmbeddedObjectSupplier = (XEmbeddedObjectSupplier) UnoRuntime.queryInterface( 671 XEmbeddedObjectSupplier.class, xTableChart); 672 xChartDocument = (XChartDocument) UnoRuntime.queryInterface( 673 XChartDocument.class, xEmbeddedObjectSupplier.getEmbeddedObject()); 674 } 675 --- 53 unchanged lines hidden (view full) --- 729 730 /** 731 * Get the names of charts in specific sheet 732 * @param xSpreadsheet 733 * @return 734 * @throws Exception 735 */ 736 public static String[] getChartNameList(XSpreadsheet xSpreadsheet) throws Exception { |
721 XChartDocument xChartDocument = null; | |
722 XTableChartsSupplier xTChartSupplier = 723 (XTableChartsSupplier) UnoRuntime.queryInterface(XTableChartsSupplier.class, xSpreadsheet); 724 XTableCharts xTableCharts = xTChartSupplier.getCharts(); 725 String[] chartNames = xTableCharts.getElementNames(); 726 return chartNames; 727 } 728 729 730 731} | 737 XTableChartsSupplier xTChartSupplier = 738 (XTableChartsSupplier) UnoRuntime.queryInterface(XTableChartsSupplier.class, xSpreadsheet); 739 XTableCharts xTableCharts = xTChartSupplier.getCharts(); 740 String[] chartNames = xTableCharts.getElementNames(); 741 return chartNames; 742 } 743 744 745 746} |