Пример #1
0
        public static void Run()
        {
            //ExStart:CreateTable

            Presentation pres = new Presentation();

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

            //Define columns with widths and rows with heights
            double[] dblCols = { 50, 50, 50 };
            double[] dblRows = { 50, 30, 30, 30, 30 };

            //Add a table
            Aspose.Slides.ITable tbl = sld.Shapes.AddTable(50, 50, dblCols, dblRows);

            //Set border format for each cell
            foreach (IRow row in tbl.Rows)
            {
                foreach (ICell cell in row)
                {
                    //Get text frame of each cell
                    ITextFrame tf = cell.TextFrame;
                    //Add some text
                    tf.Text = "T" + cell.FirstRowIndex.ToString() + cell.FirstColumnIndex.ToString();
                    //Set font size of 10
                    tf.Paragraphs[0].Portions[0].PortionFormat.FontHeight = 10;
                    tf.Paragraphs[0].ParagraphFormat.Bullet.Type          = BulletType.None;
                }
            }

            //Write the presentation to the disk
            pres.Save("C:\\data\\tblSLD.ppt", SaveFormat.Ppt);
            //ExEnd:CreateTable
        }
Пример #2
0
        public static void Run()
        {
            //ExStart:LineSpacing

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

            // Create an instance of Presentation class
            Presentation presentation = new Presentation(dataDir + "Fonts.pptx");

            // Obtain a slide's reference by its index
            ISlide sld = presentation.Slides[0];

            // Access the TextFrame
            ITextFrame tf1 = ((IAutoShape)sld.Shapes[0]).TextFrame;

            // Access the Paragraph
            IParagraph para1 = tf1.Paragraphs[0];

            // Set properties of Paragraph
            para1.ParagraphFormat.SpaceWithin = 80;
            para1.ParagraphFormat.SpaceBefore = 40;
            para1.ParagraphFormat.SpaceAfter  = 40;
            // Save Presentation
            presentation.Save(dataDir + "LineSpacing_out.pptx", SaveFormat.Pptx);
            //ExEnd:LineSpacing
        }
        public static void Run()
        {
            //ExStart:ParagraphsAlignment
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            // Instantiate a Presentation object that represents a PPTX file
            using (Presentation pres = new Presentation(dataDir + "ParagraphsAlignment.pptx"))
            {
                // Accessing first slide
                ISlide slide = pres.Slides[0];

                // Accessing the first and second placeholder in the slide and typecasting it as AutoShape
                ITextFrame tf1 = ((IAutoShape)slide.Shapes[0]).TextFrame;
                ITextFrame tf2 = ((IAutoShape)slide.Shapes[1]).TextFrame;

                // Change the text in both placeholders
                tf1.Text = "Center Align by Aspose";
                tf2.Text = "Center Align by Aspose";

                // Getting the first paragraph of the placeholders
                IParagraph para1 = tf1.Paragraphs[0];
                IParagraph para2 = tf2.Paragraphs[0];

                // Aligning the text paragraph to center
                para1.ParagraphFormat.Alignment = TextAlignment.Center;
                para2.ParagraphFormat.Alignment = TextAlignment.Center;

                //Writing the presentation as a PPTX file
                pres.Save(dataDir + "Centeralign_out.pptx", SaveFormat.Pptx);
            }
            //ExEnd:ParagraphsAlignment
        }
Пример #4
0
        public static void Run()
        {
            //ExStart:SetAutofitOftextframe
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

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

            // Access 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.AutofitType = TextAutofitType.Shape;

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

            // Save Presentation
            presentation.Save(dataDir + "formatText_out.pptx", SaveFormat.Pptx); 
        }
Пример #5
0
        public static void Run()
        {
            // ExStart:FontFamily
            // 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
            using (Presentation pres = new Presentation())
            {
                // Get first slide
                ISlide sld = pres.Slides[0];

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

                // Remove any fill style associated with the AutoShape
                ashp.FillFormat.FillType = FillType.NoFill;

                // Access the TextFrame associated with the AutoShape
                ITextFrame tf = ashp.TextFrame;
                tf.Text = "Aspose TextBox";

                // Access the Portion associated with the TextFrame
                IPortion port = tf.Paragraphs[0].Portions[0];

                // Set the Font for the Portion
                port.PortionFormat.LatinFont = new FontData("Times New Roman");

                // Set Bold property of the Font
                port.PortionFormat.FontBold = NullableBool.True;

                // Set Italic property of the Font
                port.PortionFormat.FontItalic = NullableBool.True;

                // Set Underline property of the Font
                port.PortionFormat.FontUnderline = TextUnderlineType.Single;

                // Set the Height of the Font
                port.PortionFormat.FontHeight = 25;

                // Set the color of the Font
                port.PortionFormat.FillFormat.FillType             = FillType.Solid;
                port.PortionFormat.FillFormat.SolidFillColor.Color = Color.Blue;

                //Write the presentation to disk
                pres.Save(dataDir + "pptxFont_out.pptx", SaveFormat.Pptx);
            }
            // ExEnd:FontFamily
        }
