Page tree

Versions Compared

Key

  • 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
{description}
{excerpt}If you pass [Save|WordTemplate.Save] an {msdn:System.Web.HttpResponse|HttpResponse} object object, WordWriter will stream the generated file to the client. If the user chooses to open \(rather than save\) the file, it will open in the browser window.{excerpt}
{signature:C#}
 public void Save(System.Web.HttpResponse response)
{signature}{signature:vb.net}
Public Sub Save(ByVal response As System.Web.HttpResponse)
{signature}

{parameters}
{param:response}The page's {{HttpResponse}} object.{param}

{exceptions}
{exception:ArgumentNullException}{{Save}} will throw this exception if {{null}} \(C\#\) or {{Nothing}} \(VB.NET\) is passed to the method.{exception}

{remarks}You can call {{Save}} more than once for a single instance of [WordTemplate]. This allows you to save more than one copy of a generated file, and/or both save the file on the server and stream it to the client. 
{remarks}

{example}{code:csharp|title=C#}

          ...
          WordTemplate oWW = new WordTemplate();
          oWW.Open(Server.MapPath(@"./StringVarTemplate.doc"));
          oWW.SetDataSource(MyDataTable);
          oWW.Process();
          oWW.Save(Page.Response);
        {code}
{code:vb.net|title=vb.net}

          ...
          Dim oWW As New WordTemplate()
          oWW.Open(Server.MapPath("./StringVarTemplate.doc"))
          oWW.SetDataSource(MyDataTable)
          oWW.Process()
          oWW.Save(Page.Response)
        {code}

{example}