Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
{excerpt}The [CultureInfo|WordTemplate.CultureInfo] property allows you to override the server's default locale when generating a new Word file.  For example, to generate a US English document on a French operating system, you could use {{CultureInfo}} to set the Word file's {msdn:System.Globalization.CultureInfo} to US English.{excerpt}
 public System.Globalization.CultureInfo CultureInfo{ set; }
Public WriteOnly Property CultureInfo() As System.Globalization.CultureInfo
{remarks}Set {{CultureInfo}} to a {msdn:System.Globalization.CultureInfo|System.Globalization.CultureInfo} object. This object represents information about a culture including its alphabet, calendar, and date formats. When setting {{CultureInfo}}, import the {msdn:System.Globalization|System.Globalization} namespace to the ASP.NET page, for example, to import the namespace to a code\-behind page, use:
{code:csharp|title=C#}using System.Globalization;{code}
Imports System.Globalization{code}

{{CultureInfo}} must include both language and country \(for example "fr\-BE" for French\-Belgium\).

See {msdn:System.Globalization.CultureInfo|System.Globalization.CultureInfo} for more information about the class, its members, and a list of CultureInfo codes.

          using System.Globalization;
          string[] NamesArr = {"Name", "Company", "DateTime"};
          object[] ValuesArr = {Name, Company, DateTime.Now};
          WordTemplate WordTempl = new WordTemplate();

          //--- Create a new CultureInfo object and
          //--- set WordTemplate's CultureInfo property
          CultureInfo enUS = new CultureInfo("en-US");
          WordTempl.CultureInfo = enUS;
          WordTempl.SetDataSource(ValuesArr, NamesArr);
          WordTempl.Save(Page.Response, "BasicGenerated.doc", false);
          Imports System.Globalization
          Dim NamesArr As String() = {"Name", "Company", "DateTime"}
          Dim ValuesArr As Object() = {Name, Company, DateTime.Now}
          Dim WordTempl As New WordTemplate()

          '--- Create a new CultureInfo object and
          '--- set WordTemplate's CultureInfo property
          Dim enUS As New CultureInfo("en-US")
          WordTempl.CultureInfo = enUS
          WordTempl.SetDataSource(ValuesArr, NamesArr)
          WordTempl.Save(Page.Response, "BasicGenerated.doc", False)