Hidden rows appear in html output

HI,

I am using Aspose cells 8.1.

I want to remove hidden rows & columns from the html output using the below code:

File htmlFile = OfficeResourceUtility.createTemporaryFile(".htm");
Workbook workbook = createWorkBookForHtml(worksheet, table);
HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions(SaveFormat.HTML);
htmlSaveOptions.setParseHtmlTagInCell(true);
htmlSaveOptions.setHiddenColDisplayType(HtmlHiddenColDisplayType.HIDDEN);
htmlSaveOptions.setHiddenRowDisplayType(HtmlHiddenRowDisplayType.HIDDEN);
workbook.save(htmlFile.getAbsolutePath(), htmlSaveOptions);



The above code works for columns, but not for rows .
Any workaround to get this working ?

Hi,


I am using Aspose cells 8.1
The Spreadsheet -ML output returns hidden rows & columns in the xml output.
Any workaround to not get hidden rows & columns in xml output.

Code Snippet :
SpreadsheetML2003SaveOptions spreadsheetML2003SaveOptions = new SpreadsheetML2003SaveOptions(SaveFormat.SPREADSHEET_ML);
workbook.save(xmlFile.getAbsolutePath(), spreadsheetML2003SaveOptions);

Hi Jaspreet,


Thank you for contacting Aspose support.

We would request you to please give the latest version of Aspose.Cells for Java 8.1.2 a try on your end for the issue related to the hidden rows getting rendered in the HTML format. We have checked on our side, the latest version produces the correct results. In case the problem persists, please provide us the sample spreadsheet along with details of the rows that are not hidden in the HTML format. We will further investigate the matter to log appropriate tickets (if applicable).

Regarding the issue related to the hidden rows & columns being included when converted to Spreadsheet-ML format, unfortunately, there is no workaround but to remove such rows & columns that you do not wish to include in the final Spreadsheet-ML document.

Hi,

The issue persists with 8.1.2.
My worklow is :
I create a new workbook & copy range onto it using PasteOptions.
Then i want HTML of the new wokbook with my specify range in it.


private File rangeToHTMLTable(final Cells cells, final Range namedRange, NameValue[] outputFormatProperties)
throws ExcelOutputException,IOException, Exception {
File htmlFile = OfficeResourceUtility.createTemporaryFile(".htm");
Workbook book = createWorkBookForHtml(namedRange);
HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions();
htmlSaveOptions.setHiddenColDisplayType(HtmlHiddenColDisplayType.HIDDEN);
htmlSaveOptions.setHiddenRowDisplayType(HtmlHiddenRowDisplayType.HIDDEN);
book.save(htmlFile.getAbsolutePath(), SaveFormat.HTML);…
}

private static Workbook createWorkBookForHtml(final Range sourceRange) throws Exception {
Workbook newWorkbook = new Workbook(FileFormatType.XLSX);
WorksheetCollection targetWsc = newWorkbook.getWorksheets();
com.aspose.cells.Worksheet targetWs = (com.aspose.cells.Worksheet)targetWsc.get(0);
Range targetRange = targetWs.getCells().createRange(0, 0, sourceRange.getRowCount(), sourceRange.getColumnCount());
PasteOptions options = new PasteOptions();
options.setPasteType(PasteType.ALL);
targetRange.copy(sourceRange, options);

return newWorkbook;
}

The hidden rows still appear !!!

Thanks,
Jaspreet

Hi,

It seems to be an issue with PasteOptions i am using.It is losing the hidden rows info, while hidden column info is intact?

Thanks,
Jaspreet

Hi Jaspreet,

Thanks for your posting and using Aspose.Cells.

If you do not want to display hidden rows and hidden columns in the HTML code, then you should use HtmlHiddenColDisplayType.REMOVE and HtmlHiddenRowDisplayType.REMOVE options.

i.e

htmlSaveOptions.setHiddenColDisplayType(HtmlHiddenColDisplayType.REMOVE);
htmlSaveOptions.setHiddenRowDisplayType(HtmlHiddenRowDisplayType.REMOVE);

It will remove the hidden rows and columns from the HTML code.

If you find any issue, then please provide us your simple runnable sample code so that we could investigate this issue at our end and log it in our database if we find any problem inside it to get it fixed at the earliest.

Hi,

Yes, I tried htmlSaveOptions.setHiddenRowDisplayType(HtmlHiddenRowDisplayType.REMOVE);
But it did not remove hidden rows in my scenario, where in the range has been copied to new workbook using PasteOptions.


If i copy the range to new workbook, cell by cell, then it works, but using paste options it doesn’t.

Thanks,
Jaspreet

Hi Jaspreet,


Unfortunately, we are unable to replicate the presented scenario on our end while using a subset of your provided code snippet to copy a range of cells containing hidden rows. The results produced with latest version of Aspose.Cells for Java 8.1.2 are correct, therefore we request you to please provide us an executable sample application covering your complete scenario (along with template file, if any) to reproduce the issue on our side. Thanks in advance for your cooperation.