Пример #6
0
        protected override void OnLoad(EventArgs e)
        {
            try
            {
                _init = true;

                _frame = _text.Frame;

                chkTextFrame.Checked = (_frame != null);
                grpTextFrame.Enabled = chkTextFrame.Checked;

                if (_frame == null)
                {
                    _frame = _sym.CreateFrame();
                }

                TextBoxBinder.BindText(txtContent, _text, nameof(_text.Content));

                symAlignmentHorizontal.Bind(_text, nameof(_text.HorizontalAlignment));
                symAlignmentJustification.Bind(_text, nameof(_text.Justification));
                symAlignmentVertical.Bind(_text, nameof(_text.VerticalAlignment));
                symAngle.Bind(_text, nameof(_text.Angle));
                symFontBold.Bind(_text, nameof(_text.Bold));
                symFontFamily.Bind(_text, nameof(_text.FontName));
                symFontItalic.Bind(_text, nameof(_text.Italic));
                symFontUnderlined.Bind(_text, nameof(_text.Underlined));
                symGhostColor.Bind(_text, nameof(_text.GhostColor));
                symHeight.Bind(_text, nameof(_text.Height));
                symHeightScalable.Bind(_text, nameof(_text.HeightScalable));
                symLineSpacing.Bind(_text, nameof(_text.LineSpacing));
                symPositionX.Bind(_text, nameof(_text.PositionX));
                symPositionY.Bind(_text, nameof(_text.PositionY));
                symTextColor.Bind(_text, nameof(_text.TextColor));

                symFillColor.Bind(_frame, nameof(_frame.FillColor));
                symLineColor.Bind(_frame, nameof(_frame.LineColor));
                symOffsetX.Bind(_frame, nameof(_frame.OffsetX));
                symOffsetY.Bind(_frame, nameof(_frame.OffsetY));

                var text2 = _text as ITextGraphic2;
                if (text2 != null)
                {
                    symOverlined.Bind(text2, nameof(text2.Overlined));
                    symObliqueAngle.Bind(text2, nameof(text2.ObliqueAngle));
                    symTrackSpacing.Bind(text2, nameof(text2.TrackSpacing));
                    symMarkup.Bind(text2, nameof(text2.Markup));
                }
                else
                {
                    tabControl1.TabPages.Remove(TAB_ADVANCED);
                }
            }
            finally
            {
                _init = false;
            }
        }
Пример #7
0
        protected override void OnLoad(EventArgs e)
        {
            try
            {
                _init = true;

                _frame = _text.Frame;

                chkTextFrame.Checked = (_frame != null);
                grpTextFrame.Enabled = chkTextFrame.Checked;

                if (_frame == null)
                    _frame = _sym.CreateFrame();

                TextBoxBinder.BindText(txtContent, _text, "Content");

                symAlignmentHorizontal.Bind(_text, "HorizontalAlignment");
                symAlignmentJustification.Bind(_text, "Justification");
                symAlignmentVertical.Bind(_text, "VerticalAlignment");
                symAngle.Bind(_text, "Angle");
                symFontBold.Bind(_text, "Bold");
                symFontFamily.Bind(_text, "FontName");
                symFontItalic.Bind(_text, "Italic");
                symFontUnderlined.Bind(_text, "Underlined");
                symGhostColor.Bind(_text, "GhostColor");
                symHeight.Bind(_text, "Height");
                symHeightScalable.Bind(_text, "HeightScalable");
                symLineSpacing.Bind(_text, "LineSpacing");
                symPositionX.Bind(_text, "PositionX");
                symPositionY.Bind(_text, "PositionY");
                symTextColor.Bind(_text, "TextColor");

                symFillColor.Bind(_frame, "FillColor");
                symLineColor.Bind(_frame, "LineColor");
                symOffsetX.Bind(_frame, "OffsetX");
                symOffsetY.Bind(_frame, "OffsetY");

                var text2 = _text as ITextGraphic2;
                if (text2 != null)
                {
                    symOverlined.Bind(text2, "Overlined");
                    symObliqueAngle.Bind(text2, "ObliqueAngle");
                    symTrackSpacing.Bind(text2, "TrackSpacing");
                    symMarkup.Bind(text2, "Markup");
                }
                else
                {
                    tabControl1.TabPages.Remove(TAB_ADVANCED);
                }
            }
            finally
            {
                _init = false;
            }
        }
Пример #8
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            // Instantiate PresentationEx
            using (Presentation presentation = new Presentation(dataDir + "DefaultFonts.pptx"))
            {
                // ExStart:ManagParagraphFontProperties

                // Accessing a slide using its slide position
                ISlide slide = presentation.Slides[0];

                // Accessing the first and second placeholder in the slide and typecasting it as AutoShape
                ITextFrame tf1 = ((IAutoShape)slide.Shapes[0]).TextFrame;
                ITextFrame tf2 = ((IAutoShape)slide.Shapes[1]).TextFrame;

                // Accessing the first Paragraph
                IParagraph para1 = tf1.Paragraphs[0];
                IParagraph para2 = tf2.Paragraphs[0];

                // Justify the paragraph
                para2.ParagraphFormat.Alignment = TextAlignment.JustifyLow;

                // Accessing the first portion
                IPortion port1 = para1.Portions[0];
                IPortion port2 = para2.Portions[0];

                // Define new fonts
                FontData fd1 = new FontData("Elephant");
                FontData fd2 = new FontData("Castellar");

                // Assign new fonts to portion
                port1.PortionFormat.LatinFont = fd1;
                port2.PortionFormat.LatinFont = fd2;

                // Set font to Bold
                port1.PortionFormat.FontBold = NullableBool.True;
                port2.PortionFormat.FontBold = NullableBool.True;

                // Set font to Italic
                port1.PortionFormat.FontItalic = NullableBool.True;
                port2.PortionFormat.FontItalic = NullableBool.True;

                // Set font color
                port1.PortionFormat.FillFormat.FillType             = FillType.Solid;
                port1.PortionFormat.FillFormat.SolidFillColor.Color = Color.Purple;
                port2.PortionFormat.FillFormat.FillType             = FillType.Solid;
                port2.PortionFormat.FillFormat.SolidFillColor.Color = Color.Peru;

                // ExEnd:ManagParagraphFontProperties
                // Write the PPTX to disk
                presentation.Save(dataDir + "ManagParagraphFontProperties_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
            }
        }
