Html Compare Document Wrong Result Issue

Hi I’m using your comparison API for HTML file in .NET and I’m facing strange issues in compared result currently we are using ECMERGE tool but I want to switch tool but your tool did not provide me proper result.8k_ResultSnap.PNG (128.1 KB)
you can check in this snap it is comparing same content then delete it and add new content it is very strange. please guide me if you have any solution for it,

@Faizan_Bin_Naeem

Would you kindly share your sample HTML file along with the link of API Page where you are testing the comparison functionality. We will investigate the scenario further and share our feedback with you accordingly.

Hi @asad.ali
ComparingFiles.zip (90.4 KB)
please download this zip and I’m using your .net project after downloading from GitHub & I’ve one more question can we compare files using side by side comparing like beyond comparer tool ?

A post was split to a new topic: Comparing word documents and it output shows just text

@Faizan_Bin_Naeem

We believe that you are using Aspose.Words comparison feature to compare two HTML files. Aspose.HTML does not provide a feature to compare two HTML files. We will soon reach you with our feedback.

Please note that Aspose.Words mimics the behavior of MS Word. If you compare your documents using MS Word, you will get the same output.

You have shared two HTML documents. Please share which one is your source document. We will use it in following code example and provide you more information on it.

Document srcDoc = new Document(MyDir + "Source.html");
Document dstDoc = new Document(MyDir + "Destination.html");
dstDoc.Compare(srcDoc, "aw", DateTime.Now);
dstDoc.Save(MyDir + "output.docx");

Hi @tahir.manzoor
I’m talking about this type of comparison side by side you can check in this attach picture this type of comparison available in your tool or not. I want to compare two files side by side vertically.

image_2021_03_31T13_48_27_025Z.png (633.6 KB)

@Faizan_Bin_Naeem

Please note that Aspose.Words mimics the behavior of MS Word. Moreover, Aspose.Words is a class library and does not provide UI to show side by side comparison view.

Hi @tahir.manzoor
Please share any documentation link or any code for .NET html files comparison Im unable to find it.

@Faizan_Bin_Naeem

Please read the following article about comparing documents.
Compare Documents

Hi @tahir.manzoor @asad.ali
I’m trying to compare these two html documents but I’m getting 504 gateway issue on your website and getting

No content found

result from API after 5 minutes of execution.

Documents zip
Documents (2).zip (5.0 MB)
Issue Snap shot
ASPOSE_504.PNG (34.0 KB)
NoContentIssues_ASPOSE.PNG (19.5 KB)

@Faizan_Bin_Naeem

We have not found the shared issue at our end. Could you please try again Document comparison online?

If you still face problem, please ZIP and attach your input Word documents here for testing. We will investigate this issue and provide you information on it.

Hi @tahir.manzoor
I’m still facing same issue please check this issue I’m going to attach my input documents for your help please download it and test accordingly.

Comparison_Docs.zip (228.4 KB)

@Faizan_Bin_Naeem

Please note that performance and memory usage all depend on complexity and size of the documents you are generating.

You are comparing big size documents. So, it takes some time for document comparison. We have attached the output document with this post for your kind reference.
output.zip (263.7 KB)

You can download the source code of online demos from here:

https://github.com/aspose-words/Aspose.Words-for-.NET

Hi @tahir.manzoor
Can you please tell me why I’m facing 504 gateway issue on your website on comparing my documents. What I need to do to compare my large documents I’m still facing 504 gateway issue. How did you compare my inputs document without any issue ?
can we make call ?

@tahir.manzoor
I’m using same input file that I sent you earlier but I’m still facing issues

e.g “No Content Found”

I’ve already purchased Aspose.Words license.
Please check my code and tell me why I’m getting issues if you need input files you can download files from my previous message.

try
{
    comparable = formatInputString ? comparable.FormatInputString(includeFormatInRedline) : comparable;
    comparator = formatInputString ? comparator.FormatInputString(includeFormatInRedline) : comparator;

    Aspose.Words.License license = new Aspose.Words.License();
    license.SetLicense("Aspose.Words.lic");

    // Load both documents in Aspose.Words
    HtmlLoadOptions loadOptions = new HtmlLoadOptions();
    loadOptions.ResourceLoadingCallback = new NullImageLoadingCallback();

    Document doc1;
    using (MemoryStream inStream = new MemoryStream(Encoding.UTF8.GetBytes(comparable)))
    {
        doc1 = new Document(inStream, loadOptions);
    }

    Document doc2;
    using (MemoryStream inStream = new MemoryStream(Encoding.UTF8.GetBytes(comparator)))
    {
        doc2 = new Document(inStream, loadOptions);
    }

    logger.Info("Aspose Compare method start ");
    doc1.Compare(doc2, "author", DateTime.Now);


    logger.Info("Aspose Compare method start end");

    HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.Html);
    options.ExportImagesAsBase64 = true;
    options.PrettyFormat = true;
    options.ExportOriginalUrlForLinkedImages = true;
    options.ExportRoundtripInformation = false;

    Stream output = new MemoryStream();
    doc1.Save(output, options);
    output.Position = 0;
    var comparedContents = convertFromStreamToText(output);
    comparedContents = formatOutputString ? comparedContents.FormatOutputString(includeFormatInRedline) : comparedContents;
    comparedContents = Regex.Replace(comparedContents, "<ins.*?>", "<ins style='color: green'>");
    return comparedContents;
}
catch (Exception ex)
{
    logger.Error(ex);
    return string.Empty;
}

@Faizan_Bin_Naeem

We have created new post for this case in Aspose.Words App forum where you will be guided appropriately.

Please read the following article about comparing the documents.

https://docs.aspose.com/words/net/compare-documents/

We used the same code to compare the documents. Please check the output in my previous post.