Setting the report compatibility mode in the designer does not work properly

Posted by: lit on 21 December 2023, 4:48 am EST

    • Post Options:
    • Link

    Posted 21 December 2023, 4:48 am EST

    Using AR16

    Summary: At runtime, the compatibility mode is set to CrossPlatform, even if the “GDI” option is chosen in the report designer.

    Details:

    We have a .net 48 project for designing reports, but a .net 6 project for building the assembly. This approach is described elsewhere on this site as a way to address the AR designer’s incompatibility with .Net 6 projects.

    We need GDI mode at runtime, so that RichTextBox controls will work as coded. THe RichText issue is also described on this site.

    In the designer, we set the compatibility mode to GDI, but we found that the RichTextBox controls still failed at runtime. On further investigation we found that if we added

    this.CompatibilityMode = GrapeCity.ActiveReports.Document.CompatibilityModes.GDI

    to the report’s constructor, the issue was resolved.

    Note that in the designer, if the compatibility mode is set to crossplatform, this line is generated into the InitializeComponent() generated code:

    this.CompatibilityMode = GrapeCity.ActiveReports.Document.CompatibilityModes.CrossPlatform;

    If in the designer you set the mode to GDI, no line is generated. This implies that GDI is the default. However, it seems that it is not the default.

    Summary: to get GDI mode at runtime, you must write the line of code to make it so.

  • Posted 21 December 2023, 6:03 pm EST

    Hi Leo,

    This is the designed behavior of the product. When no compatibility mode is set the Report automatically renders in GDI mode for backwards compatibility as before ActiveReports 14 CompatibilityMode property wasn’t there and all reports were rendered in GDI Rendering Mode. So if a report with no compatibility mode is used it is assumed to be using GDI rendering mode.

    That said, In .Net Core environment if no Compatibility Mode is set CrossPlatform compatibility mode is used to render the application for cross platform compatibility.

    As you mentioned you were using RichTextBox control, I would suggest you to convert your RTF or text value to HTML and stick to CrossPlaform Compatibility mode only.

    P.S. You can convert your RTF to HTML at runtime as well. See the following forum case: RTFToHTML

    I hope it helps!

  • Posted 26 December 2023, 1:09 pm EST

    I still maintain that there’s a defect. I set the mode to GDI, I should get GDI. We wasted a lot of time, thinking that GDI meant GDI.

    You could fix this by changing the dropdown in the designer to have three choices:

    • GDI
    • CrossPlatform
    • Default For Platform
  • Posted 26 December 2023, 4:12 pm EST

    Hi Leo,

    In ActiveReports 15, a new mode known as Cross-Platform Compatibility Mode was introduced. This mode enables users to deploy reports in a Linux environment and is compatible with .NET Core. Whereas, before ActiveReports 15, only GDI Compatibility Mode existed, which neither supported cross-platform deployment nor supported .NET Core.

    If your application is targeting .NET Core, the Cross-Platform compatibility mode will only be supported, as in .NET Core, the reports run with compatibility mode set to Cross-Platform only.

    Also, note that in GDI compatibility mode, most libraries are related to System.Drawing dlls that are not supported by Microsoft in .NET Core anymore as a part of their breaking changes. Due to this, GDI compatibility mode is not supported with .NET Core in ActiveReports either.

    You may also refer to the attached Microsoft Breaking Change documentation: https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only

    Hope this helps!

  • Posted 30 December 2023, 9:01 am EST

    “If your application is targeting .NET Core, the Cross-Platform compatibility mode will only be supported, as in .NET Core, the reports run with compatibility mode set to Cross-Platform only.”

    This is correct only insofar as it describes the behavior of the designer.

    When we directly insert

    this.CompatibilityMode = GrapeCity.ActiveReports.Document.CompatibilityModes.GDI

    into our report code, the rich text controls run correctly in .net core (.net v6), on Windows. This change addressed our urgent need to change dozens of reports.

    My main point is that the designer does not let us insert this line into the report. We have to do it manually, and not knowing this delayed our progress to this solution

  • Posted 1 January 2024, 9:11 pm EST

    Hi Leo,

    You may manually add the following code to set the CompatibilityMode to GDI in .NET Core in ActiveReports 16:

    SectionReport1 rpt = new SectionReport1();
    rpt.CompatibilityMode = GrapeCity.ActiveReports.Document.CompatibilityModes.GDI;
    

    Although this code will not help in the latest version, i.e., ActiveReports 17, as the GDI Compatibility Mode is not supported with .NET Core in the latest version.

    Attachment:CompatibilityModesSample.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels