예제 #1
0
        public static void Run()
        {
            // ExStart:ApplyInnerShadow
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);

            if (!IsExists)
            {
                System.IO.Directory.CreateDirectory(dataDir);
            }

            // Instantiate PresentationEx// Instantiate PresentationEx
            using (Presentation pres = new Presentation())
            {
                // Get the first slide
                ISlide sld = pres.Slides[0];

                // Add an AutoShape of Rectangle type
                IAutoShape ashp = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 150, 75, 150, 50);

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

                // Set Text
                portion.Text = "Aspose TextBox";

                // ExEnd:ApplyInnerShadow
                // Save the presentation to disk
                pres.Save(dataDir + "ApplyInnerShadow_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
            }
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);

            if (!IsExists)
            {
                System.IO.Directory.CreateDirectory(dataDir);
            }

            //Instantiate a PPTX class
            using (Presentation pres = new Presentation())
            {
                //Get reference of the slide
                ISlide sld = pres.Slides[0];

                //Add an AutoShape of Rectangle type
                IAutoShape ashp = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 150, 75, 150, 50);


                //Add TextFrame to the Rectangle
                ashp.AddTextFrame("Aspose TextBox");

                // Disable shape fill in case we want to get shadow of text
                ashp.FillFormat.FillType = FillType.NoFill;

                // Add outer shadow and set all necessary parameters
                ashp.EffectFormat.EnableOuterShadowEffect();
                IOuterShadow shadow = ashp.EffectFormat.OuterShadowEffect;
                shadow.BlurRadius              = 4.0;
                shadow.Direction               = 45;
                shadow.Distance                = 3;
                shadow.RectangleAlign          = RectangleAlignment.TopLeft;
                shadow.ShadowColor.PresetColor = PresetColor.Black;

                //Write the presentation to disk
                pres.Save(dataDir + "pres.pptx", SaveFormat.Pptx);
            }
        }
예제 #3
0
        public static void Run()
        {
            // ExStart:TextBoxHyperlink
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);

            if (!IsExists)
            {
                System.IO.Directory.CreateDirectory(dataDir);
            }

            // Instantiate a Presentation class that represents a PPTX
            Presentation pptxPresentation = new Presentation();

            // Get first slide
            ISlide slide = pptxPresentation.Slides[0];

            // Add an AutoShape of Rectangle Type
            IShape pptxShape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 150, 150, 150, 50);

            // Cast the shape to AutoShape
            IAutoShape pptxAutoShape = (IAutoShape)pptxShape;

            // Access ITextFrame associated with the AutoShape
            pptxAutoShape.AddTextFrame("");

            ITextFrame ITextFrame = pptxAutoShape.TextFrame;

            // Add some text to the frame
            ITextFrame.Paragraphs[0].Portions[0].Text = "Aspose.Slides";

            // Set Hyperlink for the portion text
            IHyperlinkManager HypMan = ITextFrame.Paragraphs[0].Portions[0].PortionFormat.HyperlinkManager;

            HypMan.SetExternalHyperlinkClick("http://www.aspose.com");
            // Save the PPTX Presentation
            pptxPresentation.Save(dataDir + "hLinkPPTX_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
            // ExEnd:TextBoxHyperlink
        }
예제 #4
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            Presentation presentation1 = new Presentation(dataDir + "HelloWorld.pptx");
            ISlide       slide         = presentation1.Slides[0];
            IAutoShape   shp3          = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 200, 365, 400, 150);

            shp3.FillFormat.FillType = FillType.NoFill;
            shp3.AddTextFrame(" ");

            ITextFrame txtFrame = shp3.TextFrame;
            IParagraph para     = txtFrame.Paragraphs[0];
            IPortion   portion  = para.Portions[0];

            portion.Text = "Watermark Text Watermark Text Watermark Text";
            shp3         = slide.Shapes.AddAutoShape(ShapeType.Triangle, 200, 365, 400, 150);
            slide.Shapes.Reorder(2, shp3);
            presentation1.Save(dataDir + "Reshape_out.pptx", SaveFormat.Pptx);
        }
예제 #5
0
        public static void Run()
        {
            // ExStart:SetAnchorOfTextFrame
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            // ExStart:SetAnchorOfTextFrame
            // Create an instance of Presentation class
            Presentation presentation = new Presentation();

            // Get the first slide
            ISlide slide = presentation.Slides[0];

            // Add an AutoShape of Rectangle type
            IAutoShape ashp = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 150, 75, 350, 350);

            // Add TextFrame to the Rectangle
            ashp.AddTextFrame(" ");
            ashp.FillFormat.FillType = FillType.NoFill;

            // Accessing the text frame
            ITextFrame txtFrame = ashp.TextFrame;

            txtFrame.TextFrameFormat.AnchoringType = TextAnchorType.Bottom;

            // Create the Paragraph object for text frame
            IParagraph para = txtFrame.Paragraphs[0];

            // Create Portion object for paragraph
            IPortion portion = para.Portions[0];

            portion.Text = "A quick brown fox jumps over the lazy dog. A quick brown fox jumps over the lazy dog.";
            portion.PortionFormat.FillFormat.FillType             = FillType.Solid;
            portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;

            // ExEnd:SetAnchorOfTextFrame
            // Save Presentation
            presentation.Save(dataDir + "AnchorText_out.pptx", SaveFormat.Pptx);
            // ExEnd:SetAnchorOfTextFrame
        }
