GetEntryOutputStream() 공개 메소드

千万要记得关闭
public GetEntryOutputStream ( string entryPath ) : Stream
entryPath string
리턴 Stream
예제 #1
0
        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;
        }