public string convert(String path, List <String> imgList, String tempPath)
        {
            // init
            ImageInfoUtils utils = new ImageInfoUtils();

            imgList = utils.filter(imgList);
            Size max = utils.listMaxPPTSize(imgList);

            tempPath = String.IsNullOrEmpty(tempPath) ? DEFAULT_TEMPLATE_PATH : tempPath;

            // check
            if (0 == max.Width || 0 == max.Height)
            {
                throw new Exception("The format of resource images is invalid");
            }
            if (!File.Exists(tempPath))
            {
                throw new Exception(String.Format("The pointed PPTX template[{0}] is not exists", tempPath));
            }

            return(convert(path, tempPath, imgList, max));
        }
コード例 #2
0
        public string convert(String path, List <PPTPage> pageList)
        {
            ImageInfoUtils utils   = new ImageInfoUtils();
            List <String>  imgList = new List <string>();

            pageList.ForEach(p =>
            {
                imgList.Add(p.Cover);
            });
            imgList = utils.filter(imgList);
            Size   max         = utils.listMaxPPTSize(imgList);
            String pptTempPath = System.Environment.CurrentDirectory + "\\..\\..\\Template\\template.pptx";

            if (0 == max.Width || 0 == max.Height)
            {
                throw new Exception("image list are all invalid");
            }
            if (!File.Exists(pptTempPath))
            {
                throw new Exception("template file is not exists");
            }

            return(convert(path, pptTempPath, pageList, max));
        }