This project is read-only.

Normal font in a different language version of Excel


In another language version of Excel is not a normal font named "Normal".
    /// <summary>
    /// Returns the primary (Normal) font used by this workbook.
    /// </summary>
    /// <returns>A <see cref="FontWrapper"/> that represents the designated Normal font.</returns>
    internal FontWrapper GetNormalFont()
        var cellStyle = CellStyles.CellStyles.Find("Normal");
Perhaps it would be better to search by "FormatId=0".


TimCoulter wrote Jan 5, 2011 at 6:44 PM

It was a long time ago that I developed this particular piece of functionality, but I am usually quite pro-active about localization issues and I seem to recall running a test to confirm that the identifier "Normal" is not culture-specific. However, I may be mistaken. Have you made a test to verify that other cultures use localized identifiers?

If so, I agree with your suggestion. Perhaps you could therefore submit a code sample for the implementation you propose.

Many thanks,

JirkaRizek wrote Jan 5, 2011 at 8:42 PM

I'm from czech and loading templates doesn't work. We have in our version of excel style named "normalni".

I think this should work better:
    internal FontWrapper GetNormalFont()
        var cellStyleFormat = CellStyleFormats.CellFormats[0];

        if (cellStyleFormat != null && cellStyleFormat.FontId.HasValue)
            return Fonts.Fonts[(int)cellStyleFormat.FontId.Value];

        throw new PackageException("The template does not contain a resolvable Normal font.");
Very nice project.


TimCoulter wrote Jan 5, 2011 at 9:38 PM

Many thanks for your investigative work and your code sample Jirka.

I will integrate it into the codebase and release it here within the next few days.


wrote Feb 14, 2013 at 3:16 AM