ASP.NET Reference: WordTemplate Object Open SetCultureInfo SetDataSource GetVersion Process Save
ASP Reference: WordTemplate Object Open SetCultureInfo SetDataSource GetVersion Process Save

ASP.NET Programmer's Reference

WordTemplate.Save Method


Save(strFilePath)
Saves the generated Word file on the server.
Save(oStreamObj)
Writes the generated Word file to the specified System.IO.Stream, or a class derived from System.IO.Stream (for example, System.IO.FileStream).
Save(response)
Streams the generated Word file to the client.
Save(response, attachmentName, OpenInBrowser)
Streams the generated Word file to the client.

Save(FileName)

C# Syntax:
public void WordTemplate.Save(string strFilePath);
VB.NET Syntax:
Public Sub WordTemplate.Save(strFilePath As String)
Description:

Saves the generated Word file on the server.

Parameters:
  • strFilePath
    Specifies a complete path and file name for the generated file. WordWriter will save the file to this location. If a file with the same name exists, it will be overwritten by the new Word file.

Exceptions:

Top


Save(oStreamObj)

C# Syntax:
public void WordTemplate.Save(System.IO.Stream oStreamObj);
VB.NET Syntax:
Public Sub WordTemplate.Save(oStreamObj As System.IO.Stream)
Description:

Sends the generated Word binary file to the specified System.IO.Stream or, a class derived from System.IO.Stream (for example, System.IO.FileStream). If you pass Save a System.IO.FileStream, WordWriter will save the generated file on the server. If you pass Save Response.OutputStream, WordWriter will stream the the generated file to the client.

Parameters:
  • oStreamObj
    A System.IO.Stream object (for example, Response.OutputStream) or, a class derived from System.IO.Stream (for example, System.IO.FileStream)
Exception:
Example:
	[VB.NET]
	'--- Open a FileStream object, pass it to 
	'--- the Save method, and close the FileStream object.
	'--- oFileStream = New FileStream(Server.MapPath("./StreamOutput.doc"), FileMode.Create)
	'--- ...
	'--- oWW.Save(oFileStream)
	'--- ...
	'--- If Not oFileStream Is Nothing Then
	'--- 	oFileStream.Close()
	'--- End If

Top


Save(response)

C# Syntax:
public void WordTemplate.Save(System.Web.HttpResponse response);
VB.NET Syntax:
Public Sub WordTemplate.Save(response As System.Web.HttpResponse)
Description:

If you pass Save an 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.

Parameter:
  • response
    The page's HttpResponse object.
Exception:
Example:
	[VB.NET]
	...
	oWW = New WordTemplate()
	oWW.Open(Server.MapPath("./StringVarTemplate.doc"))
	oWW.SetDataSource(arrValue, arrName)
	oWW.Process()
	oWW.Save(Page.Response

Top


Save(response, attachmentName, openInBrowser)

C# Syntax:
public void WordTemplate.Save(System.Web.HttpResponse response,_
         string attachmentName,_
         bool openInBrowser);
VB.NET Syntax:
Public Sub WordTemplate.Save(response As System.Web.HttpResponse,_
         attachmentName As String,_
         OpenInBrowser As Boolean)
Description:

If you pass Save an HttpServletResponse object, WordWriter will stream the generated file to the client. This method allows you to specify a default client-side file name, and whether the file should be opened in the browser window or in Microsoft Word.

Parameters:
  • response
    The HttpResponse instance of the page.
  • attachmentName
    Specifies a name for the generated Word file; this name will be displayed in the download dialog when the file is streamed to the browser.
  • openInBrowser
    If openInBrowser is set to true, and the user chooses to open the file, the file will open in the browser window. If openInBrowser is set to false, and the user chooses to open the file, the file will open in Microsoft Word. By default, the file will open in the browser window. Note: not all browsers can embed a Word file in the browser window.
Exception:
Examples:
  • Stream to the client and open in MS Word

    When you pass an HttpResponse object to Save, WordWriter will stream the generated Word file to the client. The browser will display a File Download dialog asking the user to open or save the file. The method's second parameter specifies a file name to display in the File Download dialog. If the method's third parameter - OpenInBrowser - is False and the user chooses to open the Word file, the file will open in Microsoft Word.

    	[VB.NET]
    	oWW.Save(Page.Response, "StringVarOutput.doc", False)
  • Stream to the client and open in the browser window

    When you pass an HttpResponse object to Save, WordWriter will stream the generated Word file to the client. The browser will display a File Download dialog asking the user to open or save the file. The method's second parameter specifies a file name to display in the File Download dialog. If the method's third parameter - OpenInBrowser - is True and the user chooses to open the Word file, the file will open in the browser window.

    	[VB.NET]
    	oWW.Save(Page.Response, "StringVarOutput.doc", True)

Top

ASP.NET Reference: WordTemplate Object Open SetCultureInfo SetDataSource GetVersion Process Save
ASP Reference: WordTemplate Object Open SetCultureInfo SetDataSource GetVersion Process Save


Copyright © 2003, SoftArtisans, Inc.