Ejemplo n.º 1
0
 public void Create_zb1()
 {
     if (dqrw != null)
     {
         Aspose_Crack.SlideCrack();
         DataTable    dt = Dal.CJGL_DataProvider.GET_CJLB_BB(dqrw.mbid);
         Presentation p1 = SlideFactory.GetInstance().ppt;
         p1.Slides.RemoveAt(0);
         Base_date.init_zb(dqrw.nf, dqrw.zc);
         Cache_param_zb.ini_zb(dqrw.mbid, dqrw.nf, dqrw.zc);
         Base_Log.Log("开始任务");
         try
         {
             foreach (DataRow row in dt.Rows)
             {
                 Base_Log.Log("第" + row["cjbh"].ints().ToString() + "号插件");
                 Type       type       = Type.GetType(row["cjclass"].ToString());                                                //
                 var        obj        = System.Activator.CreateInstance(type);                                                  // 创建实例
                 MethodInfo method     = type.GetMethod(row["cjmethod"].ToString(), new Type[] { typeof(string), typeof(int) }); // 获取方法信息
                 object[]   parameters = new object[] { row["cjdz"], row["cjbh"].ints() };
                 var        slide      = method.Invoke(obj, parameters);
                 if (slide != null && ((SlideCollection)slide).Count > 0)
                 {
                     foreach (var item in (SlideCollection)slide)
                     {
                         if (item != null)
                         {
                             p1.Slides.AddClone(item);
                         }
                     }                        // 调用方法,参数为空
                 }
             }
             string path = "E:\\zb\\" + dqrw.mbid + "\\" + dqrw.nf + "\\" + dqrw.zc + "\\";
             if (!Directory.Exists(path))
             {
                 Directory.CreateDirectory(path);
             }
             string filename = path + Base.Base_date.bz + ".pptx";
             p1.Save(filename, Aspose.Slides.Export.SaveFormat.Pptx);
             if (!new Dal.RWGL_DataProvider().SET_RWZT(dqrw.mbid, dqrw.nf, dqrw.zc, RW_ZT.完成可下载, filename))
             {
                 Base_Log.Log("创建文件成功,插入数据失败");
             }
             dqrw.zt = Models.Enums.ZX_ZT.生成完毕;
         }
         catch (Exception e)
         {
             Base_Log.Log("插件生成报错:" + e.Message);
             dqrw.zt = Models.Enums.ZX_ZT.生成完毕;
         }
     }
     else
     {
         Base_Log.Log("没有当前任务");
     }
 }
Ejemplo n.º 2
0
        public string Create_zb(int mbid, int year, int zc)
        {
            Aspose_Crack.SlideCrack();
            DataTable    dt = Dal.CJGL_DataProvider.GET_CJLB_BB(mbid);
            Presentation p1 = SlideFactory.GetInstance().ppt;

            p1.Slides.RemoveAt(0);
            Base_date.init_zb(year, zc);
            Cache_param_zb.ini_zb(mbid, year, zc);
            Base_Log.Log("开始任务");
            try
            {
                foreach (DataRow row in dt.Rows)
                {
                    Base_Log.Log("第" + row["cjbh"].ints().ToString() + "号插件");
                    Type       type       = Type.GetType(row["cjclass"].ToString());                                                //
                    var        obj        = System.Activator.CreateInstance(type);                                                  // 创建实例
                    MethodInfo method     = type.GetMethod(row["cjmethod"].ToString(), new Type[] { typeof(string), typeof(int) }); // 获取方法信息
                    object[]   parameters = new object[] { row["cjdz"], row["cjbh"].ints() };
                    var        slide      = method.Invoke(obj, parameters);
                    if (slide != null && ((SlideCollection)slide).Count > 0)
                    {
                        foreach (var item in (SlideCollection)slide)
                        {
                            if (item != null)
                            {
                                p1.Slides.AddClone(item);
                            }
                        }                        // 调用方法,参数为空
                    }
                }
                string path = "E:\\zb\\" + mbid + "\\" + year + "\\" + zc + "\\";
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                string filename = path + Base.Base_date.bz + ".pptx";
                p1.Save(filename, Aspose.Slides.Export.SaveFormat.Pptx);
                return(filename);
            }
            catch (Exception e)
            {
                Base_Log.Log("插件生成报错:" + e.Message);
            }
            return(null);
        }