Malt.Reporting.OpenDocument.OdfTemplate.Load C# (CSharp) 메소드

Load() 공개 메소드

public Load ( Stream inStream ) : void
inStream Stream
리턴 void
        public override void Load(Stream inStream)
        {
            if (inStream == null)
            {
                throw new ArgumentNullException("inStream");
            }

            this.entries.Clear();

            //把 zip 的内容加载到内存
            using (var zf = ZipFile.Read(inStream))
            {
                foreach (ZipEntry ze in zf)
                {
                    using (var ws = this.GetEntryOutputStream(ze.FileName))
                    {
                        ze.Extract(ws);
                    }
                }
            }
        }

Usage Example

예제 #1
0
 /// <summary>
 /// 一部执行模板编译、渲染并返回结果
 /// </summary>
 /// <param name="odfPath"></param>
 /// <returns></returns>
 public static OdfTemplate RenderTemplate(string odfPath, IDictionary<string, object> context)
 {
     var odf = new OdfTemplate();
     odf.Load(odfPath);
     odf.Compile();
     var resultDoc = odf.Render(context);
     return resultDoc as OdfTemplate;
 }