#

Word Ribbonbar->WordArt und Line verändern
 
Der folgende C# Code veränder Line Objekte und WordArte Objekte zur Laufzeit in einem Word Dokument.
Die Anwendung läuft über ein Word-VSTO Addin und wird in der Ribbonbar angezeigt.

 
In Visual Studio zur Laufzeit im Debugger ausgewertet

 
 
Kompletter C# Code zum Anpassen der Line und WordArt Elemente.
Diese werden in Word in der Shape Auflistung geführt.
Die Unterscheidung wird mit dem Shape.Type getroffen.

private void set_Glow()
{
//-------< set_Glow() >----------
//*Umrahme alle Bilder mit Frame
//< init >
Word.Document doc = Globals.ThisAddIn.Application.ActiveDocument;
Word.Application app = Globals.ThisAddIn.Application;
//</ init >
 
//--< Shapes >--
for (int iShape = 1; iShape <= doc.Shapes.Count; iShape++)
{
Word.Shape shape = doc.Shapes[iShape];
//----< @Loop: InlineShapes >----
if (shape.Type == Office.MsoShapeType.msoLine)
{
//--< Line >--
shape.Line.ForeColor.RGB = (int)get_Word_Color_RGB(255, 0, 0);
shape.Line.Weight = 1;
shape.Glow.Color.ObjectThemeColor = Word.WdThemeColorIndex.wdThemeColorAccent5;
shape.Glow.Color.RGB = 61695;
shape.Glow.Radius = 8;
shape.Glow.Transparency = 0.6f;
shape.Line.EndArrowheadWidth = Office.MsoArrowheadWidth.msoArrowheadWide;
shape.Line.EndArrowheadLength = Office.MsoArrowheadLength.msoArrowheadLong;
shape.Line.EndArrowheadStyle = Office.MsoArrowheadStyle.msoArrowheadTriangle;
//--</ Line >--
}
if (shape.Type == Office.MsoShapeType.msoTextBox)
{
//--< WordArt >--
Word.Range shapeText = shape.TextFrame.TextRange;
shapeText.Font.Fill.ForeColor.RGB = (int)get_Word_Color_RGB(255, 0, 0);
shapeText.Font.Glow.Color.ObjectThemeColor = Word.WdThemeColorIndex.wdThemeColorAccent5;//2
shapeText.Font.Glow.Color.RGB = 61695;
shapeText.Font.Glow.Radius = 8;
shapeText.Font.Glow.Transparency = 0.6f;
shapeText.Font.TextShadow.Blur = 5;
shapeText.Font.TextShadow.OffsetX = 2;
shapeText.Font.TextShadow.OffsetY = 2;
shapeText.Font.TextShadow.Transparency = 0.5f;
//--</ WordArt >--
}
//'----</ @Loop: InlineShapes >----
//--</ InlineShapes >--
}
 
 
//-------</ set_Glow() >----------
}

 
 
Folgende Namespaces müssen eingebunden werden:

//----< Word Addin >----
using System.IO;
using Microsoft.Office.Tools.Ribbon;
using Word = Microsoft.Office.Interop.Word;
using Office = Microsoft.Office.Core;
using System.Windows.Forms; //OpenfileDialog
using System.Drawing;
using System.Net;
//----</ Word Addin >----

 
Mobile

.

0123movie.net