Пример #1
0
 public void CanCompileOdtDocumentTemplate()
 {
     using (var stream = DocumentTestHelper.GetResource(Template1OdtName))
     {
         var odt      = OdfDocument.LoadFrom(stream);
         var template = new OdtTemplate(odt);
     }
 }
Пример #2
0
 public SimpleObject()
 {
     using (var resStream = DocumentTestHelper.GetResource(PngImagePath))
     {
         var buf = new byte[resStream.Length];
         resStream.Read(buf, 0, buf.Length);
         this.JpegImage = new ImageBlob("jpg", buf);
     }
 }
Пример #3
0
        public void CanRenderOdt3Template()
        {
            OdfTemplate template;

            using (var stream = DocumentTestHelper.GetResource(Template3OdtName))
            {
                var odt = OdfDocument.LoadFrom(stream);
                template = new OdtTemplate(odt);
            }

            var dataSet = new TestingDataSet();
            var values  = new Dictionary <string, object>()
            {
                { "table1", dataSet.Table1 },
                { "so", dataSet.SimpleObject },
            };
            var context = new TemplateContext(values);

            var result = template.Render(context);

            result.Save(Path.Combine(this.TempPath, "odt-out.odt"));
        }
Пример #4
0
        public void CanRenderWordMLTemplate()
        {
            WordMLTemplate template;

            using (var stream = DocumentTestHelper.GetResource(Template1OdtName))
            {
                var templateDocument = WordMLDocument.LoadFrom(stream);
                template = new WordMLTemplate(templateDocument);
            }

            var dataSet = new TestingDataSet();
            var values  = new Dictionary <string, object>()
            {
                { "table1", dataSet.Table1 },
                { "so", dataSet.SimpleObject },
            };
            var context = new TemplateContext(values);

            var result = template.Render(context);

            result.Save(Path.Combine(this.TempPath, "wordml-out.doc.xml"));
        }