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

Free Support Forum - aspose.com

Problem with bullet list Converting from DOCX -> HTML Word.Java

I have a problem when I try to convert attached word file. I get attached HTML file. Bullet list is not left aligned , but there is a lot of spaces in span after bullet on list beginning. Is this a known bug ? I am missing something in my code:

package com.company.asposetest;

import com.aspose.words.Document;
import com.aspose.words.ExportHeadersFootersMode;
import com.aspose.words.HtmlSaveOptions;
import com.aspose.words.SaveFormat;
import org.jsoup.Jsoup;

import java.io.;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {

public static String getBody(String html) {
// get just body
String htmlBody;
org.jsoup.nodes.Document jdoc = Jsoup.parse(html);
if (jdoc != null && jdoc.select(“body”) != null) {
htmlBody = jdoc.select(“body”).toString();
} else {
htmlBody = html;
return htmlBody;

public static String convertByteArrayDocxToHTML(byte[] template) {
String convertedHtml = null;
convertedHtml = generateHtmlFromTemplate(template);

if (convertedHtml!=null) {
convertedHtml = getBody(convertedHtml);
return convertedHtml;

* @param template
* @return
private static String generateHtmlFromTemplate(byte[] template) {
InputStream is = new ByteArrayInputStream(template);
String convertedHtml = null;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
Document doc = new Document(is);
HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.HTML);

doc.save(outputStream, options);
convertedHtml = outputStream.toString(“UTF-8”);

} catch (Exception e) {

} finally {
if (is != null) {
try {
} catch (IOException e) {
if (outputStream != null) {
try {
} catch (IOException e) {
return convertedHtml;

public static void main(String[] args) throws IOException {

Path path = Paths.get(“c:\aspose\1.docx”);
byte[] data;
data = Files.readAllBytes(path);

PrintWriter writer = new PrintWriter(“c:\aspose\1.html”, “UTF-8”);


Hi Milan,

Thanks for your inquiry. I have tested the scenario using latest version of Aspose.Words for Java 14.12.0 and have not found the shared issue. Please use Aspose.Words for Java 14.12.0 and let us know if you have any more queries. I have attached the output HTML with this post for your kind reference.