c#a带有umlaut错误字体openxml

c#a带有umlaut错误字体openxml,c#,openxml,C#,Openxml,我在使用openxml时遇到了字符umlauts的问题。字符串中的每个字符都是Arial,但ä是Calibri。我真的不知道为什么 有人能帮我吗 这是我的代码: DocumentFormat.OpenXml.Wordprocessing.Run run = new DocumentFormat.OpenXml.Wordprocessing.Run(); RunProperties runProp = new RunProperties(); // Create

我在使用openxml时遇到了字符umlauts的问题。字符串中的每个字符都是Arial,但ä是Calibri。我真的不知道为什么

有人能帮我吗

这是我的代码:

        DocumentFormat.OpenXml.Wordprocessing.Run run = new DocumentFormat.OpenXml.Wordprocessing.Run();

        RunProperties runProp = new RunProperties(); // Create run properties.
        RunFonts runFont = new RunFonts();           // Create font
        runFont.Ascii = "Arial";                     // Specify font family

        runProp.Append(runFont);

        run.Append(runProp);
        run.Append(new Text("Kapazität"));

您需要指定
RunFonts
对象的
HighAnsi
属性

runFont.HighAnsi = "Arial";

正如您所期望的,Ascii字体指定仅用于Ascii字符(以及非常短的Unicode U+0000-U+007F范围)。umlaut字符在“扩展”unicode范围内,HighAnsi负责大部分字符集。

Awesome!非常感谢你。