Hi, I’m using Aspose Word Python Net 25.1.0, with Python 3.12.5.
When trying to set findreplaceoptions, I get an error, for example:
doc = aw.Document(file)
options = aw.replacing.FindReplaceOptions()
TypeError: While initializing the host for the 'WrpNs_Aspose.WrpNs_Words.WrpNs_Replacing.WrpCs_FindRepl_0DDC6292 (Assembly=WrpInterop.Aspose.Words)' type, an error occurred - Method 'get_ReplacementFormat' not found (error=-2146233069)
This comes from the aspose example, so it doesn’t seem to allow setting the options like this?
@jamestarr Unfortunately, I cannot reproduce the problem on my side using 25.1 version for Aspose.Words for Python. I tested with the following simple code to make sure ReplacementFormat
works as expected:
options = aw.replacing.FindReplaceOptions()
options.replacement_format = aw.replacing.ReplacementFormat.HTML
aw.lowcode.Replacer.replace("C:\\Temp\\in.docx", "C:\\Temp\\out.docx", aw.SaveFormat.DOCX, "ReplaceMe", "<b>Formated </b><i>text</i>", options)
in.docx (13.9 KB)
out.docx (11.2 KB)
Could you please describe your environment where the problem occurs?