Пример #1
0
        /// <summary>
        /// Export shape as picture
        /// </summary>
        /// <param name="path"></param>
        private void ExportAs(IDictionary <string, object> parameters)
        {
            string path   = (string)parameters["path"];
            string type   = "png";
            float  heigth = 542;
            float  width  = 722;
            float  scale  = 2;

            object tmp;

            PowerPoint.Enums.PpShapeFormat ppShapeFormat = PowerPoint.Enums.PpShapeFormat.ppShapeFormatPNG;

            if (parameters.TryGetValue("type", out tmp))
            {
                type = (string)tmp;
            }
            if (parameters.TryGetValue("heigth", out tmp))
            {
                heigth = (float)tmp;
            }
            if (parameters.TryGetValue("width", out tmp))
            {
                width = (float)tmp;
            }
            if (parameters.TryGetValue("scale", out tmp))
            {
                scale = (float)tmp;
            }
            //couse
            switch (type.ToLower())
            {
            case "png":
                ppShapeFormat = PowerPoint.Enums.PpShapeFormat.ppShapeFormatPNG;
                break;

            case "wmf":
                ppShapeFormat = PowerPoint.Enums.PpShapeFormat.ppShapeFormatWMF;
                break;

            case "bmp":
                ppShapeFormat = PowerPoint.Enums.PpShapeFormat.ppShapeFormatBMP;
                break;

            case "gif":
                ppShapeFormat = PowerPoint.Enums.PpShapeFormat.ppShapeFormatGIF;
                break;

            case "jpg":
                ppShapeFormat = PowerPoint.Enums.PpShapeFormat.ppShapeFormatJPG;
                break;

            default:
                ppShapeFormat = PowerPoint.Enums.PpShapeFormat.ppShapeFormatPNG;
                break;
            }
            this.shape.Export(path, ppShapeFormat, width * scale, heigth * scale, PowerPoint.Enums.PpExportMode.ppRelativeToSlide);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="path"></param>
        public void ExportAs(string path, string type)
        {
            PowerPoint.Enums.PpShapeFormat ppShapeFormat = PowerPoint.Enums.PpShapeFormat.ppShapeFormatPNG;
            switch (type.ToLower())
            {
            case "png":
                ppShapeFormat = PowerPoint.Enums.PpShapeFormat.ppShapeFormatPNG;
                break;

            default:
                ppShapeFormat = PowerPoint.Enums.PpShapeFormat.ppShapeFormatPNG;
                break;
            }
            this.shape.Export(path, ppShapeFormat, 722 * 3, 542 * 3, PowerPoint.Enums.PpExportMode.ppRelativeToSlide);
        }