Пример #9
0
        public static void Run()
        {
            //ExStart:AddingSuperscriptAndSubscriptTextInTextFrame
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            using (Presentation presentation = new Presentation())
            {
                // Get slide
                ISlide slide = presentation.Slides[0];

                // Create text box
                IAutoShape shape     = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 100, 100, 200, 100);
                ITextFrame textFrame = shape.TextFrame;
                textFrame.Paragraphs.Clear();

                // Create paragraph for superscript text
                IParagraph superPar = new Paragraph();

                // Create portion with usual text
                IPortion portion1 = new Portion();
                portion1.Text = "SlideTitle";
                superPar.Portions.Add(portion1);

                // Create portion with superscript text
                IPortion superPortion = new Portion();
                superPortion.PortionFormat.Escapement = 30;
                superPortion.Text = "TM";
                superPar.Portions.Add(superPortion);

                // Create paragraph for subscript text
                IParagraph paragraph2 = new Paragraph();

                // Create portion with usual text
                IPortion portion2 = new Portion();
                portion2.Text = "a";
                paragraph2.Portions.Add(portion2);

                // Create portion with subscript text
                IPortion subPortion = new Portion();
                subPortion.PortionFormat.Escapement = -25;
                subPortion.Text = "i";
                paragraph2.Portions.Add(subPortion);

                // Add paragraphs to text box
                textFrame.Paragraphs.Add(superPar);
                textFrame.Paragraphs.Add(paragraph2);

                presentation.Save(RunExamples.OutPath + "TestOut.pptx", SaveFormat.Pptx);
                System.Diagnostics.Process.Start(RunExamples.OutPath + "TestOut.pptx");
            }
            //ExEnd:AddingSuperscriptAndSubscriptTextInTextFrame
        }
Пример #10
0
        public static void setdefaultstyle(IAutoShape shape)
        {
            ITextFrame tf1 = shape.TextFrame;

            foreach (var item in tf1.Paragraphs)
            {
                IPortion port = item.Portions[0];
                port.PortionFormat.LatinFont  = new FontData("微软雅黑");
                port.PortionFormat.FontBold   = NullableBool.NotDefined;
                port.PortionFormat.FontHeight = 12;
            }
        }
Пример #11
0
        public static void Run()
        {
            //ExStart:SetCustomBulletsNumber

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

            using (var presentation = new Presentation())
            {
                var shape = presentation.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 200, 200, 400, 200);

                // Accessing the text frame of created autoshape
                ITextFrame textFrame = shape.TextFrame;

                // Removing the default exisiting paragraph
                textFrame.Paragraphs.RemoveAt(0);

                // First list
                var paragraph1 = new Paragraph {
                    Text = "bullet 2"
                };
                paragraph1.ParagraphFormat.Depth = 4;
                paragraph1.ParagraphFormat.Bullet.NumberedBulletStartWith = 2;
                paragraph1.ParagraphFormat.Bullet.Type = BulletType.Numbered;
                textFrame.Paragraphs.Add(paragraph1);

                var paragraph2 = new Paragraph {
                    Text = "bullet 3"
                };
                paragraph2.ParagraphFormat.Depth = 4;
                paragraph2.ParagraphFormat.Bullet.NumberedBulletStartWith = 3;
                paragraph2.ParagraphFormat.Bullet.Type = BulletType.Numbered;
                textFrame.Paragraphs.Add(paragraph2);


                var paragraph5 = new Paragraph {
                    Text = "bullet 7"
                };
                paragraph5.ParagraphFormat.Depth = 4;
                paragraph5.ParagraphFormat.Bullet.NumberedBulletStartWith = 7;
                paragraph5.ParagraphFormat.Bullet.Type = BulletType.Numbered;
                textFrame.Paragraphs.Add(paragraph5);

                presentation.Save(dataDir + "SetCustomBulletsNumber-slides.pptx", SaveFormat.Pptx);
            }


            //ExEnd:SetCustomBulletsNumber
        }
