Hi all,
I'm trying to import a word document as template, and change some text from this document with RadWordsProcessing in order to fill this document automatically.
In order to do that, I assume I must import the document as a RadFlowDocument and then change some text with the Replace method and finally export the modified document. But, when I import the word document and export it without any change, all text in text boxes or in shapes has disappeared. Is there any step or any configuration I missed?
Here is my code :
RadFlowDocument document;
DocxFormatProvider provider = new DocxFormatProvider();
using (Stream input = File.OpenRead(myTemplateFilePath)
{
document = provider.Import(input);
}
//Change my text here with replace method
//RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
//editor.ReplaceText("oldText", "newText");
IFormatProvider<RadFlowDocument> formatProvider = new DocxFormatProvider();
using (FileStream stream = File.OpenWrite(myResultFilePath))
{
formatProvider.Export(document, stream);
}
Console.WriteLine("Document generated.");
Pictures of my template file and my result file are attached here.
Thank you in advance for your help,
Regards,
Adrian