HideComments replacement CommentDisplayMode not working as before

Hi,

I have switched from HideComments in WordProcessingLoadOptions, to CommentDisplayMode, due to it becoming obsolete in version 25.5.

This was the old code:
convLoadOpts.HideComments = true;

This is the new code:
convLoadOpts.CommentDisplayMode = WordProcessingCommentDisplay.Hidden;

I thought it would not make any difference, but the result looks quite different:
image.png (364.9 KB)

I was using GroupDocs.Total 25.2 with the following code:

        var convLoadOpts = new WordProcessingLoadOptions();
        //convLoadOpts.HideComments = true;
        convLoadOpts.CommentDisplayMode = WordProcessingCommentDisplay.Hidden;

        var settings = new ConverterSettings();
        settings.FontDirectories.Clear(); // Clear font directories
        Func<LoadContext, LoadOptions> fnLoadOpts = (loadContext) => convLoadOpts;
        using (var conv = new Converter(documentPath, fnLoadOpts, () => settings))
        {
            var options = new PdfConvertOptions();
            conv.Convert("Conversion.pdf", options);
        }

Attaching the sample, as well as the output PDFs with different options:
Comment behavior changed.zip (130.6 KB)

Can you please take a look and ideally provide a fix before HideComments gets removed?
Thanks!

Best regards,
Clemens

@Clemens_Pestuka

It seems you are experiencing issues with the transition from using HideComments to CommentDisplayMode in the WordProcessingLoadOptions. The change in behavior you are observing could be due to differences in how these two properties handle comments in the document.

In your previous implementation, you used HideComments = true, which effectively hid all comments in the document. With the new approach, setting CommentDisplayMode to WordProcessingCommentDisplay.Hidden should ideally provide similar functionality. However, if the output is not as expected, it may be worth checking the following:

  1. Ensure Proper Versioning: Make sure you are using the correct version of the library that supports CommentDisplayMode. Since you mentioned using GroupDocs.Total 25.2, ensure that you have updated to a version that fully supports the new property.

  2. Review the Documentation: Sometimes, changes in the API can lead to different behaviors. It might be helpful to review the latest documentation for any notes on CommentDisplayMode and how it interacts with other settings.

  3. Sample Code: Here’s a sample code snippet that demonstrates how to use CommentDisplayMode:

    var convLoadOpts = new WordProcessingLoadOptions
    {
        CommentDisplayMode = WordProcessingCommentDisplay.Hidden
    };
    
    var settings = new ConverterSettings();
    settings.FontDirectories.Clear(); // Clear font directories
    Func<LoadContext, LoadOptions> fnLoadOpts = (loadContext) => convLoadOpts;
    
    using (var conv = new Converter(documentPath, fnLoadOpts, () => settings))
    {
        var options = new PdfConvertOptions();
        conv.Convert("Conversion.pdf", options);
    }
    
  4. Testing Different Modes: If hiding comments is not working as expected, you might want to test other values for CommentDisplayMode, such as WordProcessingCommentDisplay.Show or WordProcessingCommentDisplay.ShowInMargin, to see how they affect the output.

If the issue persists, consider reaching out to the support team with specific details about the differences in output, as they may provide insights or fixes for the behavior you are encountering.

For further reference, you can check the example code provided in the GroupDocs GitHub repository, which demonstrates how to hide comments during conversion here.

If you have any more questions or need further assistance, feel free to ask!