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

Free Support Forum - aspose.com

Convert effect is terrible!

java -jar wordsToHTML.jar 1.docx
and rename the converted file to *.html

Hi there,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. If you convert your document to Html using MS Word, you will get the same output.

I have tested the scenario using latest version of Aspose.Words for Java 15.7.0 and have not found any issue. I have attached the output Html with this post for your kind reference. Please use Aspose.Words for Java 15.7.0 and let us know how it goes on your side. If you still face problem, please share the screenshots of problematic sections of output document along with environment detail e.g operating system, JDK version etc.

Do use our client,you can replace your newest jar with renaming it yo aspose-words.jar in the folder wordsToHTML_Lib

our convert src is:
private void wordsToHTML(IKmssFile kmssFile)
throws Throwable
{
InputStream inputStream = null;
OutputStream outputStream = null;
IConvertFile convertFile = null;
String fileKey = “page-”;
printInfo(“attmainid:” + kmssFile.getAttMainId() +
" words document to html start.\n");
long startTime = System.currentTimeMillis();
Document wordDocument = null;
try {
inputStream = kmssFile.getInputStream();
printInfo(“attmainid:” + kmssFile.getAttMainId() +
" words document to html(read doc start).\n");
wordDocument = new Document(inputStream);
wordDocument.acceptAllRevisions();
printInfo(“attmainid:” + kmssFile.getAttMainId() +
" words document to html(read doc over).\n");
HtmlFixedSaveOptions saveOptions = new HtmlFixedSaveOptions();
saveOptions.setPrettyFormat(true);
saveOptions.setExportEmbeddedCss(true);
saveOptions.setExportEmbeddedFonts(true);
saveOptions.setExportEmbeddedImages(true);
saveOptions.setExportEmbeddedSvg(true);
saveOptions
.setWarningCallback(new IWarningCallback()
{
public void warning(WarningInfo warningInfo)
{
AsposeWordsToHTMLConverter.this.printInfo(warningInfo.getWarningType() == 131072 ? “Font substitution: " + warningInfo
.getDescription() : “”);
}
});
int pageCount = wordDocument.getPageCount();
for (int i = 0; i < pageCount; i++) {
if (i == 0) {
printInfo(“attmainid:” +
kmssFile.getAttMainId() +
" words document to html(generate thumbnail start).\n”);
convertFile = kmssFile.newConvertFile(“thumbnail-source”);
outputStream = convertFile.getOutputStream();
ImageSaveOptions imgSaveOptions = new ImageSaveOptions(
104);
imgSaveOptions.setPrettyFormat(true);
imgSaveOptions.setUseHighQualityRendering(false);
imgSaveOptions.setPageIndex(0);
imgSaveOptions.setPageCount(1);
wordDocument.save(outputStream, imgSaveOptions);
outputStream.close();
outputStream = kmssFile.newConvertFile(“thumbnail”)
.getOutputStream();
ThumbnailUtil.resizeByHeight(666, outputStream,
convertFile.getInputStream());
convertFile.getInputStream().close();
outputStream.close();
printInfo(“attmainid:” +
kmssFile.getAttMainId() +
" words document to html(generate thumbnail over).\n");
}
saveOptions.setPageIndex(i);
saveOptions.setPageCount(1);
convertFile = kmssFile.newConvertFile(fileKey + (i + 1));
outputStream = convertFile.getOutputStream();
printInfo(“attmainid:” + kmssFile.getAttMainId() +
" words document to html(page-" + (i + 1) +
“convert start).\n”);
wordDocument.save(outputStream, saveOptions);
printInfo(“attmainid:” + kmssFile.getAttMainId() +
" words document to html(page-" + (i + 1) +
“convert over).\n”);
outputStream.close();
}
printInfo(“attmainid:” + kmssFile.getAttMainId() +
" words document to html over.\n");
printInfo(“attmainid:” + kmssFile.getAttMainId() +
" words document to html success.\n");
printInfo(“attmainid:” + kmssFile.getAttMainId() +
" words document to html used " +
(System.currentTimeMillis() - startTime) / 1000L + “s\n”);
} catch (Throwable t) {
printInfo(“attmainid:” + kmssFile.getAttMainId() +
" words document to html failure.\n");
t.printStackTrace();
} finally {
if (inputStream != null) {
inputStream.close();
inputStream = null;
}
if (outputStream != null) {
outputStream.close();
outputStream = null;
}
wordDocument = null;
}
}

Hi there,

Thanks for sharing the detail. I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-12283. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-12283) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.