示例#1
0
        private void testCode()
        {
            // Create a PowerPoint application object.
            PowerPoint.Application appPPT = Globals.ThisAddIn.Application;

            // Create a new PowerPoint presentation.
            PowerPoint.Presentation pptPresentation = appPPT.ActivePresentation;


            PowerPoint.CustomLayout pptLayout = default(PowerPoint.CustomLayout);
            if ((pptPresentation.SlideMaster.CustomLayouts._Index(7) == null))
            {
                pptLayout = pptPresentation.SlideMaster.CustomLayouts._Index(1);
            }
            else
            {
                pptLayout = pptPresentation.SlideMaster.CustomLayouts._Index(7);
            }

            // Create newSlide by using pptLayout.
            PowerPoint.Slide newSlide =
                pptPresentation.Slides.AddSlide((pptPresentation.Slides.Count + 1), pptLayout);

            Color myBackgroundColor = Color.Aqua;
            int   oleColor          = ColorTranslator.ToOle(myBackgroundColor);

            newSlide.FollowMasterBackground        = Core.MsoTriState.msoFalse;
            newSlide.Background.Fill.ForeColor.RGB = oleColor;
            //newSlide.Background.Fill.Visible = Core.MsoTriState.msoFalse;


            PowerPoint.Shape textBox = newSlide.Shapes.AddTextbox(Core.MsoTextOrientation.msoTextOrientationHorizontal, 100, 100, 500, 100);

            textBox.TextFrame.TextRange.Text = "teasdfst";
        }
示例#2
0
        private void AddHorizontalLine(Document d, _HorizontalLine horizontalLine)
        {
            var line = d.Paragraphs.Last.Range.InlineShapes.AddHorizontalLineStandard(ref missing);

            line.Height = horizontalLine.Height;
            line.Fill.Solid();
            line.HorizontalLineFormat.NoShade      = true;
            line.Fill.ForeColor.RGB                = ColorTranslator.ToOle(horizontalLine.Color);
            line.HorizontalLineFormat.PercentWidth = horizontalLine.PorcentWidth;
            line.HorizontalLineFormat.Alignment    = horizontalLine.Alignment;
        }