Пример #12
0
        public void slide16(ISlide slide)
        {
            string     str1 = thread4();
            IAutoShape itf  = (IAutoShape)slide.Shapes[6];

            itf.TextFrame.Text = str1;
            ITextFrame tf = itf.TextFrame;

            foreach (var item in tf.Paragraphs)
            {
                IPortion port = item.Portions[0];
                port.PortionFormat.LatinFont  = new FontData("微软雅黑");
                port.PortionFormat.FontBold   = NullableBool.NotDefined;
                port.PortionFormat.FontHeight = 12;
            }
        }
        public static void Run()
        {
            //ExStart:VerticallyAlignText
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Tables();

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

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

            // Define columns with widths and rows with heights
            double[] dblCols = { 120, 120, 120, 120 };
            double[] dblRows = { 100, 100, 100, 100 };

            // Add table shape to slide
            ITable tbl = slide.Shapes.AddTable(100, 50, dblCols, dblRows);

            tbl[1, 0].TextFrame.Text = "10";
            tbl[2, 0].TextFrame.Text = "20";
            tbl[3, 0].TextFrame.Text = "30";

            // Accessing the text frame
            ITextFrame txtFrame = tbl[0, 0].TextFrame;

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

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

            portion.Text = "Text here";
            portion.PortionFormat.FillFormat.FillType             = FillType.Solid;
            portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;

            // Aligning the text vertically
            ICell cell = tbl[0, 0];

            cell.TextAnchorType   = TextAnchorType.Center;
            cell.TextVerticalType = TextVerticalType.Vertical270;

            // Save Presentation
            presentation.Save(dataDir + "Vertical_Align_Text_out.pptx", SaveFormat.Pptx);
            //ExEnd:VerticallyAlignText
        }
        public static void Run()
        {
            //ExStart:ManageParagraphPictureBulletsInPPT
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            Presentation presentation = new Presentation();

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

            // Instantiate the image for bullets
            Image    image     = new Bitmap(dataDir + "bullets.png");
            IPPImage ippxImage = presentation.Images.AddImage(image);

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

            // Accessing the text frame of created autoshape
            ITextFrame textFrame = autoShape.TextFrame;

            // Removing the default exisiting paragraph
            textFrame.Paragraphs.RemoveAt(0);

            // Creating new paragraph
            Paragraph paragraph = new Paragraph();

            paragraph.Text = "Welcome to Aspose.Slides";

            // Setting paragraph bullet style and image
            paragraph.ParagraphFormat.Bullet.Type          = BulletType.Picture;
            paragraph.ParagraphFormat.Bullet.Picture.Image = ippxImage;

            // Setting Bullet Height
            paragraph.ParagraphFormat.Bullet.Height = 100;

            // Adding Paragraph to text frame
            textFrame.Paragraphs.Add(paragraph);

            // Writing the presentation as a PPTX file
            presentation.Save(dataDir + "ParagraphPictureBulletsPPTX_out.pptx", SaveFormat.Pptx);
            // Writing the presentation as a PPT file
            presentation.Save(dataDir + "ParagraphPictureBulletsPPT_out.ppt", SaveFormat.Ppt);
            //ExEnd:ManageParagraphPictureBulletsInPPT
        }
 /// <summary>
 /// Fill text frame with datas from slave table as a list with bullet
 /// </summary>
 static void FillStaffList(ITextFrame textFrame, DataRow userRow, DataTable staffListTable)
 {
     foreach (DataRow listRow in staffListTable.Rows)
     {
         if (listRow["UserId"].ToString() == userRow["Id"].ToString())
         {
             Paragraph para = new Paragraph();
             para.ParagraphFormat.Bullet.Type = BulletType.Symbol;
             para.ParagraphFormat.Bullet.Char = Convert.ToChar(8226);
             para.Text = listRow["Name"].ToString();
             para.ParagraphFormat.Bullet.Color.ColorType   = ColorType.RGB;
             para.ParagraphFormat.Bullet.Color.Color       = Color.Black;
             para.ParagraphFormat.Bullet.IsBulletHardColor = NullableBool.True;
             para.ParagraphFormat.Bullet.Height            = 100;
             textFrame.Paragraphs.Add(para);
         }
     }
 }
Пример #16
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);
            }
        }
Пример #17
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
        }
Пример #18
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);
        }
Пример #19
0
        // Generic functions for Slides

        #region Stage Info
        private static void StageInfo(ref ISlide sld)
        {
            IAutoShape ashp1 = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 20, 300, 200, 300);


            ashp1.FillFormat.FillType            = FillType.NoFill;
            ashp1.LineFormat.FillFormat.FillType = FillType.NoFill;
            ITextFrame txtFrame1 = ashp1.TextFrame;

            txtFrame1.TextFrameFormat.AutofitType = TextAutofitType.Shape;

            IParagraph para1 = txtFrame1.Paragraphs[0];

            para1.Text = "\n Stage 1 = Monitoring \n Stage 2 = ITT Assessment \n Stage 3 = Bid Preparation \n Stage 4 = Bid Submission \n Stage 5 = Mobilisation \n Stage 6 = Post tender review";
            para1.ParagraphFormat.Alignment = TextAlignment.Left;
            // Create Portion object for paragraph
            IPortion portion1 = para1.Portions[0];

            portion1.PortionFormat.FontHeight                      = 15;
            portion1.PortionFormat.FontItalic                      = NullableBool.True;
            portion1.PortionFormat.FillFormat.FillType             = FillType.Solid;
            portion1.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
        }
