GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureOfficeTemplater Class / SaveToStream Method
The stream where the processed template will be saved.
Example





In This Topic
SaveToStream Method (GdPictureOfficeTemplater)
In This Topic
Saves the processed template to a stream.
Syntax
'Declaration
 
Public Function SaveToStream( _
   ByVal stream As Stream _
) As GdPictureStatus
public GdPictureStatus SaveToStream( 
   Stream stream
)
public function SaveToStream( 
    stream: Stream
): GdPictureStatus; 
public function SaveToStream( 
   stream : Stream
) : GdPictureStatus;
public: GdPictureStatus SaveToStream( 
   Stream* stream
) 
public:
GdPictureStatus SaveToStream( 
   Stream^ stream
) 

Parameters

stream
The stream where the processed template will be saved.

Return Value

The GdPictureStatus of the operation.
Example
Save output file to stream
using GdPicture14;
            
string inputFile = "output.docx";
            
GdPictureOfficeTemplate template = GdPictureOfficeDefaultTemplateBuilder.CreateTemplate()
    .AddPlaceholderReplacement(placeholder: "placeholder1", replacementValue: "replacementValue 1")
    .AddPlaceholderReplacement(placeholder: "placeholder2", replacementValue: "replacementValue 2");
            
GdPictureOfficeTemplateConfiguration configuration = new GdPictureOfficeTemplateConfiguration
{
    Delimiter = new GdPictureOfficeTemplateDelimiter
    {
        Start = "{{",
        End = "}}"
    }
};
using GdPictureOfficeTemplater templater = new();
            
GdPictureStatus status = templater.SetTemplate(template, configuration);
if (status == GdPictureStatus.OK)
{
    status = templater.LoadFromFile(inputFile);
    if (status == GdPictureStatus.OK)
    {
        status = templater.Process();
        if (status == GdPictureStatus.OK)
        {
            using var outfileFileStream = new FileStream("output.docx", FileMode.OpenOrCreate, FileAccess.Write);
            status = templater.SaveToStream(outfileFileStream);
            Console.WriteLine("Save status: " + status);
        }
    }
}
Console.WriteLine("Last status: " + templater.GetStat() + Environment.NewLine);
See Also