2016 theme have default font

Posted by: moridi on 12 November 2019, 8:14 am EST

    • Post Options:
    • Link

    Posted 12 November 2019, 8:14 am EST

    Hi, in themes like office2016 white or … have default font set, please set the font to null

  • Posted 12 November 2019, 5:41 pm EST

    Hello,

    It is the designed behavior because some font value should be assigned to display the content in the application on which theme is being applied.

    You can change the default font value as per your need. To change the font go to the following option in the C1ThemDesigner application :

    → BaseThemeProperties → DefaultFont

    Regards,

    Prabhat Sharma.

  • Posted 12 November 2019, 5:55 pm EST

    Hi,

    I know that, if I changed the theme by ThemeDesigner, I must copy beside my application and if you fixed some bugs in that Theme I must doit all times.

    If add some feature in theme manager that updates some properties for themes it’s very useful.

    like

    
    SetThemeProperties("ThemeName","PropName","Value")
    
    

    I change all fonts for all themes at the start of application and users see apps with correct fonts or correct ribbon images.

  • Posted 12 November 2019, 9:57 pm EST

    Hello,

    We have forwarded this to the developers. We will let you know once we get any updates on this from their end.

    [Internal Tracking Id : 406383]

    Regards,

    Prabhat Sharma.

  • Posted 16 April 2020, 4:39 am EST

    Hi, any progress?

  • Posted 16 April 2020, 10:08 pm EST

    Hi,

    As per the developers, you can change the font for the specified theme for the whole application in this way

    1. Add this method.

    ///



    /// Changes the font for the specified theme for the whole application.

    ///


    /// Specified theme name.

    /// Font property path.

    /// New font value

    /// ‘True’ if the property is changed successfully. ‘False’

    /// if the specified theme or font at the specified path are not found.

    private bool SetFontProperty(string themeName, string propPath, Font font)

    {

    // Get theme by name.

    var theme = C1ThemeController.GetThemeByName(themeName, false);

    if (theme != null)

    {

    // Get the font property at the specified path.

    var prop = theme.Children.GetItemByPath(propPath) as FontProp;

    if (prop != null)

    {

    if (font != null)

    {

    // merge property with the specified font

    prop.FontName.Value = font.FontFamily.Name;

    prop.Size.Value = font.Size;

    prop.Bold.Value = font.Bold;

    prop.Italic.Value = font.Italic;

    prop.Strikeout.Value = font.Strikeout;

    prop.Underline.Value = font.Underline;

    }

    else

    {

    // make font node empty (null)

    prop.MakeEmpty();

    }

    return true;

    }

    }

    return false;

    }

    2) Or use this generic method, in case the you only need to reset the property. It is suitable for any type of property.
    
        /// <summary>
        /// Reset the property value for the specified theme for the whole application.
        /// </summary>
        /// <param name="themeName">Specified theme name.</param>
        /// <param name="propPath">Property path.</param>
        /// <returns>True' if the property is changed successfully. 'False' 
        /// if the specified theme or property at the specified path are not found.</returns>
        private bool ResetProperty(string themeName, string propPath)
        {
            // Get theme by name. 
            var theme = C1ThemeController.GetThemeByName(themeName, false);
            if (theme != null)
            {
                // Get the property at the specified path.
                var prop = theme.Children.GetItemByPath(propPath);
                if (prop != null)
                {
                    // make property empty (null)
                    prop.MakeEmpty();
                    return true;
                }
            }
            return false;
        }
    
    3) Call this method at the beginning of the application before applying themes, for example:
    
     SetFontProperty("Office2016Colorful", "BaseThemeProperties\\DefaultFont", SystemFonts.DefaultFont); // to set a new value or reset the property
          OR
       ResetProperty("Office2016Colorful", "BaseThemeProperties\\DefaultFont"); // to reset the property (set to null)
    
    Similarly, you can create methods for other desired properties.
    In case if you have any queries then please let us know.
    
    Regards,
    Prabhat Sharma.
  • Posted 8 July 2021, 11:36 pm EST

    This worked only partially for me with “Office2016Green”: the C1FlexGrid still had a custom font.

    It seems this is a bug in the “Office2016Green” theme: The C1FlexGrid “Normal” style has a custom font “Calibri 11.25” (see screenshot). All other “Office2016…” themes don’t have this font, so I consider it a bug. C1, could you check it?

    If it is intended: the code to reset the font is this:

    
    ResetProperty("Office2016Green", "BaseThemeProperties\\DefaultFont");
    ResetProperty("Office2016Green", "C1FlexGrid\\Styles\\Normal\\Font");
    
    

    Best regards

    Wolfgang

  • Posted 11 July 2021, 10:07 pm EST

    Hello Wolfgang,

    We too can observe the difference at our end and escalated this to the developers.

    We will let you know as soon as we get any update on this from the devs’ end.

    [Internal Tracking ID: C1WIN-25239]

    Regards,

    Prabhat Sharma.

  • Posted 12 July 2021, 7:37 pm EST

    Small update: “Office2016Green” defines a font not only in “C1FlexGrid\Styles\Normal”, but also in “C1FlexGrid\Styles\Fixed”.

  • Posted 13 July 2021, 2:40 pm EST

    Hello Wolfgang,

    Thanks for the update. We will pass it to the devs.

    Regards,

    Prabhat Sharma.

  • Posted 26 July 2021, 8:23 pm EST

    Hello Wolfgang,

    As per the developers, this is not a bug. As he remembers Office2016Green was created specifically for the FlexGrid from the request to make a one-to-one theme like MS Excel.

    And the font of the cell data in MS Excel is “Calibre 11” by default, while the font of the other Excel UI (Ribbon, Input etc.) is more similar to “Segoe UI 9”.

    Therefore, there is such a difference compared to other themes.

    Regards,

    Prabhat Sharma.

  • Posted 8 August 2021, 7:26 pm EST

    Hi Prabhat,

    sorry for the delay, I was on vacation.

    I understand your argument, but it is confusing that this is the only Office2016… theme with this behaviour.

    Anyway, I have a workaround, so it is no issue for me.

    Best regards

    Wolfgang

Need extra support?

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

Learn More

Forum Channels