附件中是exce原文件及转换结果。
excel单元格内容没对齐.zip (351.5 KB)
代码:
Workbook workbook = new Workbook(sourceFileName);
WorksheetCollection sheetCollection = workbook.getWorksheets();
int sheetCont = sheetCollection.getCount();
for(int i=0;i<sheetCont;i++){
sheetCollection.get(i).autoFitColumns();
}
HtmlSaveOptions options = new HtmlSaveOptions();
options.setExportDocumentProperties(false);
options.setExportWorkbookProperties(false);
options.setExportWorksheetProperties(false);
options.setExportSimilarBorderStyle(true);
options.setExportImagesAsBase64(false);
options.setExcludeUnusedStyles(true);
options.setExportHiddenWorksheet(false);
options.setWidthScalable(false);
options.setPresentationPreference(true);
options.setHtmlCrossStringType(HtmlCrossType.CROSS_HIDE_RIGHT);
workbook.save(targetFileName, options);