excel转换后几列列宽被拉宽(2).zip (198.3 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);