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);