使用 DotNetBrowser 打印时如何更改页眉中的日期格式?

How do I change the date format in the header when printing with DotNetBrowser?

我能找到的唯一本地化描述如下: https://dotnetbrowser.support.teamdev.com/support/solutions/articles/9000110018-chromium-language-localization

DotNetBrowser allows configuring Chromium engine with specified language (two letter code from ISO-639 e.g. "en", "de", "it", etc). The language will be used for UI text messages localization (e.g. text on the web page that's displayed when Chromium failed to load URL).

By default, Chromium engine is configured to use .NET application language that can be received from theCultureInfo.CurrentUICulture.Name property. To configure Chromium engine with .NET application language, DotNetBrowser extracts the language from theCultureInfo.CurrentUICulture.Name property and passes it to Chromium engine via the --lang Chromium switcher.

If you need to change this default behavior, then you can configure Chromium engine directly with specified language via Chromium--lang switcher.

不幸的是,这似乎没有应用任何日期格式(这是有道理的,因为它似乎只关注语言 "en" 而不是语言环境)

当我打印时,每页的页眉都有一个美国格式的日期。我的客户不在美国,给他们提供美国格式的日期将是一场灾难。

有没有办法在 DotNetBrowser / Chromium 中设置日期格式?

在 Chrome 高级设置中,我可以选择新西兰英语和英国英语作为语言,这些设置会影响打印的页眉。

您可以将英国英语语言环境指定为 "en-GB",如下所示:

BrowserPreferences.SetChromiumSwitches("--lang=en-GB");

不要忘记在创建任何浏览器实例之前应设置此切换器。

本文介绍了如何设置 Chromium 切换器:https://sites.google.com/a/teamdev.com/dotnetbrowser-support/documentation/chromium-switches