Пример #20
0
        public void slide18(ISlide slide)
        {
            Office_ChartStyle style = new Office_ChartStyle();

            style.坐标方向   = Base_Config.坐标方向.横向;
            style.文字位置   = Aspose.Slides.Charts.LegendDataLabelPosition.Center;
            style.文字旋转方向 = TextVerticalType.Vertical270;
            style.是否显示文字 = true;
            Office_Charts.SingleAxexchart(slide, Cache_Result_yb.jsjg_scjgfx, 2, style);

            IAutoShape itf = (IAutoShape)slide.Shapes[5];

            itf.TextFrame.Paragraphs[0].Text = thread5();
            itf.TextFrame.Paragraphs[1].Text = thread6();
            ITextFrame tf = itf.TextFrame;

            foreach (var item in tf.Paragraphs)
            {
                IPortion port = item.Portions[0];
                port.PortionFormat.LatinFont  = new FontData("微软雅黑");
                port.PortionFormat.FontBold   = NullableBool.NotDefined;
                port.PortionFormat.FontHeight = 12;
            }
        }
Пример #21
0
        public static void Run()
        {
            //ExStart:ParagraphBullets
            // 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 txtFrm = aShp.TextFrame;

                // Removing the default exisiting paragraph
                txtFrm.Paragraphs.RemoveAt(0);

                // Creating a paragraph
                Paragraph para = new Paragraph();

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

                // Setting paragraph text
                para.Text = "Welcome to Aspose.Slides";

                // Setting bullet indent
                para.ParagraphFormat.Indent = 25;

                // Setting bullet color
                para.ParagraphFormat.Bullet.Color.ColorType   = ColorType.RGB;
                para.ParagraphFormat.Bullet.Color.Color       = Color.Black;
                para.ParagraphFormat.Bullet.IsBulletHardColor = NullableBool.True; // set IsBulletHardColor to true to use own bullet color

                // Setting Bullet Height
                para.ParagraphFormat.Bullet.Height = 100;

                // Adding Paragraph to text frame
                txtFrm.Paragraphs.Add(para);

                // Creating second paragraph
                Paragraph para2 = new Paragraph();

                // Setting paragraph bullet type and style
                para2.ParagraphFormat.Bullet.Type = BulletType.Numbered;
                para2.ParagraphFormat.Bullet.NumberedBulletStyle = NumberedBulletStyle.BulletCircleNumWDBlackPlain;

                // Adding paragraph text
                para2.Text = "This is numbered bullet";

                // Setting bullet indent
                para2.ParagraphFormat.Indent = 25;

                para2.ParagraphFormat.Bullet.Color.ColorType   = ColorType.RGB;
                para2.ParagraphFormat.Bullet.Color.Color       = Color.Black;
                para2.ParagraphFormat.Bullet.IsBulletHardColor = NullableBool.True; // set IsBulletHardColor to true to use own bullet color

                // Setting Bullet Height
                para2.ParagraphFormat.Bullet.Height = 100;

                // Adding Paragraph to text frame
                txtFrm.Paragraphs.Add(para2);


                //Writing the presentation as a PPTX file
                pres.Save(dataDir + "Bullet_out.pptx", SaveFormat.Pptx);
            }
            //ExEnd:ParagraphBullets
        }
Пример #22
0
        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 Presentation class that represents a PPTX file
            using (Presentation pres = new Presentation())
            {
                //Accessing first slide
                ISlide slide = pres.Slides[0];

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

                //Access TextFrame of the AutoShape
                ITextFrame tf = ashp.TextFrame;

                //Create Paragraphs and Portions with different text formats
                IParagraph para0  = tf.Paragraphs[0];
                IPortion   port01 = new Portion();
                IPortion   port02 = new Portion();
                para0.Portions.Add(port01);
                para0.Portions.Add(port02);

                IParagraph para1 = new Paragraph();
                tf.Paragraphs.Add(para1);
                IPortion port10 = new Portion();
                IPortion port11 = new Portion();
                IPortion port12 = new Portion();
                para1.Portions.Add(port10);
                para1.Portions.Add(port11);
                para1.Portions.Add(port12);

                IParagraph para2 = new Paragraph();
                tf.Paragraphs.Add(para2);
                IPortion port20 = new Portion();
                IPortion port21 = new Portion();
                IPortion port22 = new Portion();
                para2.Portions.Add(port20);
                para2.Portions.Add(port21);
                para2.Portions.Add(port22);

                for (int i = 0; i < 3; i++)
                {
                    for (int j = 0; j < 3; j++)
                    {
                        tf.Paragraphs[i].Portions[j].Text = "Portion0" + j.ToString();
                        if (j == 0)
                        {
                            tf.Paragraphs[i].Portions[j].PortionFormat.FillFormat.FillType             = FillType.Solid;
                            tf.Paragraphs[i].Portions[j].PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;
                            tf.Paragraphs[i].Portions[j].PortionFormat.FontBold   = NullableBool.True;
                            tf.Paragraphs[i].Portions[j].PortionFormat.FontHeight = 15;
                        }
                        else if (j == 1)
                        {
                            tf.Paragraphs[i].Portions[j].PortionFormat.FillFormat.FillType             = FillType.Solid;
                            tf.Paragraphs[i].Portions[j].PortionFormat.FillFormat.SolidFillColor.Color = Color.Blue;
                            tf.Paragraphs[i].Portions[j].PortionFormat.FontItalic = NullableBool.True;
                            tf.Paragraphs[i].Portions[j].PortionFormat.FontHeight = 18;
                        }
                    }
                }

                //Write PPTX to Disk
                pres.Save(dataDir + "multiParaPort.pptx", SaveFormat.Pptx);
            }
        }
