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

Free Support Forum - aspose.com

Bullet are lost after DOCX>HTML>DOCX conversion using .NET

  • I have some bullet points in docx,
  • I convert docx to htm
  • When I convert htm to docx I loose bullet points functionality i.e. they dont behave as bullet points as in original document before conversion.

I have attached examples in zip file containing

  • Source docx file i.e. source.docx
  • Htm conversion of docx file i.e. out.html
  • Docx converion of htm file i.e. out.docx. This is the file with issue

example.zip (156.9 KB)

Code to reproduce the problem:

string rootDir = @“c:\temp”;
string sourceDocxPath = Path.Combine(rootDir, “source.docx”);
string outHtmPath = Path.Combine(rootDir, “out.htm”);
string outDocxPath = Path.Combine(rootDir, “out.docx”);

//Convert docx to html
WordToolsBaseExecute.RegisterAspose();
var document = new Document(sourceDocxPath);
var htmlOptions = new HtmlSaveOptions();
htmlOptions.CssStyleSheetType = CssStyleSheetType.External;
htmlOptions.CssStyleSheetFileName = “test.css”;
htmlOptions.ExportListLabels = ExportListLabels.AsInlineText;
document.Save(outHtmPath, htmlOptions);

//Convert html to docx
var htmlLoadOptions = new HtmlLoadOptions(LoadFormat.Html, string.Empty, rootDir);
var htmlDocument = new Document(outHtmPath, htmlLoadOptions);
htmlDocument.Save(outDocxPath);

@ServerSide527

This property exports all list labels as inline text. So, please use ExportListLabels.ByHtmlTags property to get the bullet list in output Word document.

Hi,
Thanks for the quick response. I have tried what you have said. but there is an issue that we are loosing bullet symbols. Please see following screenshot of html to word conversion.

image.png (6.2 KB)

I have also noticed if we use ExportListLabels.ByHtmlTags, it would not convert bullet symbols properly. Please check following example

image.png (11.3 KB)

@ServerSide527
:
We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-20599 . You will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

As a workaround, please use CssStyleSheetType as CssStyleSheetType.Inline. Hope this helps you.