Hi Ajay,
Thank you for writing back.
You can auto fit a particular column by using the Worksheet.autoFitColumn(int column) method as per your requirement. Although the wrapped text property has limited scope of Style class, and a style can be applied to Column as well as Cell. Therefore if you wish to check if a particular column has wrapped text property enabled, you have to check its Style object for isTextWrapped property. Moreover, even though a Column as a whole may not have the wrapped text property enabled, but the cells in that column may have the aforesaid property set to true.
Here is how you may check if a Column has isTextWrapped property enabled or not.
Java
Workbook workbook = new Workbook(myDir + “good.xlsx”);
Worksheet worksheet = workbook.getWorksheets().get(0);
//Iterate all columns till the max data column
for (int i = 0 ; i < worksheet.getCells().getMaxDataColumn() ; i++)
{
//Get the column instance at a particular index from the column collection
Column column = worksheet.getCells().getColumns().get(i);
//Check if column does not have isTextWrapped property enabled
if(!column.getStyle().isTextWrapped())
{
worksheet.autoFitColumn(column.getIndex());
}
}
Regarding the other part of your inquiry, the JavaScript code injected in Aspose.Cells generated HTML basically deals with the interactive part of the webpage, like scrolling, mouse click/hover, worksheet tabs etc. I don’t think that more JavaScript code is added by just calling the
Worksheet.autoFitColumns method before rendering the spreadsheet to HTML format. Nor I was able to replicate the problem while using the FireFox, Chrome and IE 11 to render the HTML. We would request you to please give the latest version of
Aspose.Cells for Java (Latest Version) a try on your end to see if it makes any difference. In case the problem persists, please provide the input and output files in an archive along with your code snippets for our review.