使用c#将文本效果应用于单词中的文本 [英] Apply text effects to the text in word using c#
本文介绍了使用c#将文本效果应用于单词中的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用c#将反射和发光效果应用于单词2010中的选定文本。在VBA中,我们可以访问字体对象中的属性,而在VSTO中则不可用。请帮助。
I need to apply the Reflection and Glow effect to the selected text in word 2010 using c#. In VBA, we are able to access the properties in the font object, whereas, it is not available in VSTO. kindly help.
推荐答案
您好Vijayathii,
Hi Vijayathii,
根据您的描述,我写了一些样本供您参考。
According to your description, I wrote some sample for your reference.
有两种方法可以将反射效果应用于所选文本。
There are two ways to apply the Reflection effect to the selected text.
private void button1_Click(object sender, EventArgs e)
{
//1.set the Type property, which includes settings for the preset Reflection types
Globals.ThisAddIn.Application.ActiveWindow.Selection.Font.Reflection.Type = Microsoft.Office.Core.MsoReflectionType.msoReflectionType2;
//2.set Reflection properties such as Offset, Blur to get custom effect.
var reflection = Globals.ThisAddIn.Application.ActiveWindow.Selection.Font.Reflection;
reflection.Offset = 2.4f;
reflection.Blur = 0.5f;
reflection.Size = 100;
reflection.Transparency = 0.5f;
}
通过设置属性将Glow效果应用于所选文本。
To apply the Glow effect to the selected text by setting the properties.
private void button2_Click(object sender, EventArgs e)
{
var glow = Globals.ThisAddIn.Application.ActiveWindow.Selection.Font.Glow;
glow.Color.ObjectThemeColor = Microsoft.Office.Interop.Word.WdThemeColorIndex.wdThemeColorAccent1;
glow.Radius = 10;
glow.Transparency = 0.8f;
}
这篇关于使用c#将文本效果应用于单词中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文