My sample application starts by creating an instance of the PowerPoint.Application class;
PowerPoint.Application PowerPointApplication = new PowerPoint.Application();
Then I set the Visible property to msoTrue ;
PowerPointApplication.Visible = Core.MsoTriState.msoTrue;
Then create Presentation and Slide ;
PowerPoint.Presentations PowerPointPresentationSet = PowerPointApplication.Presentations; PowerPoint._Presentation PowerPointPresentation = PowerPointPresentationSet.Add(); PowerPoint.Slides PowerPointSlideSet = PowerPointPresentation.Slides; PowerPoint._Slide PowerPointSlide = PowerPointSlideSet.Add(1, PowerPoint.PpSlideLayout.ppLayoutBlank);
In my code, I created a Shape object;
PowerPoint.Shape PowerPointShape = PowerPointSlide.Shapes.AddLine(100, 100, 500, 500);
Then I format it as follows:
PowerPointShape.Line.Weight = 10; PowerPointShape.Line.ForeColor.RGB = 65535; PowerPointShape.Line.Transparency = 0.8f;
Point, Opacity grows when the Transparency property decreases.
You can set the Line.Weight property to reduce or add a line to a line, and you can set the value of the Foreground.RGB property to change the color of the line.
PS: I added a scope for using these files in namespaces,
using PowerPoint = Microsoft.Office.Interop.PowerPoint; using Core = Microsoft.Office.Core;
You can find a working solution at this link; http://snipt.org/nsgk7
Engin polat
source share