Пример #23
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
        }
Пример #24
0
        /// <summary>
        /// 根据模板生成ppt
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        private bool CreatePPT(string code, string jclb, string wtms)
        {
            bool result = true;

            try
            {
                using (Presentation destPres = new Presentation())
                {
                    using (Presentation srcPres = new Presentation(dataDir + "问题检查模板.ppt"))
                    {
                        //Instantiate ISlide from the collection of slides in source presentation along with
                        //master slide
                        ISlide       SourceSlide  = srcPres.Slides[0];
                        IMasterSlide SourceMaster = SourceSlide.LayoutSlide.MasterSlide;

                        //Clone the desired master slide from the source presentation to the collection of masters in the
                        //destination presentation
                        IMasterSlideCollection masters    = destPres.Masters;
                        IMasterSlide           DestMaster = SourceSlide.LayoutSlide.MasterSlide;

                        //Clone the desired master slide from the source presentation to the collection of masters in the
                        //destination presentation
                        IMasterSlide iSlide = masters.AddClone(SourceMaster);

                        //Clone the desired slide from the source presentation with the desired master to the end of the
                        //collection of slides in the destination presentation
                        ISlideCollection slds = destPres.Slides;
                        slds.AddClone(SourceSlide, iSlide, true);
                        //Clone the desired master slide from the source presentation to the collection of masters in the //destination presentation
                        //Save the destination presentation to disk

                        destPres.Slides[0].Remove();

                        ISlide slide = destPres.Slides[0];

                        IAutoShape ashp = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 200, 50, 100, 50);

                        // Remove any fill style associated with the AutoShape
                        ashp.FillFormat.FillType = FillType.NoFill;
                        ashp.Hidden          = true;
                        ashp.Name            = "code";
                        ashp.AlternativeText = "hiddenfield";

                        // Access the TextFrame associated with the AutoShape
                        ITextFrame tf = ashp.TextFrame;
                        tf.Text = "#code#" + code;


                        //Iterating through all shapes inside the slide
                        for (int i = 0; i < slide.Shapes.Count; i++)
                        {
                            if (slide.Shapes[i].AsISlideComponent.GetType() == typeof(Aspose.Slides.AutoShape))
                            {
                                if (((IAutoShape)slide.Shapes[i]).TextFrame.Text == "检查类别")
                                {
                                    ((IAutoShape)slide.Shapes[i]).TextFrame.Text = jclb;
                                }
                                if (((IAutoShape)slide.Shapes[i]).TextFrame.Text == "问题描述")
                                {
                                    ((IAutoShape)slide.Shapes[i]).TextFrame.Text = wtms;
                                }

                                /*** 2003版本slide.Shapes[i]).Name值会丢失
                                 * if (((IAutoShape)slide.Shapes[i]).Name == "code")
                                 * {
                                 *
                                 *  code= ((IAutoShape)slide.Shapes[i]).TextFrame.Text;
                                 * }
                                 ****/
                                if (((IAutoShape)slide.Shapes[i]).TextFrame.Text.Contains("#code#"))
                                {
                                    code = ((IAutoShape)slide.Shapes[i]).TextFrame.Text.Replace("#code#", "");
                                }
                            }
                        }

                        destPres.Save(dataDir + code + ".ppt", SaveFormat.Ppt);
                    }
                }
            }
            catch (Exception ex)
            {
                result = false;
            }
            return(result);
        }
        public static void Run()
        {
            string dataDir          = RunExamples.GetDataDir_Conversion();
            string presTemplatePath = Path.Combine(dataDir, "PresentationTemplate.pptx");
            string resultPath       = Path.Combine(RunExamples.OutPath, "MailMergeResult");

            // Path to the data.
            // XML data is one of the examples of the possible MailMerge data sources (among RDBMS and other types of data sources).
            string dataPath = Path.Combine(dataDir, "TestData.xml");

            // Check if result path exists
            if (!Directory.Exists(resultPath))
            {
                Directory.CreateDirectory(resultPath);
            }

            // Creating DataSet using XML data
            using (DataSet dataSet = new DataSet())
            {
                dataSet.ReadXml(dataPath);

                DataTableCollection dataTables     = dataSet.Tables;
                DataTable           usersTable     = dataTables["TestTable"];
                DataTable           staffListTable = dataTables["StaffList"];
                DataTable           planFactTable  = dataTables["Plan_Fact"];

                // For all records in main table we will create a separate presentation
                foreach (DataRow userRow in usersTable.Rows)
                {
                    // create result (individual) presentation name
                    string presPath = Path.Combine(resultPath, "PresFor_" + userRow["Name"] + ".pptx");

                    // Load presentation template
                    using (Presentation pres = new Presentation(presTemplatePath))
                    {
                        // Fill text boxes with data from data base main table
                        ((AutoShape)pres.Slides[0].Shapes[0]).TextFrame.Text =
                            "Chief of the department - " + userRow["Name"];
                        ((AutoShape)pres.Slides[0].Shapes[4]).TextFrame.Text = userRow["Department"].ToString();

                        // Get image from data base
                        byte[] bytes = Convert.FromBase64String(userRow["Img"].ToString());

                        // insert image into picture frame of presentation
                        IPPImage      image = pres.Images.AddImage(bytes);
                        IPictureFrame pf    = pres.Slides[0].Shapes[1] as PictureFrame;
                        pf.PictureFormat.Picture.Image.ReplaceImage(image);

                        // Get abd prepare text frame for filling it with datas
                        IAutoShape list      = pres.Slides[0].Shapes[2] as IAutoShape;
                        ITextFrame textFrame = list.TextFrame;

                        textFrame.Paragraphs.Clear();
                        Paragraph para = new Paragraph();
                        para.Text = "Department Staff:";
                        textFrame.Paragraphs.Add(para);

                        // fill staff data
                        FillStaffList(textFrame, userRow, staffListTable);

                        // fill plan fact data
                        FillPlanFact(pres, userRow, planFactTable);

                        pres.Save(presPath, SaveFormat.Pptx);
                    }
                }
            }
        }
