Issues in compare preview

Hello Team,

I am using the Aspose Compare feature and previewing the results as an HTML file for a business case. However, I have encountered an issue specifically related to bullet points:

  • The bullet points appear with a different design/style.
  • There is a large gap between the text containing bullet points and the newly added section.
  • In the newly added section, no bullet points were actually added, but it is being marked as if there were—when compared to the section that includes bullet points.

This issue does not occur when the Aspose syntax is replaced with real-time data. Additionally, when I download the document as a Word file, everything works as expected.

Below is the code I am using to convert the compared document to HTML:

HtmlFixedSaveOptions opt = new HtmlFixedSaveOptions();
opt.PrettyFormat = true;
opt.ExportEmbeddedCss = true;
opt.ExportEmbeddedFonts = true;
opt.ExportEmbeddedImages = true;
opt.ExportEmbeddedSvg = true;
opt.ShowPageBorder = false;

Could you please assist in resolving this issue?

DOC_2.docx (28.7 KB)

DOC_1.docx (24.9 KB)

OUTPUT OF HTML (SCREENSHOTS).docx (77.0 KB)

@KeerthanaRamesh19 Usually, the such problems occur because the fonts used in your input document are not available on the machine where document is rendered. The fonts are required to build document layout. If Aspose.Words cannot find the font used in the document, the font is substituted . This might lead into fonts mismatch and document layout differences due to the different fonts metrics. You can implement IWarningCallback to get notifications when font substitution is performed.
Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/

Here is output produced on my side: out.zip (59.1 KB)

Hey @alexey.noskov ,
So basically, after the compare step is done, I should add this next part on top of it, right?
Could you please confirm if that’s correct or let me know exactly what needs to be added and where?

If possible, could you also share the code you’re using for this? That would be really helpful.

Thanks!

@KeerthanaRamesh19 Sure, here is a simple code example that demonstrates how to use warning callback:

// Open input documents.
Document v1 = new Document(@"C:\Temp\v1.docx");
Document v2 = new Document(@"C:\Temp\v2.docx");

// Set warning callback
v1.WarningCallback = new FontSubstitutionWarningCallback();

// Compare documents.
v1.Compare(v2, "AW", DateTime.Now);

// Save the output.
HtmlFixedSaveOptions opt = new HtmlFixedSaveOptions();
opt.PrettyFormat = true;
opt.ExportEmbeddedCss = true;
opt.ExportEmbeddedFonts = true;
opt.ExportEmbeddedImages = true;
opt.ExportEmbeddedSvg = true;
opt.ShowPageBorder = false;

v1.Save(@"C:\Temp\out.html", opt);
internal class FontSubstitutionWarningCallback : IWarningCallback
{
    public void Warning(WarningInfo info)
    {
        if (info.WarningType == WarningType.FontSubstitution)
            Console.WriteLine(info.Description);
    }
}