Problem 1:
When I export html, the length of the data bar is shorter than that in excel (the data bar is in the G7 cell and it is set to display only the data bar).
The databar in excel: databar_excel.png (7.7 KB)
The databar in html: databar_html.png (1.6 KB)
code show as below:
HtmlSaveOptions options = new HtmlSaveOptions();
options.getExportActiveWorksheetOnly();
Workbook workbook = new Workbook(new FileInputStream("test.xlsx"));
workbook.save("test.html", options);
Problem 2:
Also set the conditional format in the G7 cell (remove the only display data bar setting), use DataBar.toImage to get the data bar picture, and it is found that the obtained picture is blank. But there are data bars in excel。
databar.png (87 Bytes)
code show as below:
Workbook workbook = new Workbook(new FileInputStream("test2.xlsx"));
Worksheet worksheet = workbook.getWorksheets().get(0);
Cell cell = worksheet.getCells().get("G7");
DataBar dataBar = cell.getConditionalFormattingResult().getConditionalFormattingDataBar();
ImageOrPrintOptions imgOpts = new ImageOrPrintOptions();
imgOpts.setImageFormat(ImageFormat.getPng());
byte[] data = dataBar.toImage(cell, imgOpts);
// save
try (FileOutputStream out = new FileOutputStream("databar.png");) {
out.write(data);
}
The excel file in the example:excel_files.zip (51.1 KB)