Some comments are not available for selection after DOCX to HTML conversion

I have converted a *.docx document to *.html format with Aspose.Words and the result document have SVG layers in a way that prevents text selection with a mouse.
When the mouse is hovered over the text the cursor representation is an arrow and clicking doesn’t select the text under the cursor. Only text in the second comment can be selected (cursor changes to a typing caret).
I attached the document.

Code sample:

var doc = new Document(inPath);
var optHtml = new HtmlFixedSaveOptions()
{
	PageSet = new PageSet(new PageRange(0, int.MaxValue)),
	ExportEmbeddedCss = true,
	ExportEmbeddedFonts = true,
	ExportEmbeddedImages = true,
	ExportEmbeddedSvg = true
};
doc.Save(outPath, optHtml);

I use Aspose.Words.dll 25.2.0.0.
test32.zip (16.3 KB)

@licenses

It seems that the issue you’re experiencing with the text selection in the converted HTML document is related to the way SVG layers are being handled during the conversion process. When using the HtmlFixedSaveOptions to convert a DOCX file to HTML, the output may include SVG elements that can interfere with text selection.

To address this issue, you can try the following approaches:

  1. Adjust Export Options: Ensure that the ExportEmbeddedSvg option is set to false. This will prevent the SVG content from being embedded directly in the HTML, which might help with text selection. You can modify your code as follows:

    var doc = new Document(inPath);
    var optHtml = new HtmlFixedSaveOptions()
    {
        PageSet = new PageSet(new PageRange(0, int.MaxValue)),
        ExportEmbeddedCss = true,
        ExportEmbeddedFonts = true,
        ExportEmbeddedImages = true,
        ExportEmbeddedSvg = false // Set this to false
    };
    doc.Save(outPath, optHtml);
    
  2. Use Different Save Options: If the issue persists, consider using the standard HtmlSaveOptions instead of HtmlFixedSaveOptions. The standard options may provide better handling for text selection:

    var doc = new Document(inPath);
    var saveOptions = new HtmlSaveOptions()
    {
        ExportRoundtripInformation = true,
        ExportFontResources = true,
        ExportImages = true
    };
    doc.Save(outPath, saveOptions);
    
  3. Check for Overlapping Elements: If there are overlapping elements in your document, it may also affect the ability to select text. Review the layout of your original DOCX file to ensure that elements are not overlapping in a way that would prevent selection.

  4. Update Aspose.Words: Ensure that you are using the latest version of Aspose.Words, as updates may include bug fixes and improvements related to HTML conversion.

By trying these adjustments, you should be able to improve the text selection functionality in the converted HTML document. If the problem continues, consider sharing the specific document for further analysis.

Sources:

@licenses
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-27916

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.