Hi,
Thanks for the template file.
oraspose:
2. If we change the named-range to table1, which is the newly added pivot table, "java.lang.IllegalArgumentException" will come back.
I observed the issue as you mentioned by using the following sample code with your newly attached template file. I found that if we change the named-range to "table1" in code an exception: "java.lang.IllegalArgumentException: The row index should not be inside the pivottable report" occurred when rendering to HTML file format.
e.g
Sample code:
//Apply license
for Aspose.Cells for Java.
License
license = new License();
license.setLicense("Aspose.Cells.lic");
//
attached workbook
String path
= "FilteredRows.xlsx";
String
namedRng = "table1";
Workbook
wb = new Workbook(path);
Name
name = wb.getWorksheets().getNames().get(namedRng);
Range
rng = name.getRange();
Worksheet
sheet = rng.getWorksheet();
Cells
cells = sheet.getCells();
int
sheetIdx = sheet.getIndex();
int
firstCol = rng.getFirstColumn();
int
firstRow = rng.getFirstRow();
int
colCnt = rng.getColumnCount();
int
rowCnt = rng.getRowCount();
int
maxCol = cells.getMaxDisplayRange().getColumnCount();
int
maxRow = cells.getMaxDisplayRange().getRowCount();
// Create
a copy of the worksheet - such that only the copy is modified
int
newSheetIdx = wb.getWorksheets().addCopy(sheetIdx);
// BUG
NOTE:
// The
copied worksheet does NOT have the filter applied and therefore
// the
filtered (hidden) rows from the original sheet are now visible
//
redefine the ranges using the copied worksheet
wb.getWorksheets().setActiveSheetIndex(newSheetIdx);
sheet =
wb.getWorksheets().get(newSheetIdx);
cells = sheet.getCells();
rng = cells.createRange(firstRow, firstCol,
rowCnt, colCnt);
//
Manually hide all the columns not part of the named range
if
(firstCol > 0)
{
cells.hideColumns(0, firstCol);
}
if
(firstCol + colCnt < maxCol)
{
cells.hideColumns(firstCol +
colCnt, maxCol + 1);
}
//
Manually hide all the rows not part of the range
if
(firstRow > 0)
{
cells.hideRows(0, firstRow);
}
if
(firstRow + rowCnt < maxRow)
{
cells.hideRows(firstRow +
rowCnt, maxRow);
}
// Now
export the copied worksheet
HtmlSaveOptions
options = new HtmlSaveOptions(SaveFormat.HTML);
options.setEncoding(Encoding.getUTF8());
options.setHtmlCrossStringType(HtmlCrossType.CROSS);
options.setPresentationPreference(true);
options.setExportHiddenWorksheet(false);
//options.setExportActiveWorksheetOnly(true);
options.setExportImagesAsBase64(true);
options.setCreateDirectory(false);
options.setExpImageToTempDir(false);
options.setHiddenColDisplayType(HtmlHiddenColDisplayType.REMOVE);
options.setHiddenRowDisplayType(HtmlHiddenRowDisplayType.REMOVE);
wb.save(“f:\files\out1.html”, options);//Exception
I have logged a ticket with an id “CELLSJAVA-42307” for your issue. We will look into it soon.
oraspose:
3. The html file will:
a. missing last 2 rows;
b. table head will be printed twice;
c. date 2/1/2017 will be changed to a numeric number.
I observed the issue as you mentioned by using the following sample code with your newly attached template file. I found that PivotTable is wrong (missing rows, pivot field headers printed twice, Date converted to numeric values, etc.) in Excel to HTML rendering:
3. The HTML file contains the following issues:
a. missing last 2 rows;
b. table head will be printed twice;
c. date 2/1/2017 will be changed to a numeric number.
e.g
Sample code:
//Apply license
for Aspose.Cells for Java. <o:p></o:p>
License
license = new License();
license.setLicense("Aspose.Cells.lic");
//
attached workbook
String path
= "FilteredRows.xlsx";
String
namedRng = "TestData";
Workbook
wb = new Workbook(path);
Name
name = wb.getWorksheets().getNames().get(namedRng);
Range
rng = name.getRange();
Worksheet
sheet = rng.getWorksheet();
Cells
cells = sheet.getCells();
int
sheetIdx = sheet.getIndex();
int
firstCol = rng.getFirstColumn();
int
firstRow = rng.getFirstRow();
int
colCnt = rng.getColumnCount();
int
rowCnt = rng.getRowCount();
int
maxCol = cells.getMaxDisplayRange().getColumnCount();
int
maxRow = cells.getMaxDisplayRange().getRowCount();
// Create
a copy of the worksheet - such that only the copy is modified
int
newSheetIdx = wb.getWorksheets().addCopy(sheetIdx);
// BUG
NOTE:
// The
copied worksheet does NOT have the filter applied and therefore
// the
filtered (hidden) rows from the original sheet are now visible
//
redefine the ranges using the copied worksheet
wb.getWorksheets().setActiveSheetIndex(newSheetIdx);
sheet =
wb.getWorksheets().get(newSheetIdx);
cells = sheet.getCells();
rng = cells.createRange(firstRow, firstCol,
rowCnt, colCnt);
//
Manually hide all the columns not part of the named range
if
(firstCol > 0)
{
cells.hideColumns(0, firstCol);
}
if
(firstCol + colCnt < maxCol)
{
cells.hideColumns(firstCol +
colCnt, maxCol + 1);
}
//
Manually hide all the rows not part of the range
if
(firstRow > 0)
{
cells.hideRows(0, firstRow);
}
if
(firstRow + rowCnt < maxRow)
{
cells.hideRows(firstRow +
rowCnt, maxRow);
}
// Now
export the copied worksheet
HtmlSaveOptions
options = new HtmlSaveOptions(SaveFormat.HTML);
options.setEncoding(Encoding.getUTF8());
options.setHtmlCrossStringType(HtmlCrossType.CROSS);
options.setPresentationPreference(true);
options.setExportHiddenWorksheet(false);
//options.setExportActiveWorksheetOnly(true);
options.setExportImagesAsBase64(true);
options.setCreateDirectory(false);
options.setExpImageToTempDir(false);
options.setHiddenColDisplayType(HtmlHiddenColDisplayType.REMOVE);
options.setHiddenRowDisplayType(HtmlHiddenRowDisplayType.REMOVE);
wb.save(“f:\files\out1.html”, options);
I have logged a separate ticket with an id “CELLSJAVA-42308” for your issue. We will look into it soon.
oraspose:
1. The html file will give us the wrong pivot table.
Could you elaborate what issue you are talking about, you may attach details and screenshots and sample code to replicate the issue, we will check it soon.
Thank you.