How to get inline text message in word document

DocumentBuilder builder = new DocumentBuilder(doc);
ReportBuildOptions.InlineErrorMessages;
var hasError = engine.BuildReport(builder.Document, studyData, "Study")
if(hasError ){
    // How to get the error text ? example <<image [AI.Missing] Error! can not get the value of member"Missing"
}

@Amisha43 I think in your case it would be easier to avoid using ReportBuildOptions.InlineErrorMessages and to catch the exception thrown by ReportBuildOptions.BuildReport:

DocumentBuilder builder = new DocumentBuilder(doc);
try
{
    engine.BuildReport(builder.Document, studyData, "Study");
}
catch (Exception ex)
{
    // here you can process the exception message.
}

Thanks but how can i modiffy the text in documnet now suppose error is " [AI.Missing] Error! can not get the value of member"Missing" i want to manipulate text save where error comes

@Amisha43 You can use find/replace functionality in this case. For example the following code prints the tag with error, but you can replace it using the same functionality:

Document doc = new Document(@"C:\Temp\in.docx");
            
ReportingEngine engine = new ReportingEngine();
engine.Options = ReportBuildOptions.InlineErrorMessages;
bool hasError = !engine.BuildReport(doc, "");
if (hasError)
{
    Console.WriteLine("Error");
    FindReplaceOptions opt = new FindReplaceOptions();
    opt.ReplacingCallback = new PrintErrorCallback();
    doc.Range.Replace(new Regex(@"<<.*Error!.*?>>"), "", opt);
}

doc.Save(@"C:\Temp\out.docx");
private class PrintErrorCallback : IReplacingCallback
{
    public ReplaceAction Replacing(ReplacingArgs args)
    {
        Console.WriteLine(args.Match.Value);
        return ReplaceAction.Skip;
    }
}

Please note regular expression is simply just to demonstrate the technique. So it might be required to improve it to properly work with all your cases.

Thanks for the reply. could you please help me to know incase of missing property(Missing) i am not able to replace . This is only happening in foreach loop .For table it works .
doc.Range.Replace(errorText, updatedText, opt);

<<foreach [item in Study.Missing]>>
Date - <<[item ]>>
<</foreach>>

I am not able to replace with custom message. message thrown by aspose is coming

@Amisha43 Unfortunately, your problem is not quite clear. Could you please provide sample input document and runnable code that ill allow us to reproduce the problem? We will check the issue and provide you more information.

SampleData.docx (12.2 KB)

please see attched the document

@Amisha43 Thank you for additional information. But could you please also provide a runnable code that will allow us to reproduce the problem?