public override IDocument Render(IDictionary<string, object> context) { Debug.Assert(this.engine != null); if (context == null) { throw new ArgumentNullException("context"); } var resultDoc = new OdfTemplate(); this.CopyTo(resultDoc); var userImages = new Dictionary<Image, string>(); this.ResetTextEngine(userImages, resultDoc); using (var inStream = this.GetEntryInputStream(this.MainContentEntryPath)) using (var reader = new StreamReader(inStream, Encoding.UTF8)) using (var ws = resultDoc.GetEntryOutputStream(resultDoc.MainContentEntryPath)) using (var writer = new StreamWriter(ws)) { this.engine.Evaluate(context, reader, writer); } return resultDoc; }