Bug Report T462245
Visible to All Users

ArgumentException when initializing SpreadsheetFormulaBarControl if the "Calibri" font is not installed in the system

created 8 years ago (modified 8 years ago)

We have some xp systems that will throw this exception. But we install these fonts into this operation, then will fix it. please help us how to fix it by code.thanks.

Font Code:
calibri.ttf, calibrib.ttf, calibrii.ttf, calibril.ttf, calibrili.ttf, calibriz.ttf

Error Log:
Message: 字体“Calibri”不支持样式“Regular”。
Type: ArgumentException
 Source: System.Drawing
 Occured By: CreateNativeFont
 MemberType: Method
 Occur At:
在 System.Drawing.Font.CreateNativeFont()
在 System.Drawing.Font.Initialize(FontFamily family, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont)
在 System.Drawing.Font.Initialize(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont)
在 System.Drawing.Font…ctor(String familyName, Single emSize)
在 DevExpress.XtraSpreadsheet.FormulaBarCellInplaceEditor.SetEditorOptions()
在 DevExpress.XtraSpreadsheet.FormulaBarCellInplaceEditor…ctor()
在 DevExpress.XtraSpreadsheet.SpreadsheetFormulaBarControl.InitializeComponent()
在 DevExpress.XtraSpreadsheet.SpreadsheetFormulaBarControl…ctor()
Source Codes:
            //
            // spreadsheetFormulaBarControl1
            //
            this.spreadsheetFormulaBarControl1.Appearance.Font = new System.Drawing.Font("Arial Narrow", 8F);
            this.spreadsheetFormulaBarControl1.Appearance.Options.UseFont = true;
            this.spreadsheetFormulaBarControl1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.spreadsheetFormulaBarControl1.Expanded = true;
            this.spreadsheetFormulaBarControl1.Location = new System.Drawing.Point(145, 0);
            this.spreadsheetFormulaBarControl1.MinimumSize = new System.Drawing.Size(0, 20);
            this.spreadsheetFormulaBarControl1.Name = "spreadsheetFormulaBarControl1";
            this.spreadsheetFormulaBarControl1.Size = new System.Drawing.Size(625, 25);
            this.spreadsheetFormulaBarControl1.SpreadsheetControl = this.curSpreadsheetControl;
            this.spreadsheetFormulaBarControl1.TabIndex = 3;

Comments (1)
DevExpress Support Team 8 years ago

    Hi Guocai,

    Thank you for pointing out this issue. I am forwarding it to our developers for further processing. You will receive an automatic message once the status of this ticket is changed.
    In the meantime, I cannot suggest any workaround except for installing missing fonts to the problematic machine.

    Answers approved by DevExpress Support

    created 8 years ago (modified 8 years ago)

    We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

    Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

    Additional information:

    To change the default font used in the SpreadsheetFormulaBarControl, set the RichEditControlCompatibility.DefaultFontName and RichEditControlCompatibility.DefaultFontSize properties before the InitializeComponent method call:

    C#
    DevExpress.XtraRichEdit.RichEditControlCompatibility.DefaultFontName = "Times New Roman"; DevExpress.XtraRichEdit.RichEditControlCompatibility.DefaultFontSize = 12;
      Show previous comments (1)

        Thanks, Let me have a try.

          Still throw exception. Thanks.

          Message: Font 'Calibri' does not support style 'Regular'.
          Type: ArgumentException
          Source: System.Drawing
          Occured By: CreateNativeFont
          MemberType: Method

          DevExpress Support Team 8 years ago

            Hi Guocai,

            We applied required modifications in v15.2.14, which is not yet available. I recommend that you request a hotfix using the corresponding link in the "Solution" section. Once a hotfix is prepared and available, you will get an automatic notification.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.