ExcelOLEEncode.zip (1.6 MB)
引用的图片链接含有公文
URL未进行Encode,导致引用出错
src应进行URLEncode,处理为
oleObject_%E5%AF%BC%E5%9B%BE_1.png
转换代码如下
//Load the sample Excel file
Workbook workbook = new Workbook(sourceFileName);
//Specify Html Save Options
HtmlSaveOptions options = new HtmlSaveOptions();
//We do not want to export document, workbook and worksheet properties
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 );
//Specify HtmlSaveOptions - Hide Overlaid Content with CrossHideRight while saving to Html
options.setHtmlCrossStringType(HtmlCrossType. CROSS_HIDE_RIGHT );
//Export the Excel file to Html with Html Save Options
workbook.save(targetFileName, options);