We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Column width not perfect after converting Excel to Html

Dear support

I’m trying to use the Cells 8.7.1 , to convert an Excel sheet to Html page.
I find whatever I adjust the width of column , the width in final html page is not changed, it always keep the same space.

Please refer the attachment and code

public class Excel2Html {

public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
Workbook wb = new Workbook(“C:\0\aspose.xlsx”);
HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.HTML);
options.setExportActiveWorksheetOnly(true);
options.setHtmlCrossStringType(HtmlCrossType.FIT_TO_CELL);
options.setPresentationPreference(true);
wb.save(“C:\0\aspose.html”, options);
}

}

I’m a new user to the Cells , is there some way to control the width of column in the product ?

Hi,


Thank you for considering Aspose APIs.

I have evaluated the presented scenario while using the following piece of code against the latest revision of Aspose.Cells for Java 8.7.1.2 (attached), and I am not able to observe the said issue. I have attached the resultant HTML file in an archive for your reference. Could you please give the latest version a try on your side as well?

Java

String wbPath = dir + “aspose.xlsx”;
Workbook wb = new Workbook(wbPath);
HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.HTML);
options.setEncoding(Encoding.getUTF8());
options.setHtmlCrossStringType(HtmlCrossType.FIT_TO_CELL);
options.setPresentationPreference(true);
options.setExportActiveWorksheetOnly(true);
String html = wbPath.replace(".xlsx", CellsHelper.getVersion() + “.html”);
wb.save(html, options);

Cool!!! It works fine with the latest version 8.7.1.2


Thanks for your quick response.

I like Aspose more:)

Hi again,


Thank you for the confirmation. It is good to know that you are up & running again. Please feel free to contact us back in case you need our further assistance with Aspose APIs.