mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Merge pull request #7607 from gdicristofaro/8341-dsChartExportFix
8341 fix data source summary chart export
This commit is contained in:
commit
5520ca418f
@ -1,6 +1,6 @@
|
||||
DataSourceSummaryReport.error.noDataSources=No data sources selected for report.
|
||||
DataSourceSummaryReport.error.noOpenCase=No currently open case.
|
||||
DataSourceSummaryReport.excelFileWriteError=Could not write the KML file.
|
||||
DataSourceSummaryReport.excelFileWriteError=Could not write the xlsx file.
|
||||
DataSourceSummaryReport.failedToCompleteReport=Failed to complete report.
|
||||
DataSourceSummaryReport.getName.text=Data Source Summary Report
|
||||
DataSourceSummaryReport.getDesc.text=Data source summary report in Excel (XLS) format.
|
||||
|
@ -89,7 +89,7 @@ public class DataSourceSummaryReport implements GeneralReportModule {
|
||||
"DataSourceSummaryReport.error.noOpenCase=No currently open case.",
|
||||
"DataSourceSummaryReport.error.noDataSources=No data sources selected for report.",
|
||||
"DataSourceSummaryReport.failedToCompleteReport=Failed to complete report.",
|
||||
"DataSourceSummaryReport.excelFileWriteError=Could not write the KML file.",})
|
||||
"DataSourceSummaryReport.excelFileWriteError=Could not write the xlsx file.",})
|
||||
@Override
|
||||
public void generateReport(GeneralReportSettings settings, ReportProgressPanel progressPanel) {
|
||||
progressPanel.start();
|
||||
|
@ -24,6 +24,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xddf.usermodel.chart.ChartTypes;
|
||||
import org.apache.poi.xddf.usermodel.chart.LegendPosition;
|
||||
import org.apache.poi.xddf.usermodel.chart.XDDFChartLegend;
|
||||
import org.apache.poi.xddf.usermodel.chart.XDDFDataSource;
|
||||
@ -157,23 +158,7 @@ class PieChartExport implements ExcelItemExportable, ExcelSheetExport {
|
||||
new CellRangeAddress(tableDimensions.getRowStart() + 1, tableDimensions.getRowEnd(),
|
||||
tableDimensions.getColStart() + 1, tableDimensions.getColStart() + 1));
|
||||
|
||||
// NOTE: There appears to be a classpath issue with POI (a version of 4.0.1 and 4.1.1 simultaneously)
|
||||
// that is causing conflicts for XDDFPieChartData creation (i.e. the compiler thinks its using 4.1.1
|
||||
// and the runtime thinks its using 4.0.1) Reflection is used below to use the 4.0.1 method while
|
||||
// sidestepping compiler issues.
|
||||
// XDDFPieChartData creation that can be used in poi >= 4.1.1:
|
||||
// XDDFPieChartData data = (XDDFPieChartData) chart.createData(ChartTypes.PIE, bottomAxis, leftAxis);
|
||||
// XDDFPieChartData creation that can be used in 4.0.1:
|
||||
// XDDFPieChartData data = new XDDFPieChartData(chart.getCTChart().getPlotArea().addNewPieChart());
|
||||
XDDFPieChartData data;
|
||||
try {
|
||||
Constructor<XDDFPieChartData> constructor = XDDFPieChartData.class.getConstructor(CTPieChart.class);
|
||||
constructor.setAccessible(true);
|
||||
data = constructor.newInstance(chart.getCTChart().getPlotArea().addNewPieChart());
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException | IllegalArgumentException ex) {
|
||||
throw new ExcelExportException("Error while instantiating chart data.", ex);
|
||||
}
|
||||
|
||||
XDDFPieChartData data = (XDDFPieChartData) chart.createData(ChartTypes.PIE, null, null);
|
||||
data.setVaryColors(true);
|
||||
data.addSeries(cat, val);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user