예제 #6
0
        public static void Run()
        {
            //ExStart:SetHyperLinkColor
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Slides_Presentations_Hyperlink();

            using (Presentation presentation = new Presentation())
            {
                IAutoShape shape1 = presentation.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 100, 100, 450, 50, false);
                shape1.AddTextFrame("This is a sample of colored hyperlink.");
                shape1.TextFrame.Paragraphs[0].Portions[0].PortionFormat.HyperlinkClick                  = new Hyperlink("https://www.aspose.com/");
                shape1.TextFrame.Paragraphs[0].Portions[0].PortionFormat.HyperlinkClick.ColorSource      = HyperlinkColorSource.PortionFormat;
                shape1.TextFrame.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType             = FillType.Solid;
                shape1.TextFrame.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;

                IAutoShape shape2 = presentation.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 100, 200, 450, 50, false);
                shape2.AddTextFrame("This is a sample of usual hyperlink.");
                shape2.TextFrame.Paragraphs[0].Portions[0].PortionFormat.HyperlinkClick = new Hyperlink("https://www.aspose.com/");

                presentation.Save(dataDir + "presentation-out-hyperlink.pptx", SaveFormat.Pptx);
            }
            //ExEnd:SetHyperLinkColor
        }
예제 #7
0
        public static void Run()
        {
            //ExStart:ParagraphIndent

            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);

            if (!IsExists)
            {
                System.IO.Directory.CreateDirectory(dataDir);
            }

            // Instantiate Presentation Class
            Presentation pres = new Presentation();

            // Get first slide
            ISlide sld = pres.Slides[0];

            // Add a Rectangle Shape
            IAutoShape rect = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 100, 100, 500, 150);

            // Add TextFrame to the Rectangle
            ITextFrame tf = rect.AddTextFrame("This is first line \rThis is second line \rThis is third line");

            // Set the text to fit the shape
            tf.TextFrameFormat.AutofitType = TextAutofitType.Shape;

            // Hide the lines of the Rectangle
            rect.LineFormat.FillFormat.FillType = FillType.Solid;

            // Get first Paragraph in the TextFrame and set its Indent
            IParagraph para1 = tf.Paragraphs[0];

            // Setting paragraph bullet style and symbol
            para1.ParagraphFormat.Bullet.Type = BulletType.Symbol;
            para1.ParagraphFormat.Bullet.Char = Convert.ToChar(8226);
            para1.ParagraphFormat.Alignment   = TextAlignment.Left;

            para1.ParagraphFormat.Depth  = 2;
            para1.ParagraphFormat.Indent = 30;

            // Get second Paragraph in the TextFrame and set its Indent
            IParagraph para2 = tf.Paragraphs[1];

            para2.ParagraphFormat.Bullet.Type = BulletType.Symbol;
            para2.ParagraphFormat.Bullet.Char = Convert.ToChar(8226);
            para2.ParagraphFormat.Alignment   = TextAlignment.Left;
            para2.ParagraphFormat.Depth       = 2;
            para2.ParagraphFormat.Indent      = 40;

            // Get third Paragraph in the TextFrame and set its Indent
            IParagraph para3 = tf.Paragraphs[2];

            para3.ParagraphFormat.Bullet.Type = BulletType.Symbol;
            para3.ParagraphFormat.Bullet.Char = Convert.ToChar(8226);
            para3.ParagraphFormat.Alignment   = TextAlignment.Left;
            para3.ParagraphFormat.Depth       = 2;
            para3.ParagraphFormat.Indent      = 50;

            //Write the Presentation to disk
            pres.Save(dataDir + "InOutDent_out.pptx", SaveFormat.Pptx);
            //ExEnd:ParagraphIndent
        }