Пример #26
0
        public void FormatText(Aspose.Slides.Export.ISvgTSpan svgTSpan, IPortion portion, ITextFrame textFrame)
        {
            int paragraphIndex = 0; int portionIndex = 0;

            for (int i = 0; i < textFrame.Paragraphs.Count; i = i + 1)
            {
                portionIndex = textFrame.Paragraphs[i].Portions.IndexOf(portion);
                if (portionIndex > -1)
                {
                    paragraphIndex = i; break;
                }
            }
            if (m_portionIndex != portionIndex)
            {
                m_tspanIndex   = 0;
                m_portionIndex = portionIndex;
            }
            svgTSpan.Id = string.Format("paragraph-{0}_portion-{1}_{2}", paragraphIndex, m_portionIndex, m_tspanIndex++);
        }
Пример #27
0
        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);
        }
Пример #28
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
        }
Пример #29
0
        /**************************
         * 如模板文件如为pptx格式,生成文件为ppt,生成后的ppt中的问题描述字体颜色会发生变化,因此需要将模板文件更改为ppt格式,但ppt格式中的
         * 隐藏shape.name会在生成的ppt中丢失,采取TextFrame.Text添加标记来区分是否是隐藏元素,并将需要存储的值存于TextFrame.Text中
         ***************************/
        private void btn_singlegenarate_Click(object sender, EventArgs e)
        {
            using (Presentation destPres = new Presentation())
            {
                using (Presentation srcPres = new Presentation(dataDir + "问题检查模板.ppt"))
                {
                    //Instantiate ISlide from the collection of slides in source presentation along with
                    //master slide
                    ISlide       SourceSlide  = srcPres.Slides[0];
                    IMasterSlide SourceMaster = SourceSlide.LayoutSlide.MasterSlide;

                    //Clone the desired master slide from the source presentation to the collection of masters in the
                    //destination presentation
                    IMasterSlideCollection masters    = destPres.Masters;
                    IMasterSlide           DestMaster = SourceSlide.LayoutSlide.MasterSlide;

                    //Clone the desired master slide from the source presentation to the collection of masters in the
                    //destination presentation
                    IMasterSlide iSlide = masters.AddClone(SourceMaster);

                    //Clone the desired slide from the source presentation with the desired master to the end of the
                    //collection of slides in the destination presentation
                    ISlideCollection slds = destPres.Slides;
                    slds.AddClone(SourceSlide, iSlide, true);
                    //Clone the desired master slide from the source presentation to the collection of masters in the //destination presentation
                    //Save the destination presentation to disk

                    destPres.Slides[0].Remove();

                    foreach (ISlide slide in slds)
                    {
                        //Iterating through all shapes inside the slide
                        for (int i = 0; i < slide.Shapes.Count; i++)
                        {
                            //If the alternative text of the slide matches with the required one then
                            //return the shape
                            //if (slide.Shapes[i].AlternativeText.CompareTo(alttext) == 0)
                            //    return slide.Shapes[i];

                            //if (slide.Shapes[i].AlternativeText == "检查类别")
                            //    slide.Shapes[i].AlternativeText = "123456";

                            if (slide.Shapes[i].Placeholder != null)
                            {
                                //Change the text of each placeholder
                                ((IAutoShape)slide.Shapes[i]).TextFrame.Text = "This is Placeholder";
                            }
                        }
                    }


                    ISlide sld = destPres.Slides[0];

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

                    //// Remove any fill style associated with the AutoShape
                    //ashp.FillFormat.FillType = FillType.NoFill;
                    ////ashp.UseBackgroundFill = true;
                    ////ashp.LineFormat.Width = 0;
                    //ashp.LineFormat.FillFormat.FillType = FillType.NoFill;//设置无边框
                    ////ashp.LineFormat.FillFormat.SolidFillColor.Color = Color.Red;

                    //// Access the TextFrame associated with the AutoShape
                    //ITextFrame tf = ashp.TextFrame;
                    ////tf.TextFrameFormat.
                    //tf.Text = "Aspose TextBox22";

                    //// Access the Portion associated with the TextFrame
                    //IPortion port = tf.Paragraphs[0].Portions[0];

                    //// Set the Font for the Portion
                    //port.PortionFormat.LatinFont = new FontData("Times New Roman");

                    //// Set Bold property of the Font
                    //port.PortionFormat.FontBold = NullableBool.True;

                    //// Set Italic property of the Font
                    //port.PortionFormat.FontItalic = NullableBool.True;

                    //// Set Underline property of the Font
                    //port.PortionFormat.FontUnderline = TextUnderlineType.Single;

                    //// Set the Height of the Font
                    //port.PortionFormat.FontHeight = 25;

                    //// Set the color of the Font
                    //port.PortionFormat.FillFormat.FillType = FillType.Solid;
                    //port.PortionFormat.FillFormat.SolidFillColor.Color = Color.Blue;

                    // ExEnd:SetTextFontProperties
                    // Write the PPTX to disk
                    //presentation.Save(dataDir + "SetTextFontProperties.pptx", SaveFormat.Pptx);

                    IAutoShape ashp2 = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 200, 50, 100, 50);

                    // Remove any fill style associated with the AutoShape
                    ashp2.FillFormat.FillType = FillType.NoFill;
                    ashp2.Hidden          = true;
                    ashp2.Name            = "code";
                    ashp2.AlternativeText = "hiddenfield";

                    // Access the TextFrame associated with the AutoShape
                    ITextFrame tf2 = ashp2.TextFrame;
                    tf2.Text = "#code#这是code值";

                    destPres.Save(dataDir + "single.ppt", SaveFormat.Ppt);
                }
            }
        }
