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

Free Support Forum - aspose.com

I want to convert excel into html. There should be a table in this html that can slide left and right. Like excel in office, can aspose be implemented?

I want to convert excel into html. There should be a table in this html that can slide left and right. Like excel in office, can aspose be implemented?

Workbook workbook = new Workbook("/Users/zyx/Desktop/979817-t222渠道 Channel.xls");

    // Specify the HTML saving options
    HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.M_HTML);
    saveOptions.setEncoding(Encoding.getUTF8());


    // Instantiate a workbook and open the template XLSX file

    // Save the HTML file
    workbook.save(  "/Users/zyx/Desktop/CToHTMLFiles_out123.html", saveOptions);

979817-t222渠道 Channel.xls.zip (7.9 KB)
CToHTMLFiles_out123.html.zip (8.2 KB)

@zxy1092003,
I have used following code and it creates same Html file as MS Excel. Please use latest version and let us know your feedback.

// Instantiate a workbook and open the template XLSX file
Workbook workbook = new Workbook("/Users/zyx/Desktop/979817-t222渠道 Channel.xls");

// Specify the HTML saving options
HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.HTML);
saveOptions.setEncoding(Encoding.getUTF8());    

// Save the HTML file
workbook.save(  "/Users/zyx/Desktop/CToHTMLFiles_output.html", saveOptions);

CToHTMLFiles_output.zip (2.6 KB)

However, if the tables are very wide or very long, they will be divided into a lot of html. Is there any way to make them a table of html?

@zyx,
I have modified your sample file and repeated rows and columns multiple times using MS Excel and then converted to HTML using the following sample code. It is converted to Html table properly. You may please give it a try and share the feedback. If it does not fulfill your requirement, share your sample Excel file and expected output HTML file for our reference. We will reproduce the issue here and share our feedback accordingly.

// Instantiate a workbook and open the template XLSX file
Workbook workbook = new Workbook("979817-t222渠道 Channel copy.xls");

// Specify the HTML saving options
HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.HTML);
saveOptions.setExportGridLines(true);
saveOptions.setEncoding(Encoding.getUTF8());    

workbook.getWorksheets().get(0).autoFitColumns();
// Save the HTML file
workbook.save("979817-t222渠道 Channel_Out3.html", saveOptions);

979817-t222渠道 Channel_Out3.html.zip (5.0 KB)