예제 #8
0
파일: Program.cs 프로젝트: atulbeast/work
        static void Main(string[] args)
        {
            MainAsync(args).Wait();
            string       path     = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName.ToString(); // Directory Path
            string       JsonData = File.ReadAllText(Path.GetFullPath(path) + "\\Json\\project.json");               //for temporary usage ..for production mainasync method will be used for fetching data
            ProjectModel pmodel   = new ProjectModel();

            pmodel = JsonConvert.DeserializeObject <ProjectModel>(JsonData);
            //Instantiate Prsentation class that represents the PPTX
            Presentation pres = new Presentation();
            //Get the first slide

            string currentDir = Path.GetFullPath(path) + "\\pptFolder\\";
            ISlide sld        = pres.Slides[0];

            sld.Name = "Existing Tender";
            //formatting Text
            PortionFormat portionFormat = new PortionFormat();

            portionFormat.FontHeight = 10;
            ProjectSummary.Logo();

            #region Border
            IAutoShape borderLines = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 3, 3, 715, 535);
            borderLines.FillFormat.FillType             = FillType.NoFill;
            borderLines.FillFormat.SolidFillColor.Color = Color.Black;
            #endregion

            #region Background

            //Add some text
            IAutoShape ashp = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 10, 10, 350, 20);
            //ashp.FillFormat.FillType = FillType.NoFill;
            //ashp.LineFormat.FillFormat.FillType = FillType.NoFill;
            // Add TextFrame to the Rectangle
            ashp.AddTextFrame(" ");
            ashp.FillFormat.SolidFillColor.Color = Color.DarkCyan;
            // 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];
            // Set Text
            portion.Text = "Background";
            portion.PortionFormat.FillFormat.FillType             = FillType.Solid;
            portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.White;
            portion.PortionFormat.FontBold = NullableBool.True;


            #region Table 1
            double[] dblCols1 = { 60, 100, 190 };
            double[] dblRows1 = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 };

            ITable tb1 = sld.Shapes.AddTable(10, 40, dblCols1, dblRows1);

            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 column
                    if (j == 0)
                    {
                        tb1[j, i].FillFormat.FillType             = FillType.Solid;
                        tb1[j, i].FillFormat.SolidFillColor.Color = Color.Gray;
                    }

                    //for 7th to last custom row
                    if (i >= 7)
                    {
                        tb1[j, i].BorderLeft.FillFormat.FillType             = FillType.Solid;
                        tb1[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.White;
                        tb1[j, i].BorderLeft.Width = 1;

                        tb1[j, i].BorderBottom.FillFormat.FillType             = FillType.Solid;
                        tb1[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.White;
                        tb1[j, i].BorderBottom.Width = 1;

                        tb1[j, i].BorderRight.FillFormat.FillType             = FillType.Solid;
                        tb1[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.White;
                        tb1[j, i].BorderRight.Width                         = 1;
                        tb1[j, i].BorderTop.FillFormat.FillType             = FillType.Solid;
                        tb1[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.White;
                        tb1[j, i].BorderTop.Width = 1;
                        if (i == 7)
                        {
                            tb1[j, i].BorderTop.FillFormat.FillType             = FillType.Solid;
                            tb1[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black;
                            tb1[j, i].BorderTop.Width = 1;
                        }
                        if (j == 2)
                        {
                            tb1[j, i].BorderLeft.FillFormat.FillType             = FillType.Solid;
                            tb1[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black;
                            tb1[j, i].BorderLeft.Width = 1;
                        }
                        if (j == 2)
                        {
                            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].FillFormat.FillType             = FillType.Solid;
                        tb1[j, i].FillFormat.SolidFillColor.Color = Color.White;
                    }
                }
            }

            tb1.SetTextFormat(portionFormat);

            Bitmap image = new Bitmap(currentDir + "imagelogo.jpg");
            // Create an IPPImage object using the bitmap object
            IPPImage imgx1 = pres.Images.AddImage(image);

            // Add image to column 2 table cell
            tb1[2, 0].FillFormat.FillType = FillType.Picture;
            tb1[2, 0].FillFormat.PictureFillFormat.PictureFillMode = PictureFillMode.Stretch;
            tb1[2, 0].FillFormat.PictureFillFormat.Picture.Image   = imgx1;


            tb1.MergeCells(tb1[2, 0], tb1[2, 1], false);
            tb1.MergeCells(tb1[2, 0], tb1[2, 2], false);
            tb1.MergeCells(tb1[2, 0], tb1[2, 3], false);
            tb1.MergeCells(tb1[2, 0], tb1[2, 4], false);
            tb1.MergeCells(tb1[2, 0], tb1[2, 5], false);
            tb1.MergeCells(tb1[2, 0], tb1[2, 6], false);
            tb1.MergeCells(tb1[2, 0], tb1[2, 7], false);
            tb1.MergeCells(tb1[2, 0], tb1[2, 8], false);
            tb1.MergeCells(tb1[2, 0], tb1[2, 9], false);

            #endregion
            //column Names:
            tb1[0, 0].TextFrame.Text = "ProjectName";
            tb1[0, 1].TextFrame.Text = "Country";
            tb1[0, 2].TextFrame.Text = "Region";
            tb1[0, 3].TextFrame.Text = "Mode";
            tb1[0, 4].TextFrame.Text = "Project Type";
            tb1[0, 5].TextFrame.Text = "Project Id";
            tb1[0, 6].TextFrame.Text = "Updated Date";

            //inserting values from project

            tb1[1, 0].TextFrame.Text = pmodel.ProjectName;
            tb1[1, 1].TextFrame.Text = pmodel.Country;
            tb1[1, 2].TextFrame.Text = pmodel.Region;
            tb1[1, 3].TextFrame.Text = Enum.GetName(typeof(EnumValue.Mode), pmodel.Mode);
            tb1[1, 4].TextFrame.Text = Enum.GetName(typeof(EnumValue.TenderStatus), pmodel.DealStatus);
            tb1[1, 5].TextFrame.Text = pmodel.ProjectId;
            tb1[1, 6].TextFrame.Text = "7/09/2017";



            #region Table 2

            double[] coltbl2 = { 350 };
            double[] rowtbl2 = { 20, 50, 20, 50 };
            ITable   tb2     = sld.Shapes.AddTable(10, 230, coltbl2, rowtbl2);

            for (int i = 0; i < tb2.Rows.Count; i++)
            {
                for (int j = 0; j < tb2.Rows[i].Count; j++)
                {
                    //border for each cell
                    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;

                    tb2[j, i].FillFormat.FillType = FillType.Solid;
                    if (i % 2 == 0)
                    {
                        tb2[j, i].FillFormat.SolidFillColor.Color = Color.Gray;
                    }
                    else
                    {
                        tb2[j, i].FillFormat.SolidFillColor.Color = Color.White;
                    }
                }
            }

            //Text Entry
            tb2[0, 0].TextFrame.Text = "Description";
            tb2[0, 1].TextFrame.Text = pmodel.Description;
            tb2[0, 2].TextFrame.Text = "Strategic Rationale";
            tb2[0, 3].TextFrame.Text = pmodel.StrategicRationale;
            tb2.SetTextFormat(portionFormat);

            #endregion

            #region Table 3
            // Table 3a

            double[] coltbl3a = { 40, 40, 40, 40 };
            double[] rowtbl3a = { 10, 10, 10, 10, 10 };
            ITable   tb3a     = sld.Shapes.AddTable(10, 400, coltbl3a, rowtbl3a);

            portionFormat.FontHeight = 10;
            tb3a.SetTextFormat(portionFormat);
            for (int i = 0; i < tb3a.Rows.Count; i++)
            {
                for (int j = 0; j < tb3a.Rows[i].Count; j++)
                {
                    tb3a[j, i].FillFormat.FillType = FillType.Solid;
                    if (i == 0 && j == 0)
                    {
                        tb3a[j, i].FillFormat.FillType = FillType.NoFill;
                    }
                    else
                    {
                        if ((i == 0 && j > 0) || (j == 0 && i > 0))
                        {
                            tb3a[j, i].FillFormat.SolidFillColor.Color = Color.Gray;
                        }
                        else
                        {
                            tb3a[j, i].FillFormat.SolidFillColor.Color = Color.White;
                        }
                        //border for each cell
                        tb3a[j, i].BorderTop.FillFormat.FillType             = FillType.Solid;
                        tb3a[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black;
                        tb3a[j, i].BorderTop.Width = 1;

                        tb3a[j, i].BorderBottom.FillFormat.FillType             = FillType.Solid;
                        tb3a[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black;
                        tb3a[j, i].BorderBottom.Width = 1;

                        tb3a[j, i].BorderLeft.FillFormat.FillType             = FillType.Solid;
                        tb3a[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black;
                        tb3a[j, i].BorderLeft.Width = 1;

                        tb3a[j, i].BorderRight.FillFormat.FillType             = FillType.Solid;
                        tb3a[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black;
                        tb3a[j, i].BorderRight.Width = 1;
                    }
                }
            }
            //column names:
            tb3a[1, 0].TextFrame.Text = "2017";
            tb3a[2, 0].TextFrame.Text = "2018";
            tb3a[3, 0].TextFrame.Text = "2019";
            tb3a[0, 1].TextFrame.Text = "Revenue";
            tb3a[0, 2].TextFrame.Text = "EBIT";
            tb3a[0, 3].TextFrame.Text = "Capex";
            tb3a[0, 4].TextFrame.Text = "MTP";

            tb3a[1, 1].TextFrame.Text = pmodel.RevenueX.ToString();
            tb3a[2, 1].TextFrame.Text = pmodel.RevenueX1.ToString();
            tb3a[3, 1].TextFrame.Text = pmodel.RevenueX2.ToString();

            tb3a[1, 2].TextFrame.Text = pmodel.EbitX.ToString();
            tb3a[2, 2].TextFrame.Text = pmodel.EbitX1.ToString();
            tb3a[3, 2].TextFrame.Text = pmodel.EbitX2.ToString();

            tb3a[1, 3].TextFrame.Text = pmodel.CAPEXXMEuro.ToString();
            tb3a[2, 3].TextFrame.Text = pmodel.CAPEX1MEuro.ToString();
            tb3a[3, 3].TextFrame.Text = pmodel.CAPEX2MEuro.ToString();
            // Table 3b
            double[] coltbl3b = { 100, 50 };
            double[] rowtbl3b = { 10, 10, 10 };
            ITable   tb3b     = sld.Shapes.AddTable(200, 400, coltbl3b, rowtbl3b);

            portionFormat.FontHeight = 10;
            tb3b.SetTextFormat(portionFormat);
            for (int i = 0; i < tb3b.Rows.Count; i++)
            {
                for (int j = 0; j < tb3b.Rows[i].Count; j++)
                {
                    tb3b[j, i].FillFormat.FillType = FillType.Solid;

                    if (j == 0)
                    {
                        tb3b[j, i].FillFormat.SolidFillColor.Color = Color.Gray;
                    }
                    else
                    {
                        tb3b[j, i].FillFormat.SolidFillColor.Color = Color.White;
                    }
                    //border for each cell
                    tb3b[j, i].BorderTop.FillFormat.FillType             = FillType.Solid;
                    tb3b[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black;
                    tb3b[j, i].BorderTop.Width = 1;

                    tb3b[j, i].BorderBottom.FillFormat.FillType             = FillType.Solid;
                    tb3b[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black;
                    tb3b[j, i].BorderBottom.Width = 1;

                    tb3b[j, i].BorderLeft.FillFormat.FillType             = FillType.Solid;
                    tb3b[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black;
                    tb3b[j, i].BorderLeft.Width = 1;

                    tb3b[j, i].BorderRight.FillFormat.FillType             = FillType.Solid;
                    tb3b[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black;
                    tb3b[j, i].BorderRight.Width = 1;
                }
            }


            //columns name
            tb3b[0, 0].TextFrame.Text = "EBIT";
            tb3b[0, 1].TextFrame.Text = "Number of vehicles";
            tb3b[0, 2].TextFrame.Text = "Contract Length";

            tb3b[0, 0].TextFrame.Text = pmodel.New_or_existingwork.ToString();
            tb3b[0, 1].TextFrame.Text = pmodel.NumberOfVehicles.ToString();
            tb3b[0, 2].TextFrame.Text = pmodel.CoreContractLength.ToString();



            #endregion

            #endregion

            #region Status

            //Add some text
            IAutoShape ashp1 = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 400, 10, 300, 20);

            // Add TextFrame to the Rectangle
            ashp1.AddTextFrame("");
            ashp1.FillFormat.SolidFillColor.Color = Color.DarkCyan;
            // Accessing the text frame
            ITextFrame txtFrame1 = ashp1.TextFrame;


            // Create the Paragraph object for text frame
            IParagraph para1 = txtFrame1.Paragraphs[0];
            // Create Portion object for paragraph
            IPortion portion1 = para1.Portions[0];
            // Set Text
            portion1.Text = "Status";
            portion1.PortionFormat.FillFormat.FillType             = FillType.Solid;
            portion1.PortionFormat.FillFormat.SolidFillColor.Color = Color.White;
            portion1.PortionFormat.FontBold = NullableBool.True;

            #region Table 4
            //Define columns with widths and rows with heights
            //double[] dblCols = { 50, 50, 50 };
            double[] dblCols = { 80, 100, 60, 60 };
            double[] dblRows = { 20, 20, 20, 20, 40, 30 };

            //Add table shape to slide

            ITable tb4 = sld.Shapes.AddTable(400, 40, dblCols, dblRows);
            tb4.SetTextFormat(portionFormat);
            for (int i = 0; i < tb4.Rows.Count; i++)
            {
                for (int j = 0; j < tb4.Rows[i].Count; j++)
                {
                    //adding border to each cell of the table
                    tb4[j, i].BorderTop.FillFormat.FillType             = FillType.Solid;
                    tb4[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black;
                    tb4[j, i].BorderTop.Width = 1;

                    tb4[j, i].BorderBottom.FillFormat.FillType             = FillType.Solid;
                    tb4[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black;
                    tb4[j, i].BorderBottom.Width = 1;

                    tb4[j, i].BorderLeft.FillFormat.FillType             = FillType.Solid;
                    tb4[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black;
                    tb4[j, i].BorderLeft.Width = 1;

                    tb4[j, i].BorderRight.FillFormat.FillType             = FillType.Solid;
                    tb4[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black;
                    tb4[j, i].BorderRight.Width = 1;
                    //cell with white background
                    tb4[j, i].FillFormat.FillType             = FillType.Solid;
                    tb4[j, i].FillFormat.SolidFillColor.Color = Color.White;

                    //Grey color for first column
                    if (j == 0)
                    {
                        tb4[j, i].FillFormat.FillType             = FillType.Solid;
                        tb4[j, i].FillFormat.SolidFillColor.Color = Color.Gray;
                    }
                }
            }

            //color for cell
            //caution: color it before split otherwise left portion of split cell will be coloured
            tb4[3, 5].FillFormat.FillType             = FillType.Solid;
            tb4[3, 5].FillFormat.SolidFillColor.Color = Color.ForestGreen;
            tb4.SetTextFormat(portionFormat);


            //Set border format for each cell
            //Merge cells 1 & 2 of row 1
            tb4.MergeCells(tb4[1, 4], tb4[2, 4], false);
            tb4.MergeCells(tb4[2, 4], tb4[3, 4], false);
            tb4.MergeCells(tb4[1, 5], tb4[2, 5], false);
            tb4[3, 5].SplitByWidth(tb4[3, 5].Width / 2);
            tb4.MergeCells(tb4[2, 5], tb4[3, 5], false);
            //  tb4[1, 4].TextFrame.Text = "";



            //column names:

            tb4[0, 0].TextFrame.Text = "Division Responsible";
            tb4[0, 1].TextFrame.Text = "Executive Board Member";
            tb4[0, 2].TextFrame.Text = "Country Manager";
            tb4[0, 3].TextFrame.Text = "Project Manager";
            tb4[0, 4].TextFrame.Text = "Team Members(and role) OR requirements";
            tb4[0, 5].TextFrame.Text = "Uncovered Team Resources";
            tb4[2, 0].TextFrame.Text = "Contract Type";
            tb4[2, 1].TextFrame.Text = "Project Stage";
            tb4[2, 2].TextFrame.Text = "Type";
            tb4[2, 3].TextFrame.Text = "Probability";

            //project values:
            tb4[1, 0].TextFrame.Text = pmodel.AdditionalTeamMembers;
            tb4[1, 1].TextFrame.Text = pmodel.ExecutiveBoardMember;
            tb4[1, 2].TextFrame.Text = pmodel.CountryManager;
            tb4[1, 3].TextFrame.Text = pmodel.ProjectManager;
            tb4[1, 4].TextFrame.Text = pmodel.UncoveredTeamResources;
            tb4[2, 0].TextFrame.Text = Enum.GetName(typeof(EnumValue.ContractType), pmodel.ContractType);
            tb4[2, 1].TextFrame.Text = Enum.GetName(typeof(EnumValue.ContractType), pmodel.ProjectStageTender);
            tb4[2, 2].TextFrame.Text = "A(>500)";
            tb4[2, 3].TextFrame.Text = "60%";

            #endregion

            #region Table 5

            double[] dblCols5 = { 80, 160, 30, 30 };
            double[] dblRows5 = { 10, 10, 10, 10, 10, 10, 10, 10, 10 };
            ITable   tb5      = sld.Shapes.AddTable(400, 200, dblCols5, dblRows5);
            for (int i = 0; i < tb5.Rows.Count; i++)
            {
                for (int j = 0; j < tb5.Rows[i].Count; j++)
                {
                    //adding border to each cell of the table
                    tb5[j, i].BorderTop.FillFormat.FillType             = FillType.Solid;
                    tb5[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black;
                    tb5[j, i].BorderTop.Width = 1;

                    tb5[j, i].BorderBottom.FillFormat.FillType             = FillType.Solid;
                    tb5[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black;
                    tb5[j, i].BorderBottom.Width = 1;

                    tb5[j, i].BorderLeft.FillFormat.FillType             = FillType.Solid;
                    tb5[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black;
                    tb5[j, i].BorderLeft.Width = 1;

                    tb5[j, i].BorderRight.FillFormat.FillType             = FillType.Solid;
                    tb5[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black;
                    tb5[j, i].BorderRight.Width = 1;
                    //cell with white background
                    tb5[j, i].FillFormat.FillType             = FillType.Solid;
                    tb5[j, i].FillFormat.SolidFillColor.Color = Color.White;

                    //Grey color for first column
                    if (i < 2 || j == 3)
                    {
                        tb5[j, i].FillFormat.FillType             = FillType.Solid;
                        tb5[j, i].FillFormat.SolidFillColor.Color = Color.Gray;
                    }
                }
            }
            tb5.SetTextFormat(portionFormat);

            //column names:
            tb5[0, 0].TextFrame.Text = "KeyMilestone & Action";
            tb5[0, 1].TextFrame.Text = "Date";
            tb5[1, 1].TextFrame.Text = "Task/Event";
            tb5[2, 1].TextFrame.Text = "Resp";
            tb5[3, 1].TextFrame.Text = "Status";
            for (int i = 2; i <= pmodel.KeyMileStoneAndAction.Count + 1; i++)
            {
                tb5[0, i].TextFrame.Text = pmodel.KeyMileStoneAndAction[i - 2].Date;
                tb5[1, i].TextFrame.Text = pmodel.KeyMileStoneAndAction[i - 2].TaskEvent;
                tb5[2, i].TextFrame.Text = pmodel.KeyMileStoneAndAction[i - 2].Resp;
                tb5[3, i].TextFrame.Text = pmodel.KeyMileStoneAndAction[i - 2].Status;
            }

            #endregion

            #region Table 6
            double[] dblCols6 = { 300 };
            double[] dblRows6 = { 20, 40 };

            ITable tb6 = sld.Shapes.AddTable(400, 380, dblCols6, dblRows6);
            tb6.SetTextFormat(portionFormat);
            for (int i = 0; i < tb6.Rows.Count; i++)
            {
                for (int j = 0; j < tb6.Rows[i].Count; j++)
                {
                    //adding border to each cell of the table
                    tb6[j, i].BorderTop.FillFormat.FillType             = FillType.Solid;
                    tb6[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black;
                    tb6[j, i].BorderTop.Width = 1;

                    tb6[j, i].BorderBottom.FillFormat.FillType             = FillType.Solid;
                    tb6[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black;
                    tb6[j, i].BorderBottom.Width = 1;

                    tb6[j, i].BorderLeft.FillFormat.FillType             = FillType.Solid;
                    tb6[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black;
                    tb6[j, i].BorderLeft.Width = 1;

                    tb6[j, i].BorderRight.FillFormat.FillType             = FillType.Solid;
                    tb6[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black;
                    tb6[j, i].BorderRight.Width = 1;
                    //cell with white background
                    tb6[j, i].FillFormat.FillType             = FillType.Solid;
                    tb6[j, i].FillFormat.SolidFillColor.Color = Color.White;

                    //Grey color for first column
                    if (i == 0 && j == 0)
                    {
                        tb6[j, i].FillFormat.FillType             = FillType.Solid;
                        tb6[j, i].FillFormat.SolidFillColor.Color = Color.Gray;
                    }
                }
            }

            #endregion

            tb6[0, 0].TextFrame.Text = "Status Description";
            tb6[0, 1].TextFrame.Text = pmodel.StatusDescription;


            #region Table 7
            double[] dblCols7 = { 240, 30, 30 };
            double[] dblRows7 = { 20, 20, 20, 20 };

            ITable tb7 = sld.Shapes.AddTable(400, 445, dblCols7, dblRows7);
            tb7.SetTextFormat(portionFormat);
            for (int i = 0; i < tb7.Rows.Count; i++)
            {
                for (int j = 0; j < tb7.Rows[i].Count; j++)
                {
                    //adding border to each cell of the table
                    tb7[j, i].BorderTop.FillFormat.FillType             = FillType.Solid;
                    tb7[j, i].BorderTop.FillFormat.SolidFillColor.Color = Color.Black;
                    tb7[j, i].BorderTop.Width = 1;

                    tb7[j, i].BorderBottom.FillFormat.FillType             = FillType.Solid;
                    tb7[j, i].BorderBottom.FillFormat.SolidFillColor.Color = Color.Black;
                    tb7[j, i].BorderBottom.Width = 1;

                    tb7[j, i].BorderLeft.FillFormat.FillType             = FillType.Solid;
                    tb7[j, i].BorderLeft.FillFormat.SolidFillColor.Color = Color.Black;
                    tb7[j, i].BorderLeft.Width = 1;

                    tb7[j, i].BorderRight.FillFormat.FillType             = FillType.Solid;
                    tb7[j, i].BorderRight.FillFormat.SolidFillColor.Color = Color.Black;
                    tb7[j, i].BorderRight.Width = 1;
                    //cell with white background
                    tb7[j, i].FillFormat.FillType             = FillType.Solid;
                    tb7[j, i].FillFormat.SolidFillColor.Color = Color.White;

                    //Grey color for first column
                    if (i == 0)
                    {
                        tb7[j, i].FillFormat.FillType             = FillType.Solid;
                        tb7[j, i].FillFormat.SolidFillColor.Color = Color.Gray;
                    }
                }
            }

            #endregion
            tb7[0, 0].TextFrame.Text = "Issue For Discussion";
            for (int i = 1; i <= pmodel.Issues.Count; i++)
            {
                tb7[0, i].TextFrame.Text = pmodel.Issues[i - 1].Issues;
                tb7[1, i].TextFrame.Text = pmodel.Issues[i - 1].Owner;
                tb7[2, i].TextFrame.Text = pmodel.Issues[i - 1].Date;
            }


            #endregion

            #region projectsummary

            ProjectSummary.ProjSummary1(ref pres);

            #endregion

            #region Opportunities Schedule

            ProjectSummary.OpportunitiesSchedule(ref pres);


            #endregion


            Console.Write("ppt in progress");
            pres.Save(currentDir + "Table.pptx", Export.SaveFormat.Pptx);
        }
예제 #9
0
        public static void OpportunitiesSchedule(ref Presentation p)
        {
            PortionFormat portionFormat = new PortionFormat();

            portionFormat.FontHeight = 10;

            IMasterLayoutSlideCollection layoutSlides = p.Masters[0].LayoutSlides;
            ILayoutSlide layoutSlide =
                layoutSlides.GetByType(SlideLayoutType.TitleAndObject) ??
                layoutSlides.GetByType(SlideLayoutType.Title);

            //add new slide in presentation
            p.Slides.AddEmptySlide(layoutSlide);

            #region Table Rows/Column
            double[] dblCols = { 10, 20, 30, 100, 20, 40, 40, 40, 50, 30, 30, 30, 30, 30, 30, 30, 30, 40, 70 };
            double[] dblRows = { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 };
            #endregion


            #region Opportunities Schedule – Existing Tenders by Priority
            ISlide sld = p.Slides[4];
            sld.Name = "Opportunities Schedule  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;

            portion.PortionFormat.FillFormat.FillType             = FillType.Solid;
            portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.DarkCyan;
            portion.PortionFormat.FontBold = NullableBool.True;

            // Set Text
            portion.Text = "Opportunities Schedule – Existing Tenders by Priority";

            //Add table shape to slide

            ITable tb1 = sld.Shapes.AddTable(5, 100, dblCols, dblRows);

            for (int i = 0; i < tb1.Rows.Count; i++)
            {
                for (int j = 0; j < tb1.Rows[i].Count; j++)
                {
                    if (i == 9 && (j < 8 || j > 17))
                    {
                        tb1[j, i].FillFormat.FillType = FillType.NoFill;
                    }
                    else
                    {
                        //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;
                    }
                }
            }

            for (int j = 0; j < tb1.Rows[0].Count; j++)
            {
                //Merge first and second row in header for specific column
                if (j < 8 || j > 17)
                {
                    tb1.MergeCells(tb1[j, 0], tb1[j, 1], false);
                }
                // merge three columns in first row
                if (j == 9 || j == 12 || j == 15)
                {
                    tb1.MergeCells(tb1[j, 0], tb1[j + 1, 0], false);
                    tb1.MergeCells(tb1[j, 0], tb1[j + 2, 0], false);
                }
            }

            tb1[0, 0].TextFrame.Text  = "#";
            tb1[1, 0].TextFrame.Text  = "BU";
            tb1[2, 0].TextFrame.Text  = "Priority";
            tb1[3, 0].TextFrame.Text  = "Existing Tenders";
            tb1[4, 0].TextFrame.Text  = "Stage";
            tb1[5, 0].TextFrame.Text  = "Contract Date";
            tb1[6, 0].TextFrame.Text  = "Directors Approval";
            tb1[7, 0].TextFrame.Text  = "Team Yrs.";
            tb1[8, 0].TextFrame.Text  = "Category";
            tb1[9, 0].TextFrame.Text  = " ";
            tb1[10, 0].TextFrame.Text = "";
            tb1[11, 0].TextFrame.Text = "Revenue (€m)";
            tb1[12, 0].TextFrame.Text = "";
            tb1[13, 0].TextFrame.Text = "";
            tb1[14, 0].TextFrame.Text = "EBIT (€m)";
            tb1[15, 0].TextFrame.Text = "";
            tb1[16, 0].TextFrame.Text = "";
            tb1[17, 0].TextFrame.Text = "CAPEX (€m)";
            tb1[18, 0].TextFrame.Text = "EBIT/CAPEX";


            tb1[8, 9].TextFrame.Text = "Total MTP";
            //txtFrame = tb1[8, 9].TextFrame;

            tb1.SetTextFormat(portionFormat);
            StageInfo(ref sld);
            #endregion

            #region "Opportunities Schedule – New Tenders by priority"

            p.Slides.AddEmptySlide(layoutSlide);
            ISlide sld1 = p.Slides[5];
            #region Table Rows/Column
            double[] dblCols1 = { 10, 20, 30, 100, 20, 40, 40, 40, 50, 30, 30, 30, 30, 30, 30, 30, 30, 40, 70 };
            double[] dblRows1 = { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 };
            #endregion

            IAutoShape ashp1 = sld1.Shapes.AddAutoShape(ShapeType.Rectangle, 200, 35, 350, 50);

            ashp1.FillFormat.FillType            = FillType.NoFill;
            ashp1.LineFormat.FillFormat.FillType = FillType.NoFill;

            ashp1.AddTextFrame(" ");

            // Accessing the text frame
            ITextFrame txtFrame1 = ashp1.TextFrame;

            // Create the Paragraph object for text frame
            IParagraph para1 = txtFrame1.Paragraphs[0];

            // Create Portion object for paragraph
            IPortion portion1 = para1.Portions[0];
            portion1.PortionFormat.FontHeight = 25;

            portion1.PortionFormat.FillFormat.FillType             = FillType.Solid;
            portion1.PortionFormat.FillFormat.SolidFillColor.Color = Color.DarkCyan;
            portion1.PortionFormat.FontBold = NullableBool.True;

            // Set Text
            portion1.Text = "Opportunities Schedule – New Tenders by Priority";

            //Add table shape to slide

            ITable tb2 = sld1.Shapes.AddTable(5, 100, dblCols, dblRows);
            for (int i = 0; i < tb2.Rows.Count; i++)
            {
                for (int j = 0; j < tb2.Rows[i].Count; j++)
                {
                    if ((i == 9 || i == 4) && (j < 8 || j > 17))
                    {
                        tb2[j, i].FillFormat.FillType = FillType.NoFill;
                    }
                    //else if (i == 4 && (j < 8 || j > 17))
                    //{
                    //    tb2[j, i].FillFormat.FillType = FillType.NoFill;
                    //}
                    else
                    {
                        //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;
                    }
                }
            }

            for (int j = 0; j < tb2.Rows[0].Count; j++)
            {
                //Merge first and second row in header for specific column
                if (j < 8 || j > 17)
                {
                    tb2.MergeCells(tb2[j, 0], tb2[j, 1], false);
                }
                // merge three columns in first row
                if (j == 9 || j == 12 || j == 15)
                {
                    tb2.MergeCells(tb2[j, 0], tb2[j + 1, 0], false);
                    tb2.MergeCells(tb2[j, 0], tb2[j + 2, 0], false);
                }
            }
            tb2[8, 4].TextFrame.Text  = "TOTAL MTP";
            tb2[0, 0].TextFrame.Text  = "#";
            tb2[1, 0].TextFrame.Text  = "BU";
            tb2[2, 0].TextFrame.Text  = "Priority";
            tb2[3, 0].TextFrame.Text  = "New Tenders";
            tb2[4, 0].TextFrame.Text  = "Stage";
            tb2[5, 0].TextFrame.Text  = "Contract Date";
            tb2[6, 0].TextFrame.Text  = "Directors Approval";
            tb2[7, 0].TextFrame.Text  = "Team Yrs.";
            tb2[8, 0].TextFrame.Text  = "Category";
            tb2[9, 0].TextFrame.Text  = " ";
            tb2[10, 0].TextFrame.Text = "";
            tb2[11, 0].TextFrame.Text = "Revenue (€m)";
            tb2[12, 0].TextFrame.Text = "";
            tb2[13, 0].TextFrame.Text = "";
            tb2[14, 0].TextFrame.Text = "EBIT (€m)";
            tb2[15, 0].TextFrame.Text = "";
            tb2[16, 0].TextFrame.Text = "";
            tb2[17, 0].TextFrame.Text = "CAPEX (€m)";
            tb2[18, 0].TextFrame.Text = "EBIT/CAPEX";


            tb2[8, 9].TextFrame.Text = "Total MTP";
            //txtFrame = tb2[8, 9].TextFrame;

            tb2.SetTextFormat(portionFormat);
            StageInfo(ref sld1);
            #endregion
        }
예제 #10
0
        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
        }
예제 #11
0
        public static void Run()
        {
            //ExStart:MutilevelBullets
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);

            if (!IsExists)
            {
                System.IO.Directory.CreateDirectory(dataDir);
            }

            // Creating a presenation instance
            using (Presentation pres = new Presentation())
            {
                // Accessing the first slide
                ISlide slide = pres.Slides[0];

                // Adding and accessing Autoshape
                IAutoShape aShp = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 200, 200, 400, 200);

                // Accessing the text frame of created autoshape
                ITextFrame text = aShp.AddTextFrame("");

                //clearing default paragraph
                text.Paragraphs.Clear();

                //Adding first paragraph
                IParagraph para1 = new Paragraph();
                para1.Text = "Content";
                para1.ParagraphFormat.Bullet.Type = BulletType.Symbol;
                para1.ParagraphFormat.Bullet.Char = Convert.ToChar(8226);
                para1.ParagraphFormat.DefaultPortionFormat.FillFormat.FillType             = FillType.Solid;
                para1.ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
                //Setting bullet level
                para1.ParagraphFormat.Depth = 0;

                //Adding second paragraph
                IParagraph para2 = new Paragraph();
                para2.Text = "Second Level";
                para2.ParagraphFormat.Bullet.Type = BulletType.Symbol;
                para2.ParagraphFormat.Bullet.Char = '-';
                para2.ParagraphFormat.DefaultPortionFormat.FillFormat.FillType             = FillType.Solid;
                para2.ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
                //Setting bullet level
                para2.ParagraphFormat.Depth = 1;

                //Adding third paragraph
                IParagraph para3 = new Paragraph();
                para3.Text = "Third Level";
                para3.ParagraphFormat.Bullet.Type = BulletType.Symbol;
                para3.ParagraphFormat.Bullet.Char = Convert.ToChar(8226);
                para3.ParagraphFormat.DefaultPortionFormat.FillFormat.FillType             = FillType.Solid;
                para3.ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
                //Setting bullet level
                para3.ParagraphFormat.Depth = 2;

                //Adding fourth paragraph
                IParagraph para4 = new Paragraph();
                para4.Text = "Fourth Level";
                para4.ParagraphFormat.Bullet.Type = BulletType.Symbol;
                para4.ParagraphFormat.Bullet.Char = '-';
                para4.ParagraphFormat.DefaultPortionFormat.FillFormat.FillType             = FillType.Solid;
                para4.ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
                //Setting bullet level
                para4.ParagraphFormat.Depth = 3;

                //Adding paragraphs to collection
                text.Paragraphs.Add(para1);
                text.Paragraphs.Add(para2);
                text.Paragraphs.Add(para3);
                text.Paragraphs.Add(para4);

                //Writing the presentation as a PPTX file
                pres.Save(dataDir + "MultilevelBullet.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
            }
            //ExEnd:MutilevelBullets
        }