使用C#VSTO在PowerPoing中设置透视阴影 [英] Setting perspective shadow in PowerPoing using C# VSTO

查看:64
本文介绍了使用C#VSTO在PowerPoing中设置透视阴影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我正在尝试使用VSTO C#为文本设置透视阴影,但我无法这样做。我试着设置文本的msoTristate属性如下:


shape.TextFrame.TextRange.Paragraphs [j] .Font.Shadow


这套只有一种阴影。


我也尝试设置ShadowFormat属性,如下所示:


shape.TextFrame2.TextRange.Paragraphs [ j] .Font.Shadow.Blur //工作正常


shape.TextFrame2.TextRange.Paragraphs [j] .Font.Shadow.Type //抛出异常


我只能获得一种阴影,但我正试图获得透视阴影。请帮忙。在此先感谢。

解决方案


要设置透视阴影,您可以使用:


< pre class ="prettyprint"> Microsoft.Office.Interop.PowerPoint.Shape sp = Globals.ThisAddIn.Application.ActivePresentation.Slides [1] .Shapes [1];
//设置形状阴影
sp.Shadow.Type = Microsoft.Office.Core.MsoShadowType.msoShadow39;
Microsoft.Office.Interop.PowerPoint.TextFrame2 tf2 = sp.TextFrame2;
Microsoft.Office.Core.TextRange2 trg2 = tf2.TextRange;
var ch = trg2.Characters;
//设置文本阴影
ch.Font.Shadow.Type = Microsoft.Office.Core.MsoShadowType.msoShadow39;


对于MsoShadowType,您可以访问
MsoShadowType枚举


请参阅图片,数字代表每个透视阴影的阴影类型。



Hello,

I am trying to set perspective shadows for text using VSTO C# and am unable to do so. I tried to set msoTristate property of the text as below:

shape.TextFrame.TextRange.Paragraphs[j].Font.Shadow

This sets up only one kind of a shadow.

I also tried to set the ShadowFormat properties as shown below:

shape.TextFrame2.TextRange.Paragraphs[j].Font.Shadow.Blur //works fine

shape.TextFrame2.TextRange.Paragraphs[j].Font.Shadow.Type //throws an exception

I am able to get only one kind of shadow but am trying to get perspective shadows. Please help. Thanks in advance.

解决方案

Hi,

To set perspective shadow, you could use like:

             Microsoft.Office.Interop.PowerPoint.Shape sp= Globals.ThisAddIn.Application.ActivePresentation.Slides[1].Shapes[1];
            //set the shape shadow
             sp.Shadow.Type = Microsoft.Office.Core.MsoShadowType.msoShadow39;
             Microsoft.Office.Interop.PowerPoint.TextFrame2 tf2 = sp.TextFrame2;
             Microsoft.Office.Core.TextRange2 trg2 = tf2.TextRange;
             var ch = trg2.Characters;
            //set the text shadow
             ch.Font.Shadow.Type = Microsoft.Office.Core.MsoShadowType.msoShadow39;

And for MsoShadowType you could visit MsoShadowType Enumeration.

Please see the picture, the number represents the shadow type of each perspective shadow.


这篇关于使用C#VSTO在PowerPoing中设置透视阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