GroupDocs.Assembly for .NET 19.3 Release Notes
Major Features
Supported in-lining of syntax error messages into templates instead of exception throwing.
Full List of Features Covering all Changes in this Release
Key | Summary | Category |
---|---|---|
ASSEMBLYNET-99 | Provide an ability to inline template syntax errors in generated Word Processing documents instead of exception throwing | Feature |
ASSEMBLYNET-100 | Provide an ability to inline template syntax errors in generated Spreadsheet documents instead of exception throwing | Feature |
ASSEMBLYNET-101 | Provide an ability to inline template syntax errors in generated Presentation documents instead of exception throwing | Feature |
ASSEMBLYNET-102 | Provide an ability to inline template syntax errors in generated Email documents instead of exception throwing | Feature |
ASSEMBLYNET-103 | Provide an ability to inline template syntax errors in generated Plain Text documents instead of exception throwing | Feature |
ASSEMBLYNET-107 | Allow null values for image tag expressions | Enhancement |
ASSEMBLYNET-108 | Allow null values for doc tag expressions | Enhancement |
Public API and Backward Incompatible Changes
Supported in-lining of syntax error messages into templates instead of exception throwing
By default, Document Assembler throws an exception when encounters a template syntax error. Such an exception provides information on a reason of the error and specifies a tag or expression part where the error is encountered. In most cases, this information is enough to find a place in a template causing the error and fix it.
However, when dealing with complex templates containing a large number of tags, it becomes harder to find an exact place in a template causing an error. To make things easier, the engine supports the DocumentAssemblyOptions.InlineErrorMessages option that enables in-lining of a syntax error message into a template document at an exact position where the error occurs during run-time.
Consider the following template.
<<var [name]>>
By default, such a template causes the engine to throw an exception while building a report. However, when DocumentAssemblyOptions.InlineErrorMessages is applied, no exception is thrown and the report looks as follows then.
<<var [name] Error! An assignment operator is expected. >>
When* DocumentAssemblyOptions.InlineErrorMessages * is applied, a Boolean value returned by a DocumentAssembler.AssembleDocumentoverload indicates whether building of a report was finished successfully or was interrupted because of a template syntax error. This enables you to process reports which building succeeded or failed differently as shown in the following code snippet.
DocumentAssembler assembler = new DocumentAssembler();
assembler.Options |= DocumentAssemblyOptions.InlineErrorMessages;
if (assembler.AssembleDocument (...))
{
// Do something with a successfully
built report.
}
else
{
// Do
something with a report containing a template syntax error.
}