Unplanned
Last Updated: 14 Feb 2018 07:10 by Dan
Dan
Created on: 27 Apr 2017 12:47
Type: Feature Request
6
Private fonts configuration / Telerik configuration
The telerik configuration has to be provided by app.config / web.config. (http://docs.telerik.com/reporting/configuring-telerik-reporting) 
In a huge solution this makes it necessarry to define the same settings multiple times. (app.config for UnitTests, web.config for WebFrontend, app.config for Workers.) I prefer to implement configuration just once programaticaly. 

Please provide a public interface for configuration so that we can inject configuration from commandline / azure / configfiles / ...

For private fonts the feature is implemented but all methods are marked private. so I have to call this things by reflection:

            //<?xml version="1.0" encoding="utf-8"?>
            //<configuration>
            //  <configSections>
            //    <section name="Telerik.Reporting" type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting, Version=11.0.17.406, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" />
            //  </configSections>
            //  <Telerik.Reporting>
            //    <privateFonts>
            //      <add fontFamily="Poppins Medium" path="c:\poppins\Poppins-Medium.ttf" />
            //      <add fontFamily="Poppins Light" path="c:\poppins\Poppins-Light.ttf" />
            //      <add fontFamily="Poppins SemiBold" path="c:\poppins\Poppins-SemiBold.ttf" />
            //    </privateFonts>
            //  </Telerik.Reporting>
            //</configuration>

            var fontContainerType = typeof(Telerik.Reporting.DataSource).Assembly.GetType("Telerik.Reporting.Processing.Common.FontContainer");
            var fontContainer = fontContainerType.GetField("Instance", BindingFlags.Public | BindingFlags.Static).GetValue(null);

            var methodAdd = fontContainer.GetType().GetMethod("AddFont", BindingFlags.NonPublic | BindingFlags.Instance);
            methodAdd.Invoke(fontContainer, new object[] {"c:\\poppins\\Poppins-Medium.ttf", "Poppins Medium", "regular"});
            methodAdd.Invoke(fontContainer, new object[] {"c:\\poppins\\Poppins-Light.ttf", "Poppins Light", "regular"});
            methodAdd.Invoke(fontContainer, new object[] {"c:\\poppins\\Poppins-SemiBold.ttf", "Poppins SemiBold", "regular"});
0 comments