CodeDocu.com

Word Ribbonbar-> change WordArt and line
 
The following c# code changes line objects and WordArte objects in a Word document at run time.
The application runs on a word VSTO AddIn and appears in the Ribbonbar.
Word Ribbonbar Addin: change WordArt and lines
 
Evaluated in Visual Studio at run time in the debugger
Word Ribbonbar Addin: change WordArt and lines
 
 
Complete c# code to customize the line and WordArt items:
These objects run in Microsoft Word under the shape collection.
The distinction is made with the Shape.Type.

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() >----------
}

 
 
Following namespaces must be included:

//----< 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 >----

 

Software Entwicklung Stuttgart NĂ¼rtingen
Suche Projekte C#, WPF, Windows App,ASP.Net, vb.Net, WinForms, SQL Server, Access, Excel