GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureOfficeTemplater Class / SaveToFile Method
The path to the file where the processed template will be saved.
Example





In This Topic
SaveToFile Method (GdPictureOfficeTemplater)
In This Topic
Saves the processed template to a file.
Syntax
'Declaration
 
Public Function SaveToFile( _
   ByVal outputFile As String _
) As GdPictureStatus
public GdPictureStatus SaveToFile( 
   string outputFile
)
public function SaveToFile( 
    outputFile: String
): GdPictureStatus; 
public function SaveToFile( 
   outputFile : String
) : GdPictureStatus;
public: GdPictureStatus SaveToFile( 
   string* outputFile
) 
public:
GdPictureStatus SaveToFile( 
   String^ outputFile
) 

Parameters

outputFile
The path to the file where the processed template will be saved.

Return Value

The GdPictureStatus of the operation.
Example
Save output file
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)
        {
            status = templater.SaveToFile("output.docx");
            Console.WriteLine("Save status: " + status);
        }
    }
}
Console.WriteLine("Last status: " + templater.GetStat() + Environment.NewLine);
See Also