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}Streams a [Document|Document] to an HttpResponse with the option of having it open in the user's web browser. The fileName specified will appear in the browser window. In addition, the content\-type to use when streaming the file is specified.{excerpt}
{signature:C#}
 public void Save(Document doc, System.Web.HttpResponse response, System.String fileName, boolean openInBrowser, System.String contentType)
{signature}{signature:vb.net}
Public Sub Save(ByVal doc As Document, ByVal response As System.Web.HttpResponse, ByVal fileName As String, ByVal openInBrowser As Boolean, ByVal contentType As String)
{signature}
{parameters}
{param:doc}The {{Document}} to save.{param}
{param:response}The HTTPResponse to write the document to.{param}
{param:fileName}The filename to display in the browser window.{param}
{param:openInBrowser}Whether to open the document in the browser window \(true\) or have it open in Word \(false\).{param}
{param:contentType}The content\-type to stream the file as.{param}
{exceptions}
{exception:System.Exception}Thrown if there is an error streaming the document.{exception}
{remarks}For the document to open in the browser window, the "Browse in same window" option must be enabled for .doc file types on the client machine.

The [WordApplication.Preserve|WordApplication.Preserve] property is used to specify the way WordWriter will save the document. When the {{preserve}} property is set to true, WordWriter attempts to preserve all formatting and features that it doesn't directly support. This includes Fields, Footnotes, Hyperlinks, Comments, and Anchored Images. When the {{preserve}} property is false, only those features directly supported by WordWriter will be preserved. This includes all Tables, Lists, Headers and Footers.

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

          app.Preserve = true;
          app.Save(doc, Page.Response, "sample.doc", false, "application/x-msdownload");
        {code}
{code:vb.net|title=vb.net}

          app.Preserve = True
          app.Save(doc, Page.Response, "sample.doc", False, "application/x-msdownload")
        {code}

{example}