Пример #30
0
        /// <summary>
        /// Internal method to add a picture to a presentation
        /// </summary>
        /// <param name="presentation"></param>
        /// <param name="tmpFile"></param>
        /// <param name="imageSize"></param>
        /// <param name="title"></param>
        private static void AddPictureToPresentation(IPresentation presentation, string tmpFile, Size imageSize, string title)
        {
            if (presentation != null)
            {
                //ISlide slide = presentation.Slides.AddSlide( presentation.Slides.Count + 1, PPSlideLayout.ppLayoutPictureWithCaption);
                ISlide slide;
                float  left            = (presentation.PageSetup.SlideWidth / 2) - (imageSize.Width / 2f);
                float  top             = (presentation.PageSetup.SlideHeight / 2) - (imageSize.Height / 2f);
                float  width           = imageSize.Width;
                float  height          = imageSize.Height;
                IShape shapeForCaption = null;
                bool   hasScaledWidth  = false;
                bool   hasScaledHeight = false;
                try {
                    slide = presentation.Slides.Add(presentation.Slides.Count + 1, (int)officeConfiguration.PowerpointSlideLayout);
                    // Shapes[2] is the image shape on this layout.
                    shapeForCaption = slide.Shapes.item(1);
                    IShape shapeForLocation = slide.Shapes.item(2);

                    if (width > shapeForLocation.Width)
                    {
                        width          = shapeForLocation.Width;
                        left           = shapeForLocation.Left;
                        hasScaledWidth = true;
                    }
                    else
                    {
                        shapeForLocation.Left = left;
                    }
                    shapeForLocation.Width = imageSize.Width;

                    if (height > shapeForLocation.Height)
                    {
                        height          = shapeForLocation.Height;
                        top             = shapeForLocation.Top;
                        hasScaledHeight = true;
                    }
                    else
                    {
                        top = (shapeForLocation.Top + (shapeForLocation.Height / 2)) - (imageSize.Height / 2f);
                    }
                    shapeForLocation.Height = imageSize.Height;
                } catch (Exception e) {
                    LOG.Error(e);
                    slide = presentation.Slides.Add(presentation.Slides.Count + 1, (int)PPSlideLayout.ppLayoutBlank);
                }
                IShape shape = slide.Shapes.AddPicture(tmpFile, MsoTriState.msoFalse, MsoTriState.msoTrue, 0, 0, width, height);
                if (officeConfiguration.PowerpointLockAspectRatio)
                {
                    shape.LockAspectRatio = MsoTriState.msoTrue;
                }
                else
                {
                    shape.LockAspectRatio = MsoTriState.msoFalse;
                }
                shape.ScaleHeight(1, MsoTriState.msoTrue, MsoScaleFrom.msoScaleFromMiddle);
                shape.ScaleWidth(1, MsoTriState.msoTrue, MsoScaleFrom.msoScaleFromMiddle);
                if (hasScaledWidth)
                {
                    shape.Width = width;
                }
                if (hasScaledHeight)
                {
                    shape.Height = height;
                }
                shape.Left            = left;
                shape.Top             = top;
                shape.AlternativeText = title;
                if (shapeForCaption != null)
                {
                    try {
                        // Using try/catch to make sure problems with the text range don't give an exception.
                        ITextFrame textFrame = shapeForCaption.TextFrame;
                        textFrame.TextRange.Text = title;
                    } catch (Exception ex) {
                        LOG.Warn("Problem setting the title to a text-range", ex);
                    }
                }
                presentation.Application.ActiveWindow.View.GotoSlide(slide.SlideNumber);
                presentation.Application.Activate();
            }
        }
Пример #31
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
        }