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

...

Description

Excerpt

Sends the generated Word binary file to the specified

Msdn
System.IO.Stream

...

System.IO.Stream
or,

...

a

...

class

...

derived

...

from

...

System.IO.Stream

...

(for

...

example,

...

Msdn

...

System.IO.FileStream

...

System.IO.FileStream
).

...

Signature
C#
C#
 public void Save(System.IO.Stream outputStream)
{signature}{signature:
}
Signature
vb.net
vb.net
Public Sub Save(ByVal outputStream As System.IO.Stream)
{signature}
{parameters}
{param:oStreamObj}A {{
Parameters
Param
oStreamObj
oStreamObj

A System.IO.Stream

}}

object

\

(for

example,

{{

Response.OutputStream

}}\

)

or,

a

class

derived

from

{{

System.IO.Stream

}} \

(for

example,

{{

System.IO.FileStream

}}\){param} {exceptions} {exception:ArgumentNullException}{{Save}} will throw this exception if {{null}} \(C\#\) or {{Nothing}} \

)

Exceptions
Exception
ArgumentNullException
ArgumentNullException

Save will throw this exception if null (C#) or Nothing (VB.NET

\

)

is

passed

to

the

method.

{exception} {remarks}If you pass [Save|WordTemplate.Save] a {{

Remarks

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.

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#}

Example
Code Block
csharp
csharp
titleC#


          //--- Open a FileStream object, pass it to
          //--- the Save method, and close the FileStream object.
          FileStream oFileStream = new FileStream(@"c:\temp\StreamOutput.doc", FileMode.Create);
          oWW.Save(oFileStream);

          //--- Could put this in a finally block
          if(oFileStream!=null)
               oFileStream.Close();
        
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}


          '--- Open a FileStream  object, pass it to
          '--- the Save method, and close the FileStream object.
          Dim oFileStream As New FileStream("c:\temp\StreamOutput.doc", _
               FileMode.Create)
          oWW.Save(oFileStream)

          '--- Could put this in a finally block
          If Not oFileStream Is Nothing Then
               oFileStream.Close()
          End If
        
{code} {example}