Set Font Color Size of Inline Error Messages in Word Reports | Continue Stop Execution after LINQ Syntax Error C# .NET

Thank you for your response. It worked fine.
I have one more query. I am using ReportBuildOptions.InlineErrorMessages feature that handles exception as you can see below.
Template:
<<if [DT#tag1 != **Error! Can not get the value of member 'DT#tag1' on type 'System.Data.DataRow'.** “AL”]>>Print this text if its in Alabama<</if>>

Code:
ReportingEngine engine = new ReportingEngine();
engine.Options = ReportBuildOptions.InlineErrorMessages;

Query1:
Can we set red color and increase the font size for error statement so that end user can easily understand ?

Query2:
When error occurs in template, It stops its execution. Can we get all errors of template in one go ?

Query3:
What are the other features we have for expection handling apart from ReportBuildOptions.InlineErrorMessages feature

@johnkaltz,

We have logged the following tickets in our issue tracking system.

  • WORDSNET-20796: Provide way to apply font/paragraph formatting to LINQ inline error messages
  • WORDSNET-20797: Provide option to continue or stop execution after LINQ syntax error

We will further look into the details of these requirements and will keep you updated on the status of the linked issues.

We are in coordination with team to get answer pertaining to your this query. Soon, you will be updated with the required information.

Hello Awais,

Thank you for reply. when can I expect the answers of my query WORDSNET-20796, WORDSNET-20797 ? Can you please suggest me any date ?

@johnkaltz,

Regarding query 1, you may find the Run node that contains error message and change its font:

if (!engine.BuildReport(document, ...))
{
    foreach (Run run in document.GetChildNodes(NodeType.Run, true))
    {
        if (run.Text.StartsWith(" Error! "))
        {
            run.Font.Color = Color.Red;
            run.Font.Size *= 1.2;
            //break; // Report generation is stopped on the first error. But let's go through all runs if document may contain non-reporting errors with the same signature.
        }
    }
}

At the moment, there is no other way to apply font formatting to report error messages.

Regarding query 2, WORDSNET-20797 is currently pending for analysis and is in the queue. There are no estimates ( ETA etc ) available at the moment.

We will update you here when we have any more updates on the linked issues.

Regarding query 3, there does not seem to be any other features for error handling. You may handle InvalidOperationException that the engine generates when it encounters syntax error during template parsing. Or it is possible to specify ReportBuildOptions.InlineErrorMessages option and check for the value returned by the ReportingEngine.BuildReport method. It returns ‘true’ when there are no parsing errors.

Hello Awais,

Your help is appreciated.

One more general question, If I have any further query what should i do. should i create new ticket or can ask by replying the same ticket. Please confirm the right procedure.

@johnkaltz,

Yes, in case you have any more queries, please create/open a new topic in Aspose.Words forum. It is recommended that you create new forum threads for different topics, problems or questions. This will keep discussions separate.