public static void Run() { // ExStart:ApplyOuterShadow // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Text(); // Create an instance of Presentation class Presentation presentation = new Presentation(); // Get reference of a slide ISlide slide = presentation.Slides[0]; // Add an AutoShape of Rectangle type IAutoShape ashp = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 150, 75, 400, 300); ashp.FillFormat.FillType = FillType.NoFill; // Add TextFrame to the Rectangle ashp.AddTextFrame("Aspose TextBox"); IPortion port = ashp.TextFrame.Paragraphs[0].Portions[0]; IPortionFormat pf = port.PortionFormat; pf.FontHeight = 50; // Enable InnerShadowEffect IEffectFormat ef = pf.EffectFormat; ef.EnableInnerShadowEffect(); // Set all necessary parameters ef.InnerShadowEffect.BlurRadius = 8.0; ef.InnerShadowEffect.Direction = 90.0F; ef.InnerShadowEffect.Distance = 6.0; ef.InnerShadowEffect.ShadowColor.B = 189; // Set ColorType as Scheme ef.InnerShadowEffect.ShadowColor.ColorType = ColorType.Scheme; // Set Scheme Color ef.InnerShadowEffect.ShadowColor.SchemeColor = SchemeColor.Accent1; // Save Presentation presentation.Save(dataDir + "WordArt_out.pptx", SaveFormat.Pptx); // ExStart:ApplyOuterShadow }
public static void Run() { //ExStart:GetEffectiveValues // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Text(); using (Presentation pres = new Presentation(dataDir + "Presentation1.pptx")) { IAutoShape shape = pres.Slides[0].Shapes[0] as IAutoShape; ITextFrameFormat localTextFrameFormat = shape.TextFrame.TextFrameFormat; ITextFrameFormatEffectiveData effectiveTextFrameFormat = localTextFrameFormat.GetEffective(); IPortionFormat localPortionFormat = shape.TextFrame.Paragraphs[0].Portions[0].PortionFormat; IPortionFormatEffectiveData effectivePortionFormat = localPortionFormat.GetEffective(); } //ExEnd:GetEffectiveValues }
public static void ProjSummary1(ref Presentation p) { //formatting font text for table TextFrame PortionFormat portionFormat = new PortionFormat(); portionFormat.FontHeight = 10; IMasterLayoutSlideCollection layoutSlides = p.Masters[0].LayoutSlides; ILayoutSlide layoutSlide = layoutSlides.GetByType(SlideLayoutType.TitleAndObject) ?? layoutSlides.GetByType(SlideLayoutType.Title); p.Slides.AddEmptySlide(layoutSlide); #region Table Rows/Column double[] dblCols = { 20, 150, 50, 50, 150, 150, 50, 50 }; double[] dblRows = { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 }; #endregion #region project summary (1/3) ISlide sld = p.Slides[1]; sld.Name = "Project Summary sheet 1"; // Add an AutoShape of Rectangle type IAutoShape ashp = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 200, 35, 350, 50); ashp.FillFormat.FillType = FillType.NoFill; ashp.LineFormat.FillFormat.FillType = FillType.NoFill; // Add TextFrame to the Rectangle ashp.AddTextFrame(" "); // Accessing the text frame ITextFrame txtFrame = ashp.TextFrame; // Create the Paragraph object for text frame IParagraph para = txtFrame.Paragraphs[0]; // Create Portion object for paragraph IPortion portion = para.Portions[0]; portion.PortionFormat.FontHeight = 25; IPortionFormat pf = portion.PortionFormat; portion.PortionFormat.FillFormat.FillType = FillType.Solid; portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.DarkCyan; portion.PortionFormat.FontBold = NullableBool.True; // Set Text portion.Text = "Projects Summary (1/3) – existing tenders (Priority 1)"; //existing tenders //Add table shape to slide ITable tb1 = sld.Shapes.AddTable(30, 100, dblCols, dblRows); for (int i = 0; i < tb1.Rows.Count; i++) { for (int j = 0; j < tb1.Rows[i].Count; j++) { //adding border to each cell of the table tb1[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderTop.Width = 1; tb1[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderBottom.Width = 1; tb1[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderLeft.Width = 1; tb1[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb1[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb1[j, i].BorderRight.Width = 1; //cell with white background tb1[j, i].FillFormat.FillType = FillType.Solid; tb1[j, i].FillFormat.SolidFillColor.Color = Color.White; //Grey color for first row if (i == 0) { tb1[j, i].FillFormat.FillType = FillType.Solid; tb1[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } } } tb1[0, 0].TextFrame.Text = "Nr"; tb1[1, 0].TextFrame.Text = "Existing Tenders"; tb1[2, 0].TextFrame.Text = "RAG current month"; tb1[3, 0].TextFrame.Text = "RAG previous month"; tb1[4, 0].TextFrame.Text = "Issue/Key Milestone"; tb1[5, 0].TextFrame.Text = "Action agreed"; tb1[6, 0].TextFrame.Text = "Project Manger"; tb1[7, 0].TextFrame.Text = "Accountable"; tb1.SetTextFormat(portionFormat); #endregion #region project summary(2/3) p.Slides.AddEmptySlide(layoutSlide); ISlide sld1 = p.Slides[2]; sld1.Name = "Project Summary sheet 2"; // Add an AutoShape of Rectangle type ashp = sld1.Shapes.AddAutoShape(ShapeType.Rectangle, 200, 35, 400, 50); ashp.FillFormat.FillType = FillType.NoFill; ashp.LineFormat.FillFormat.FillType = FillType.NoFill; //// Add TextFrame to the Rectangle ashp.AddTextFrame(" "); // Accessing the text frame txtFrame = ashp.TextFrame; // Create the Paragraph object for text frame para = txtFrame.Paragraphs[0]; // Create Portion object for paragraph portion = para.Portions[0]; portion.PortionFormat.FontHeight = 25; portion.PortionFormat.FillFormat.FillType = FillType.Solid; portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.DarkCyan; portion.PortionFormat.FontBold = NullableBool.True; // Set Text portion.Text = "Projects Summary (2/3) – new tenders"; //Add table shape to slide ITable tb2 = sld1.Shapes.AddTable(30, 100, dblCols, dblRows); for (int i = 0; i < tb2.Rows.Count; i++) { for (int j = 0; j < tb2.Rows[i].Count; j++) { //adding border to each cell of the table tb2[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderTop.Width = 1; tb2[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderBottom.Width = 1; tb2[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderLeft.Width = 1; tb2[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb2[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb2[j, i].BorderRight.Width = 1; //cell with white background tb2[j, i].FillFormat.FillType = FillType.Solid; tb2[j, i].FillFormat.SolidFillColor.Color = Color.White; //Grey color for first row if (i == 0) { tb2[j, i].FillFormat.FillType = FillType.Solid; tb2[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } } } tb2[0, 0].TextFrame.Text = "Nr"; tb2[1, 0].TextFrame.Text = "Existing Tenders"; tb2[2, 0].TextFrame.Text = "RAG current month"; tb2[3, 0].TextFrame.Text = "RAG previous month"; tb2[4, 0].TextFrame.Text = "Issue/Key Milestone"; tb2[5, 0].TextFrame.Text = "Action agreed"; tb2[6, 0].TextFrame.Text = "Project Manger"; tb2[7, 0].TextFrame.Text = "Accountable"; tb2.SetTextFormat(portionFormat); #endregion #region project summary(3/3) p.Slides.AddEmptySlide(layoutSlide); ISlide sld2 = p.Slides[3]; sld2.Name = "Project Summary sheet 3"; // Add an AutoShape of Rectangle type ashp = sld2.Shapes.AddAutoShape(ShapeType.Rectangle, 200, 35, 400, 50); ashp.FillFormat.FillType = FillType.NoFill; ashp.LineFormat.FillFormat.FillType = FillType.NoFill; //// Add TextFrame to the Rectangle ashp.AddTextFrame(" "); // Accessing the text frame txtFrame = ashp.TextFrame; // Create the Paragraph object for text frame para = txtFrame.Paragraphs[0]; // Create Portion object for paragraph portion = para.Portions[0]; portion.PortionFormat.FontHeight = 25; portion.PortionFormat.FillFormat.FillType = FillType.Solid; portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.DarkCyan; portion.PortionFormat.FontBold = NullableBool.True; // Set Text portion.Text = "Projects Summary (3/3) – M&A existing and new countries"; //Add table shape to slide ITable tb3 = sld2.Shapes.AddTable(30, 100, dblCols, dblRows); for (int i = 0; i < tb3.Rows.Count; i++) { for (int j = 0; j < tb3.Rows[i].Count; j++) { //adding border to each cell of the table tb3[j, i].BorderTop.FillFormat.FillType = FillType.Solid; tb3[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black; tb3[j, i].BorderTop.Width = 1; tb3[j, i].BorderBottom.FillFormat.FillType = FillType.Solid; tb3[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black; tb3[j, i].BorderBottom.Width = 1; tb3[j, i].BorderLeft.FillFormat.FillType = FillType.Solid; tb3[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black; tb3[j, i].BorderLeft.Width = 1; tb3[j, i].BorderRight.FillFormat.FillType = FillType.Solid; tb3[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black; tb3[j, i].BorderRight.Width = 1; //cell with white background tb3[j, i].FillFormat.FillType = FillType.Solid; tb3[j, i].FillFormat.SolidFillColor.Color = Color.White; //Grey color for first row if (i == 0) { tb3[j, i].FillFormat.FillType = FillType.Solid; tb3[j, i].FillFormat.SolidFillColor.Color = Color.Gray; } } } tb3[0, 0].TextFrame.Text = "Nr"; tb3[1, 0].TextFrame.Text = "Growth Opportunities (Tenders): Priority 1"; tb3[2, 0].TextFrame.Text = "RAG current month"; tb3[3, 0].TextFrame.Text = "RAG previous month"; tb3[4, 0].TextFrame.Text = "Issue/Key Milestone"; tb3[5, 0].TextFrame.Text = "Action agreed"; tb3[6, 0].TextFrame.Text = "Project Manger"; tb3[7, 0].TextFrame.Text = "Accountable"; tb3.SetTextFormat(portionFormat); #endregion }