Exemplo n.º 1
0
        private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Assembly assembly     = typeof(GettingStartedPresentation).GetTypeInfo().Assembly;
            string   resourcePath = "Syncfusion.SampleBrowser.UWP.Presentation.Presentation.Assets.HelloWorld.pptx";
            Stream   fileStream   = assembly.GetManifestResourceStream(resourcePath);

            IPresentation presentation = await Presentation.OpenAsync(fileStream);

            #region Slide1
            ISlide slide1     = presentation.Slides[0];
            IShape titleShape = slide1.Shapes[0] as IShape;
            titleShape.Left   = 0.33 * 72;
            titleShape.Top    = 0.58 * 72;
            titleShape.Width  = 12.5 * 72;
            titleShape.Height = 1.75 * 72;

            ITextBody   textFrame1  = (slide1.Shapes[0] as IShape).TextBody;
            IParagraphs paragraphs1 = textFrame1.Paragraphs;
            IParagraph  paragraph   = paragraphs1.Add();
            paragraph.HorizontalAlignment = HorizontalAlignmentType.Center;
            ITextPart textPart1 = paragraph.AddTextPart();
            textPart1.Text          = "Essential Presentation";
            textPart1.Font.CapsType = TextCapsType.All;
            textPart1.Font.FontName = "Adobe Garamond Pro";
            textPart1.Font.Bold     = true;
            textPart1.Font.FontSize = 40;

            IShape subtitle = slide1.Shapes[1] as IShape;
            subtitle.Left   = 0.5 * 72;
            subtitle.Top    = 3 * 72;
            subtitle.Width  = 11.8 * 72;
            subtitle.Height = 1.7 * 72;

            ITextBody textFrame2 = (slide1.Shapes[1] as IShape).TextBody;
            textFrame2.VerticalAlignment = VerticalAlignmentType.Top;
            IParagraphs paragraphs2 = textFrame2.Paragraphs;
            IParagraph  para        = paragraphs2.Add();
            para.HorizontalAlignment = HorizontalAlignmentType.Left;
            ITextPart textPart2 = para.AddTextPart();
            textPart2.Text          = "Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum tempus.Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet.";
            textPart2.Font.FontName = "Adobe Garamond Pro";
            textPart2.Font.FontSize = 21;

            para = paragraphs2.Add();
            para.HorizontalAlignment = HorizontalAlignmentType.Left;
            textPart2               = para.AddTextPart();
            textPart2.Text          = "Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet. Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula.";
            textPart2.Font.FontName = "Adobe Garamond Pro";
            textPart2.Font.FontSize = 21;
            #endregion
            MemoryStream ms = new MemoryStream();

            SavePPTX(presentation);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create the slides with paragraph instances.
        /// </summary>
        /// <param name="presentation">Represents the presentation instance.</param>
        private void CreateSlideWithParagraph(IPresentation presentation)
        {
            #region Slide2
            ISlide slide = presentation.Slides.Add(SlideLayoutType.SectionHeader);
            IShape shape = slide.Shapes[0] as IShape;
            SetShapeBounds(shape, 55.44, 23.04, 573.12, 71.28);

            ITextBody textFrame = shape.TextBody;

            //Instance to hold paragraphs in textframe
            IParagraphs paragraphs = textFrame.Paragraphs;
            IParagraph  paragraph  = paragraphs.Add();
            ITextPart   textpart   = paragraph.AddTextPart();
            paragraphs[0].HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart.Text          = "Slide with simple text";
            textpart.Font.FontName = "Helvetica CE 35 Thin";
            textpart.Font.FontSize = 40;
            //Get the shape from shape collection
            shape = slide.Shapes[1] as IShape;
            //Sets the properties of the shape.
            SetShapeBounds(shape, 87.12, 119.52, 725.76, 354.96);
            textFrame = shape.TextBody;

            //Instance to hold paragraphs in textframe
            paragraphs = textFrame.Paragraphs;
            SetParagraphProperties(paragraphs, "Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum tempus.");
            SetParagraphProperties(paragraphs, "Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet.");
            SetParagraphProperties(paragraphs, "Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula.");
            SetParagraphProperties(paragraphs, "Vestibulum duis integer diam mi libero felis, sollicitudin id dictum etiam blandit lacus, ac condimentum magna dictumst interdum et,");
            SetParagraphProperties(paragraphs, "nam commodo mi habitasse enim fringilla nunc, amet aliquam sapien per tortor luctus. Conubia voluptates at nunc, congue lectus, malesuada nulla.");
            SetParagraphProperties(paragraphs, "Rutrum quo morbi, feugiat sed mi turpis, ac cursus integer ornare dolor. Purus dui in et tincidunt, sed eros pede adipiscing tellus, est suscipit nulla,");
            SetParagraphProperties(paragraphs, "Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula.");
            SetParagraphProperties(paragraphs, "arcu nec fringilla vel aliquam, mollis lorem rerum hac vestibulum ante nullam. Volutpat a lectus, lorem pulvinar quis. Lobortis vehicula in imperdiet orci urna.");
            #endregion
        }
        /// <summary>
        /// Adds formatting properties for the paragraph.
        /// </summary>
        /// <param name="paragraph">Represents the paragraph instance.</param>
        /// <param name="text">Represents the text content.</param>
        private void AddParagraphProperties(IParagraph paragraph, string text)
        {
            paragraph.HorizontalAlignment = HorizontalAlignmentType.Left;
            ITextPart textPart = paragraph.AddTextPart();

            textPart.Text          = text;
            textPart.Font.FontName = "Adobe Garamond Pro";
            textPart.Font.FontSize = 21;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Adds the content to the table cell.
        /// </summary>
        /// <param name="cell">Represents the cell instance in the table.</param>
        /// <param name="text">Represents the text content of the cell.</param>
        private void AddTableCellContent(ICell cell, string text)
        {
            IParagraph paragraph = cell.TextBody.Paragraphs.Add();

            paragraph.HorizontalAlignment = HorizontalAlignmentType.Center;
            ITextPart textPart = paragraph.AddTextPart();

            textPart.Text = text;
        }
Exemplo n.º 5
0
 private void btnCreateImage_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         //Opens the existing presentation stream.
         using (IPresentation presentation = Presentation.Create())
         {
             ISlide     slide     = presentation.Slides.Add(SlideLayoutType.TitleOnly);
             IParagraph paragraph = ((IShape)slide.Shapes[0]).TextBody.Paragraphs.Add();
             //Apply center alignment to the paragraph
             paragraph.HorizontalAlignment = HorizontalAlignmentType.Center;
             //Add slide title
             ITextPart textPart = paragraph.AddTextPart("Northwind Management Report");
             textPart.Font.Color = ColorObject.FromArgb(46, 116, 181);
             //Get chart data from xml file
             DataSet dataSet = new DataSet();
             dataSet.ReadXml(@"..\..\..\..\..\..\..\Common\Data\Presentation\Products.xml");
             //Add a new chart to the presentation slide
             IPresentationChart chart = slide.Charts.AddChart(44.64, 133.2, 870.48, 380.16);
             //Set chart type
             chart.ChartType = OfficeChartType.Pie;
             //Set chart title
             chart.ChartTitle = "Best Selling Products";
             //Set chart properties font name and size
             chart.ChartTitleArea.FontName = "Calibri (Body)";
             chart.ChartTitleArea.Size     = 14;
             for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
             {
                 chart.ChartData.SetValue(i + 2, 1, dataSet.Tables[0].Rows[i].ItemArray[1]);
                 chart.ChartData.SetValue(i + 2, 2, dataSet.Tables[0].Rows[i].ItemArray[2]);
             }
             //Create a new chart series with the name “Sales”
             AddSeriesForChart(chart);
             //Setting the font size of the legend.
             chart.Legend.TextArea.Size = 14;
             //Setting background color
             chart.ChartArea.Fill.ForeColor           = System.Drawing.Color.FromArgb(242, 242, 242);
             chart.PlotArea.Fill.ForeColor            = System.Drawing.Color.FromArgb(242, 242, 242);
             chart.ChartArea.Border.LinePattern       = OfficeChartLinePattern.None;
             chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 11, 1];
             //Saves the presentation instance to the stream.
             presentation.Save("ChartCreationSample.pptx");
             if (System.Windows.MessageBox.Show("Do you want to view the generated PowerPoint Presentation?", "Chart Creation",
                                                MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
             {
                 System.Diagnostics.Process.Start("ChartCreationSample.pptx");
                 this.Close();
             }
         }
     }
     catch (Exception exception)
     {
         System.Windows.MessageBox.Show("This Presentation could not be created, please contact Syncfusion Direct-Trac system at http://www.syncfusion.com/support/default.aspx for any queries. ", "OOPS..Sorry!",
                                        MessageBoxButton.OK);
         this.Close();
     }
 }
Exemplo n.º 6
0
        public static void Main()
        {
            /* Take in values for numbers of slides and images to parse from HTML */
            Console.WriteLine("How many items do you need?: ");
            string input = Console.ReadLine();
            int    number;

            Int32.TryParse(input, out number);

            /* Take in user response for image content */
            Console.WriteLine("What would you like to search for?: ");
            var search = Console.ReadLine();

            /* Load Shutterstock site and create new WebClient and scrape searching for <img src> tag */
            var       document = new HtmlWeb().Load("https://www.shutterstock.com/search/" + search);
            WebClient client   = new WebClient();
            var       urls     = document.DocumentNode.Descendants("img")
                                 .Select(e => e.GetAttributeValue("src", null))
                                 .Where(s => !String.IsNullOrEmpty(s));
            int x = 0;

            /* Initialize new PPT Presentation using SyncFusion */
            IPresentation pptxDoc = Presentation.Create();

            /* Iterate over urls of images, download to local directory number of specified images */
            foreach (string item in urls)
            {
                if (x == number)
                {
                    break;
                }
                client.DownloadFile(item, search + x + ".jpg");
                Console.WriteLine(item);

                /* Create new Blank slide, take in User title text */
                ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
                Console.WriteLine("Enter title text: ");
                var title = Console.ReadLine();

                /* Open local image files scraped from web and add to slide with user defined title of each slide */
                Stream pictureStream = File.Open("./" + search + x + ".jpg", FileMode.Open);
                slide.Pictures.AddPicture(pictureStream, slide.SlideSize.Width / 2, slide.SlideSize.Height / 2, 250, 250);
                IShape     titleTextBox = slide.AddTextBox(slide.SlideSize.Width / 2, 10, 500, 500);
                IParagraph paragraph    = titleTextBox.TextBody.AddParagraph();
                ITextPart  textPart     = paragraph.AddTextPart();
                textPart.Text = title;
                pictureStream.Dispose();
                x++;
            }

            /* Save PPT project */
            pptxDoc.Save("Sample.pptx");
            pptxDoc.Close();

            Console.ReadLine();
        }
Exemplo n.º 7
0
        void OnButtonClicked(object sender, EventArgs e)
        {
            MemoryStream stream = new MemoryStream();

            //Create a Presentation instance
            using (IPresentation presentation = Syncfusion.Presentation.Presentation.Create())
            {
                //Add a blank slide to the Presentation
                ISlide slide = presentation.Slides.Add(SlideLayoutType.TitleOnly);
                //Add a empty paragraph to the slide
                IParagraph paragraph = ((IShape)slide.Shapes[0]).TextBody.Paragraphs.Add();
                //Apply center alignment to the paragraph
                paragraph.HorizontalAlignment = HorizontalAlignmentType.Center;
                //Add slide title
                ITextPart textPart = paragraph.AddTextPart("Northwind Management Report");
                textPart.Font.Color = ColorObject.FromArgb(46, 116, 181);
                //Get chart data from xml file
                List <ProductDetails> Products = LoadXMLData();
                //Add a new chart to the presentation slide
                IPresentationChart chart = slide.Charts.AddChart(44.64, 133.2, 870.48, 380.16);
                //Set chart type
                chart.ChartType = OfficeChartType.Pie;
                //Set chart title
                chart.ChartTitle = "Best Selling Products";
                //Set chart properties font name and size
                chart.ChartTitleArea.FontName = "Calibri (Body)";
                chart.ChartTitleArea.Size     = 14;
                //Itterate and set the values to chart
                for (int i = 0; i < Products.Count; i++)
                {
                    ProductDetails product = Products[i];
                    chart.ChartData.SetValue(i + 2, 1, product.ProductName);
                    chart.ChartData.SetValue(i + 2, 2, product.Sum);
                }
                //Create a new chart series with the name �Sales�
                AddSeriesForChart(chart);
                //Set the font size of the legend.
                chart.Legend.TextArea.Size = 14;
                //Set the color formatting to the chart
                chart.ChartArea.Fill.ForeColor           = Syncfusion.Drawing.Color.FromArgb(242, 242, 242);
                chart.PlotArea.Fill.ForeColor            = Syncfusion.Drawing.Color.FromArgb(242, 242, 242);
                chart.ChartArea.Border.LinePattern       = OfficeChartLinePattern.None;
                chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 11, 1];
                //Save the presentation instance to a stream.
                presentation.Save(stream);
            }
            stream.Position = 0;
            if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows)
            {
                Xamarin.Forms.DependencyService.Get <ISaveWindowsPhone>().Save("ChartsSample.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", stream);
            }
            else
            {
                Xamarin.Forms.DependencyService.Get <ISave>().Save("ChartsSample.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", stream);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Creates third slide in PowerPoint Presentation file.
        /// </summary>
        private static void CreateThirdSlide(IPresentation presentation)
        {
            ISlide slide2 = presentation.Slides.Add(SlideLayoutType.TwoContent);
            IShape shape1 = slide2.Shapes[0] as IShape;

            shape1.Left   = 0.36 * 72;
            shape1.Top    = 0.51 * 72;
            shape1.Width  = 11.32 * 72;
            shape1.Height = 1.06 * 72;

            //Adds textframe in shape.
            ITextBody   textFrame1  = shape1.TextBody;
            IParagraphs paragraphs1 = textFrame1.Paragraphs;

            paragraphs1.Add();
            IParagraph paragraph1 = paragraphs1[0];
            ITextPart  textpart1  = paragraph1.AddTextPart();

            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Left;

            //Assigns value to textpart.
            textpart1.Text          = "Slide with Image";
            textpart1.Font.FontName = "Helvetica CE 35 Thin";

            //Adds a shape in slide.
            IShape shape2 = slide2.Shapes[1] as IShape;

            shape2.Left   = 8.03 * 72;
            shape2.Top    = 1.96 * 72;
            shape2.Width  = 4.39 * 72;
            shape2.Height = 4.53 * 72;
            ITextBody textFrame2 = shape2.TextBody;

            string text = "Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum tempus.";

            AddTextInThirdSlide(textFrame2, text);

            //Adds a new paragraph and text.
            text = "Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet.";
            AddTextInThirdSlide(textFrame2, text);

            //Adds a new paragraph and text.
            text = "Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula.";
            AddTextInThirdSlide(textFrame2, text);

            //Removes the shape.
            slide2.Shapes.RemoveAt(2);

            //Adds a picture to the slide.
            Assembly assembly     = typeof(Slide).GetTypeInfo().Assembly;
            string   resourcePath = "syncfusion.presentationdemos.winui.Assets.Presentation.tablet.jpg";
            Stream   imageStream  = assembly.GetManifestResourceStream(resourcePath);

            slide2.Shapes.AddPicture(imageStream, 0.81 * 72, 1.96 * 72, 6.63 * 72, 4.43 * 72);
            imageStream.Dispose();
        }
Exemplo n.º 9
0
        /// <summary>
        /// Sets the paragraph properties.
        /// </summary>
        /// <param name="paragraph">Represents the paragraph instance.</param>
        /// <param name="text">Represents the text content.</param>
        private void SetParagraphProperties(IParagraph paragraph, string text)
        {
            paragraph.HorizontalAlignment = HorizontalAlignmentType.Left;
            ITextPart textpart = paragraph.AddTextPart();

            textpart.Text          = text;
            textpart.Font.Color    = ColorObject.White;
            textpart.Font.FontName = "Calibri (Body)";
            textpart.Font.FontSize = 15;
        }
Exemplo n.º 10
0
        /// <summary>
        /// Adds text to the cell.
        /// </summary>
        private static void AddParaInCell(ICell cell, string text)
        {
            ITextBody  textFrame = cell.TextBody;
            IParagraph paragraph = textFrame.Paragraphs.Add();

            paragraph.HorizontalAlignment = HorizontalAlignmentType.Center;
            ITextPart textPart = paragraph.AddTextPart();

            textPart.Text = text;
        }
        /// <summary>
        /// Manipulates the gettingstarted sample.
        /// </summary>
        private void ManipulateSample()
        {
            string       resourcePath = "SampleBrowser.Samples.Presentation.Templates.HelloWorld.pptx";
            Assembly     assembly     = typeof(App).GetTypeInfo().Assembly;
            Stream       fileStream   = assembly.GetManifestResourceStream(resourcePath);
            MemoryStream stream       = new MemoryStream();

            //Open the stream to the presentation instance.
            using (IPresentation presentation = Presentation.Open(fileStream))
            {
                #region Slide1
                ISlide slide      = presentation.Slides[0];
                IShape titleShape = slide.Shapes[0] as IShape;
                //Sets the shape size and position.
                SetShapeBounds(titleShape, 23.76, 41.76, 900, 126);

                //Sets the properties for the textbody of the shape.
                ITextBody   textFrame  = (slide.Shapes[0] as IShape).TextBody;
                IParagraphs paragraphs = textFrame.Paragraphs;
                IParagraph  paragraph  = paragraphs.Add();
                paragraph.HorizontalAlignment = HorizontalAlignmentType.Center;
                ITextPart textPart = paragraph.AddTextPart();
                textPart.Text          = "Essential Presentation";
                textPart.Font.CapsType = TextCapsType.All;
                textPart.Font.FontName = "Adobe Garamond Pro";
                textPart.Font.Bold     = true;
                textPart.Font.FontSize = 40;

                //Sets the shape size and position.
                IShape subtitle = slide.Shapes[1] as IShape;
                SetShapeBounds(subtitle, 36, 216, 849.6, 122.4);

                //Sets the properties for the textbody of the shape.
                textFrame = (slide.Shapes[1] as IShape).TextBody;
                textFrame.VerticalAlignment = VerticalAlignmentType.Top;
                paragraphs = textFrame.Paragraphs;
                AddParagraphProperties(paragraphs.Add(), "Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum tempus.Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet.");

                //Add text content to the paragraph.
                AddParagraphProperties(paragraphs.Add(), "Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet. Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula.");
                #endregion

                //Saves the presentation into the stream.
                presentation.Save(stream);
            }
            stream.Position = 0;
            if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows)
            {
                Xamarin.Forms.DependencyService.Get <ISaveWindowsPhone>().Save("GettingStartedSample.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", stream);
            }
            else
            {
                Xamarin.Forms.DependencyService.Get <ISave>().Save("GettingStartedSample.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", stream);
            }
        }
Exemplo n.º 12
0
        void AddParagraphData(IParagraph paragraph, string text, string fontname, int fontsize, bool isBolt)
        {
            ITextPart textpart = paragraph.AddTextPart();

            paragraph.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart.Text          = text;
            textpart.Font.FontName = fontname;
            textpart.Font.FontSize = fontsize;
            textpart.Font.Color    = ColorObject.Black;
            textpart.Font.Bold     = isBolt;
        }
Exemplo n.º 13
0
        /// <summary>
        /// Sets the paragraph properties for the picture slide.
        /// </summary>
        /// <param name="paragraphs">Represents the paragraph collection instance.</param>
        /// <param name="text">Represents the text content.</param>
        private void SetParagraphPropertiesForPictureSlide(IParagraphs paragraphs, string text)
        {
            IParagraph paragraph = paragraphs.Add();
            ITextPart  textpart  = paragraph.AddTextPart();

            paragraph.HorizontalAlignment = HorizontalAlignmentType.Left;

            textpart.Text          = text;
            textpart.Font.FontName = "Helvetica CE 35 Thin";
            textpart.Font.FontSize = 16;
        }
Exemplo n.º 14
0
        /// <summary>
        /// Adds a new paragraph and text.
        /// </summary>
        private static void AddTextInThirdSlide(ITextBody textFrame, string text)
        {
            //Adds a new paragraph and text.
            IParagraphs paragraphs = textFrame.Paragraphs;
            IParagraph  paragraph  = paragraphs.Add();
            ITextPart   textpart   = paragraph.AddTextPart();

            textpart.Text = text;
            paragraph.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart.Font.FontName        = "Helvetica CE 35 Thin";
            textpart.Font.FontSize        = 16;
        }
Exemplo n.º 15
0
        void OnButtonClicked(object sender, EventArgs e)
        {
            MemoryStream stream = new MemoryStream();

            //Opens the existing presentation stream.
            using (IPresentation presentation = Syncfusion.Presentation.Presentation.Create())
            {
                ISlide     slide     = presentation.Slides.Add(SlideLayoutType.TitleOnly);
                IParagraph paragraph = ((IShape)slide.Shapes[0]).TextBody.Paragraphs.Add();
                //Apply center alignment to the paragraph
                paragraph.HorizontalAlignment = HorizontalAlignmentType.Center;
                //Add slide title
                ITextPart textPart = paragraph.AddTextPart("Northwind Management Report");
                textPart.Font.Color = ColorObject.FromArgb(46, 116, 181);
                //Get chart data from xml file
                List <ProductDetails> Products = LoadXMLData();
                //Add a new chart to the presentation slide
                IPresentationChart chart = slide.Charts.AddChart(44.64, 133.2, 870.48, 380.16);
                //Set chart type
                chart.ChartType = OfficeChartType.Pie;
                //Set chart title
                chart.ChartTitle = "Best Selling Products";
                //Set chart properties font name and size
                chart.ChartTitleArea.FontName = "Calibri (Body)";
                chart.ChartTitleArea.Size     = 14;
                for (int i = 0; i < Products.Count; i++)
                {
                    ProductDetails product = Products[i];
                    chart.ChartData.SetValue(i + 2, 1, product.ProductName);
                    chart.ChartData.SetValue(i + 2, 2, product.Sum);
                }
                //Create a new chart series with the name “Sales”
                AddSeriesForChart(chart);
                //Setting the font size of the legend.
                chart.Legend.TextArea.Size = 14;
                //Setting background color
                chart.ChartArea.Fill.ForeColor           = Syncfusion.Drawing.Color.FromArgb(242, 242, 242);
                chart.PlotArea.Fill.ForeColor            = Syncfusion.Drawing.Color.FromArgb(242, 242, 242);
                chart.ChartArea.Border.LinePattern       = OfficeChartLinePattern.None;
                chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 11, 1];
                //Saves the presentation instance to the stream.
                presentation.Save(stream);
            }
            stream.Position = 0;

            if (stream != null)
            {
                SaveiOS iOSSave = new SaveiOS();
                iOSSave.Save("ChartsPresentation.pptx", "application/mspowerpoint", stream);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Adds a new paragraph and text.
        /// </summary>
        private static void AddTextInSecondSlide(ITextBody textFrame, string text)
        {
            //Adds a new paragraph and text.
            IParagraphs paragraphs = textFrame.Paragraphs;
            IParagraph  paragraph  = paragraphs.Add();

            paragraph.HorizontalAlignment = HorizontalAlignmentType.Left;
            ITextPart textpart = paragraph.AddTextPart();

            textpart.Text          = text;
            textpart.Font.FontName = "Calibri (Body)";
            textpart.Font.FontSize = 15;
            textpart.Font.Color    = ColorObject.Black;
        }
        public ActionResult CreatingChart(string Browser)
        {
            IPresentation presentation = Presentation.Create();
            ISlide        slide        = presentation.Slides.Add(SlideLayoutType.TitleOnly);
            IParagraph    paragraph    = ((IShape)slide.Shapes[0]).TextBody.Paragraphs.Add();

            //Apply center alignment to the paragraph
            paragraph.HorizontalAlignment = HorizontalAlignmentType.Center;
            //Add slide title
            ITextPart textPart = paragraph.AddTextPart("Northwind Management Report");

            textPart.Font.Color = ColorObject.FromArgb(46, 116, 181);
            //Get chart data from xml file
            DataSet dataSet = new DataSet();
            //Load XML file
            string dataPath = ResolveApplicationDataPath("Products.xml");

            dataSet.ReadXml(dataPath);
            //Add a new chart to the presentation slide
            IPresentationChart chart = slide.Charts.AddChart(44.64, 133.2, 870.48, 380.16);

            //Set chart type
            chart.ChartType = OfficeChartType.Pie;
            //Set chart title
            chart.ChartTitle = "Best Selling Products";
            //Set chart properties font name and size
            chart.ChartTitleArea.FontName = "Calibri (Body)";
            chart.ChartTitleArea.Size     = 14;
            for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
            {
                chart.ChartData.SetValue(i + 2, 1, dataSet.Tables[0].Rows[i].ItemArray[1]);
                chart.ChartData.SetValue(i + 2, 2, dataSet.Tables[0].Rows[i].ItemArray[2]);
            }
            //Create a new chart series with the name �Sales�
            AddSeriesForChart(chart);
            //Setting the font size of the legend.
            chart.Legend.TextArea.Size = 14;
            //Setting background color
            chart.ChartArea.Fill.ForeColor           = System.Drawing.Color.FromArgb(242, 242, 242);
            chart.PlotArea.Fill.ForeColor            = System.Drawing.Color.FromArgb(242, 242, 242);
            chart.ChartArea.Border.LinePattern       = OfficeChartLinePattern.None;
            chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 11, 1];
            //  Saves the presentation
            return(new PresentationResult(presentation, "Chart.pptx", HttpContext.ApplicationInstance.Response));
        }
Exemplo n.º 18
0
        void AddTableData(ICell cell1, ITable table, ITextBody textFrame1, IParagraph paragraph1)
        {
            Dictionary <string, Dictionary <string, string> > products = LoadXMLData();
            int count = 0;

            for (int i = 1; i <= 5; i++)
            {
                for (int j = 0; j <= 5; j++)
                {
                    cell1      = table.Rows[i].Cells[j];
                    textFrame1 = cell1.TextBody;
                    paragraph1 = textFrame1.Paragraphs.Add();
                    paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
                    ITextPart textpart1 = paragraph1.AddTextPart();
                    textpart1.Text = products.Values.ToList()[0].Values.ToList()[count];
                    count++;
                }
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// Creates the slide with picture in the presentation.
        /// </summary>
        /// <param name="presentation">Represents the presentation instance.</param>
        private void CreateSlideWithPicture(IPresentation presentation)
        {
            #region Slide3
            ISlide slide = presentation.Slides.Add(SlideLayoutType.TwoContent);
            IShape shape = slide.Shapes[0] as IShape;
            SetShapeBounds(shape, 25.92, 36.72, 815.04, 76.32);

            //Adds textframe in shape
            ITextBody textFrame = shape.TextBody;

            //Instance to hold paragraphs in textframe
            IParagraphs paragraphs = textFrame.Paragraphs;
            paragraphs.Add();
            IParagraph paragraph = paragraphs[0];
            ITextPart  textpart  = paragraph.AddTextPart();
            paragraph.HorizontalAlignment = HorizontalAlignmentType.Left;

            //Assigns value to textpart
            textpart.Text          = "Slide with Image";
            textpart.Font.FontName = "Helvetica CE 35 Thin";

            //Adds shape in slide
            shape = slide.Shapes[1] as IShape;
            SetShapeBounds(shape, 578.16, 141.12, 316.08, 3326.16);
            textFrame = shape.TextBody;

            //Instance to hold paragraphs in textframe
            paragraphs = textFrame.Paragraphs;
            SetParagraphPropertiesForPictureSlide(paragraphs, "Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum tempus.");
            SetParagraphPropertiesForPictureSlide(paragraphs, "Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet.");
            SetParagraphPropertiesForPictureSlide(paragraphs, "Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula.");
            IShape shape3 = (IShape)slide.Shapes[2];
            slide.Shapes.RemoveAt(2);

            //Adds picture in the shape
            string   resourcePath = "SampleBrowser.Samples.Presentation.Templates.tablet.jpg";
            Assembly assembly     = typeof(App).GetTypeInfo().Assembly;
            Stream   fileStream   = assembly.GetManifestResourceStream(resourcePath);
            slide.Shapes.AddPicture(fileStream, 58.32, 141.12, 477.36, 318.96);
            fileStream.Close();
            #endregion
        }
Exemplo n.º 20
0
        /// <summary>
        /// Creates slide with title content.
        /// </summary>
        /// <param name="presentation">Represents the presentation instance.</param>
        private void CreateSlideWithTitle(IPresentation presentation)
        {
            #region Slide1
            //Sets the size and position for the shape.
            ISlide slide = presentation.Slides[0];
            IShape shape = slide.Shapes[0] as IShape;
            //Sets the properties of the shape.
            SetShapeBounds(shape, 108, 139.68, 743.04, 144);

            //Sets the text property for the shape.
            ITextBody   textFrame  = shape.TextBody;
            IParagraphs paragraphs = textFrame.Paragraphs;
            IParagraph  paragraph  = paragraphs.Add();
            ITextPart   textPart   = paragraph.AddTextPart();
            paragraphs[0].IndentLevelNumber = 0;
            textPart.Text          = "ESSENTIAL PRESENTATION";
            textPart.Font.FontName = "HelveticaNeue LT 65 Medium";
            textPart.Font.FontSize = 48;
            textPart.Font.Bold     = true;
            slide.Shapes.RemoveAt(1);
            #endregion
        }
Exemplo n.º 21
0
        private void CreateFirstSlide(IPresentation presentation)
        {
            ISlide slide1 = presentation.Slides[0];
            IShape shape1 = slide1.Shapes[0] as IShape;

            shape1.Left   = 1.5 * 72;
            shape1.Top    = 1.94 * 72;
            shape1.Width  = 10.32 * 72;
            shape1.Height = 2 * 72;

            ITextBody   textFrame1  = shape1.TextBody;
            IParagraphs paragraphs1 = textFrame1.Paragraphs;
            IParagraph  paragraph1  = paragraphs1.Add();
            ITextPart   textPart1   = paragraph1.AddTextPart();

            paragraphs1[0].IndentLevelNumber = 0;
            textPart1.Text          = "Essential Presentation";
            textPart1.Font.FontName = "HelveticaNeue LT 65 Medium";
            textPart1.Font.CapsType = TextCapsType.All;
            textPart1.Font.FontSize = 48;
            textPart1.Font.Bold     = true;
            slide1.Shapes.RemoveAt(1);
        }
Exemplo n.º 22
0
        public ActionResult Connector(string Browser)
        {
            //Create an instance for PowerPoint
            IPresentation presentation = Syncfusion.Presentation.Presentation.Create();

            //Add a blank slide to Presentation
            ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);

            //Add header shape
            IShape headerTextBox = slide.Shapes.AddTextBox(58.44, 53.85, 221.93, 81.20);
            //Add a paragraph into the text box
            IParagraph paragraph = headerTextBox.TextBody.AddParagraph("Flow chart with ");
            //Add a textPart
            ITextPart textPart = paragraph.AddTextPart("Connector");

            //Change the color of the font
            textPart.Font.Color = ColorObject.FromArgb(44, 115, 230);
            //Make the textpart bold
            textPart.Font.Bold = true;
            //Set the font size of the paragraph
            paragraph.Font.FontSize = 28;

            //Add start shape to slide
            IShape startShape = slide.Shapes.AddShape(AutoShapeType.FlowChartTerminator, 420.45, 36.35, 133.93, 50.39);

            //Add a paragraph into the start shape text body
            AddParagraph(startShape, "Start", ColorObject.FromArgb(255, 149, 34));

            //Add alarm shape to slide
            IShape alarmShape = slide.Shapes.AddShape(AutoShapeType.FlowChartProcess, 420.45, 126.72, 133.93, 50.39);

            //Add a paragraph into the alarm shape text body
            AddParagraph(alarmShape, "Alarm Rings", ColorObject.FromArgb(255, 149, 34));

            //Add condition shape to slide
            IShape conditionShape = slide.Shapes.AddShape(AutoShapeType.FlowChartDecision, 420.45, 222.42, 133.93, 97.77);

            //Add a paragraph into the condition shape text body
            AddParagraph(conditionShape, "Ready to Get Up ?", ColorObject.FromArgb(44, 115, 213));

            //Add wake up shape to slide
            IShape wakeUpShape = slide.Shapes.AddShape(AutoShapeType.FlowChartProcess, 420.45, 361.52, 133.93, 50.39);

            //Add a paragraph into the wake up shape text body
            AddParagraph(wakeUpShape, "Wake Up", ColorObject.FromArgb(44, 115, 213));

            //Add end shape to slide
            IShape endShape = slide.Shapes.AddShape(AutoShapeType.FlowChartTerminator, 420.45, 453.27, 133.93, 50.39);

            //Add a paragraph into the end shape text body
            AddParagraph(endShape, "End", ColorObject.FromArgb(44, 115, 213));

            //Add snooze shape to slide
            IShape snoozeShape = slide.Shapes.AddShape(AutoShapeType.FlowChartProcess, 624.85, 245.79, 159.76, 50.02);

            //Add a paragraph into the snooze shape text body
            AddParagraph(snoozeShape, "Hit Snooze button", ColorObject.FromArgb(255, 149, 34));

            //Add relay shape to slide
            IShape relayShape = slide.Shapes.AddShape(AutoShapeType.FlowChartDelay, 624.85, 127.12, 159.76, 49.59);

            //Add a paragraph into the relay shape text body
            AddParagraph(relayShape, "Relay", ColorObject.FromArgb(255, 149, 34));

            //Connect the start shape with alarm shape using connector
            IConnector connector1 = slide.Shapes.AddConnector(ConnectorType.Straight, startShape, 2, alarmShape, 0);

            //Set the arrow style for the connector
            connector1.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the alarm shape with condition shape using connector
            IConnector connector2 = slide.Shapes.AddConnector(ConnectorType.Straight, alarmShape, 2, conditionShape, 0);

            //Set the arrow style for the connector
            connector2.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the condition shape with snooze shape using connector
            IConnector connector3 = slide.Shapes.AddConnector(ConnectorType.Straight, conditionShape, 3, snoozeShape, 1);

            //Set the arrow style for the connector
            connector3.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the snooze shape with relay shape using connector
            IConnector connector4 = slide.Shapes.AddConnector(ConnectorType.Straight, snoozeShape, 0, relayShape, 2);

            //Set the arrow style for the connector
            connector4.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the relay shape with alarm shape using connector
            IConnector connector5 = slide.Shapes.AddConnector(ConnectorType.Straight, relayShape, 1, alarmShape, 3);

            //Set the arrow style for the connector
            connector5.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the condition shape with wake up shape using connector
            IConnector connector6 = slide.Shapes.AddConnector(ConnectorType.Straight, conditionShape, 2, wakeUpShape, 0);

            //Set the arrow style for the connector
            connector6.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the wake up shape with end shape using connector
            IConnector connector7 = slide.Shapes.AddConnector(ConnectorType.Straight, wakeUpShape, 2, endShape, 0);

            //Set the arrow style for the connector
            connector7.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Add No textbox to slide
            IShape noTextBox = slide.Shapes.AddTextBox(564.02, 245.43, 51.32, 26.22);

            //Add a paragraph into the text box
            noTextBox.TextBody.AddParagraph("No");

            //Add Yes textbox to slide
            IShape yesTextBox = slide.Shapes.AddTextBox(487.21, 327.99, 50.09, 26.23);

            //Add a paragraph into the text box
            yesTextBox.TextBody.AddParagraph("Yes");

            MemoryStream ms = new MemoryStream();

            //Saves the presentation to the memory stream.
            presentation.Save(ms);
            //Set the position of the stream to beginning.
            ms.Position = 0;

            //Initialize the file stream to download the presentation.
            FileStreamResult fileStreamResult = new FileStreamResult(ms, "application/vnd.openxmlformats-officedocument.presentationml.presentation");

            //Set the file name.
            fileStreamResult.FileDownloadName = "Connector.pptx";

            return(fileStreamResult);
        }
Exemplo n.º 23
0
        private void btnCreatePresn_Click(object sender, EventArgs e)
        {
            //Create an instance for PowerPoint
            IPresentation presentation = Presentation.Create();

            //Add a blank slide to Presentation
            ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);

            //Add header shape
            IShape headerTextBox = slide.Shapes.AddTextBox(58.44, 53.85, 221.93, 81.20);
            //Add a paragraph into the text box
            IParagraph paragraph = headerTextBox.TextBody.AddParagraph("Flow chart with ");
            //Add a textPart
            ITextPart textPart = paragraph.AddTextPart("Connector");

            //Change the color of the font
            textPart.Font.Color = ColorObject.FromArgb(44, 115, 230);
            //Make the textpart bold
            textPart.Font.Bold = true;
            //Set the font size of the paragraph
            paragraph.Font.FontSize = 28;

            //Add start shape to slide
            IShape startShape = slide.Shapes.AddShape(AutoShapeType.FlowChartTerminator, 420.45, 36.35, 133.93, 50.39);

            //Add a paragraph into the start shape text body
            AddParagraph(startShape, "Start", ColorObject.FromArgb(255, 149, 34));

            //Add alarm shape to slide
            IShape alarmShape = slide.Shapes.AddShape(AutoShapeType.FlowChartProcess, 420.45, 126.72, 133.93, 50.39);

            //Add a paragraph into the alarm shape text body
            AddParagraph(alarmShape, "Alarm Rings", ColorObject.FromArgb(255, 149, 34));

            //Add condition shape to slide
            IShape conditionShape = slide.Shapes.AddShape(AutoShapeType.FlowChartDecision, 420.45, 222.42, 133.93, 97.77);

            //Add a paragraph into the condition shape text body
            AddParagraph(conditionShape, "Ready to Get Up ?", ColorObject.FromArgb(44, 115, 213));

            //Add wake up shape to slide
            IShape wakeUpShape = slide.Shapes.AddShape(AutoShapeType.FlowChartProcess, 420.45, 361.52, 133.93, 50.39);

            //Add a paragraph into the wake up shape text body
            AddParagraph(wakeUpShape, "Wake Up", ColorObject.FromArgb(44, 115, 213));

            //Add end shape to slide
            IShape endShape = slide.Shapes.AddShape(AutoShapeType.FlowChartTerminator, 420.45, 453.27, 133.93, 50.39);

            //Add a paragraph into the end shape text body
            AddParagraph(endShape, "End", ColorObject.FromArgb(44, 115, 213));

            //Add snooze shape to slide
            IShape snoozeShape = slide.Shapes.AddShape(AutoShapeType.FlowChartProcess, 624.85, 245.79, 159.76, 50.02);

            //Add a paragraph into the snooze shape text body
            AddParagraph(snoozeShape, "Hit Snooze button", ColorObject.FromArgb(255, 149, 34));

            //Add relay shape to slide
            IShape relayShape = slide.Shapes.AddShape(AutoShapeType.FlowChartDelay, 624.85, 127.12, 159.76, 49.59);

            //Add a paragraph into the relay shape text body
            AddParagraph(relayShape, "Relay", ColorObject.FromArgb(255, 149, 34));

            //Connect the start shape with alarm shape using connector
            IConnector connector1 = slide.Shapes.AddConnector(ConnectorType.Straight, startShape, 2, alarmShape, 0);

            //Set the arrow style for the connector
            connector1.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the alarm shape with condition shape using connector
            IConnector connector2 = slide.Shapes.AddConnector(ConnectorType.Straight, alarmShape, 2, conditionShape, 0);

            //Set the arrow style for the connector
            connector2.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the condition shape with snooze shape using connector
            IConnector connector3 = slide.Shapes.AddConnector(ConnectorType.Straight, conditionShape, 3, snoozeShape, 1);

            //Set the arrow style for the connector
            connector3.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the snooze shape with relay shape using connector
            IConnector connector4 = slide.Shapes.AddConnector(ConnectorType.Straight, snoozeShape, 0, relayShape, 2);

            //Set the arrow style for the connector
            connector4.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the relay shape with alarm shape using connector
            IConnector connector5 = slide.Shapes.AddConnector(ConnectorType.Straight, relayShape, 1, alarmShape, 3);

            //Set the arrow style for the connector
            connector5.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the condition shape with wake up shape using connector
            IConnector connector6 = slide.Shapes.AddConnector(ConnectorType.Straight, conditionShape, 2, wakeUpShape, 0);

            //Set the arrow style for the connector
            connector6.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the wake up shape with end shape using connector
            IConnector connector7 = slide.Shapes.AddConnector(ConnectorType.Straight, wakeUpShape, 2, endShape, 0);

            //Set the arrow style for the connector
            connector7.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Add No textbox to slide
            IShape noTextBox = slide.Shapes.AddTextBox(564.02, 245.43, 51.32, 26.22);

            //Add a paragraph into the text box
            noTextBox.TextBody.AddParagraph("No");

            //Add Yes textbox to slide
            IShape yesTextBox = slide.Shapes.AddTextBox(487.21, 327.99, 50.09, 26.23);

            //Add a paragraph into the text box
            yesTextBox.TextBody.AddParagraph("Yes");

            //Saves the presentation
            presentation.Save("ConnectorSample.pptx");

            if (System.Windows.MessageBox.Show("Do you want to view the generated Presentation?", "Presentation Created",
                                               MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
            {
#if !NETCore
                System.Diagnostics.Process.Start("ConnectorSample.pptx");
#else
                System.Diagnostics.Process process = new System.Diagnostics.Process();
                process.StartInfo = new System.Diagnostics.ProcessStartInfo("ConnectorSample.pptx")
                {
                    UseShellExecute = true
                };
                process.Start();
#endif
                this.Close();
            }
        }
Exemplo n.º 24
0
        void OnButtonClicked(object sender, EventArgs e)
        {
            string resourcePath = "";

#if COMMONSB
            resourcePath = "SampleBrowser.Samples.Presentation.Samples.Templates.Images.pptx";
#else
            resourcePath = "SampleBrowser.Presentation.Samples.Templates.Images.pptx";
#endif
            Assembly assembly   = typeof(Images).GetTypeInfo().Assembly;
            Stream   fileStream = assembly.GetManifestResourceStream(resourcePath);

            IPresentation presentation = Syncfusion.Presentation.Presentation.Open(fileStream);

            #region Slide1
            ISlide slide1 = presentation.Slides[0];
            IShape shape1 = (IShape)slide1.Shapes[0];
            shape1.Left   = 1.27 * 72;
            shape1.Top    = 0.56 * 72;
            shape1.Width  = 9.55 * 72;
            shape1.Height = 5.4 * 72;

            ITextBody   textFrame  = shape1.TextBody;
            IParagraphs paragraphs = textFrame.Paragraphs;
            paragraphs.Add();
            IParagraph paragraph = paragraphs[0];
            paragraph.HorizontalAlignment = HorizontalAlignmentType.Left;
            ITextParts textParts = paragraph.TextParts;
            textParts.Add();
            ITextPart textPart = textParts[0];
            textPart.Text          = "Essential Presentation ";
            textPart.Font.CapsType = TextCapsType.All;
            textPart.Font.FontName = "Calibri Light (Headings)";
            textPart.Font.FontSize = 80;
            textPart.Font.Color    = ColorObject.Black;
            #endregion

            #region Slide2
            ISlide slide2 = presentation.Slides.Add(SlideLayoutType.ContentWithCaption);
            slide2.Background.Fill.FillType        = FillType.Solid;
            slide2.Background.Fill.SolidFill.Color = ColorObject.White;

            //Adds shape in slide
            shape1        = (IShape)slide2.Shapes[0];
            shape1.Left   = 0.47 * 72;
            shape1.Top    = 1.15 * 72;
            shape1.Width  = 3.5 * 72;
            shape1.Height = 4.91 * 72;

            ITextBody textFrame1 = shape1.TextBody;

            //Instance to hold paragraphs in textframe
            IParagraphs paragraphs1 = textFrame1.Paragraphs;
            IParagraph  paragraph1  = paragraphs1.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Left;
            ITextPart textpart1 = paragraph1.AddTextPart();
            textpart1.Text          = "Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum tempus.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            IParagraph paragraph2 = paragraphs1.Add();
            paragraph2.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph2.AddTextPart();
            textpart1.Text          = "Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            IParagraph paragraph3 = paragraphs1.Add();
            paragraph3.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph3.AddTextPart();
            textpart1.Text          = "Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            IParagraph paragraph4 = paragraphs1.Add();
            paragraph4.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph4.AddTextPart();
            textpart1.Text          = "Lorem tortor neque, purus taciti quis id. Elementum integer orci accumsan minim phasellus vel.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            slide2.Shapes.RemoveAt(1);
            slide2.Shapes.RemoveAt(1);

            //Adds picture in the shape
            resourcePath = "";
#if COMMONSB
            resourcePath = "SampleBrowser.Samples.Presentation.Samples.Templates.tablet.jpg";
#else
            resourcePath = "SampleBrowser.Presentation.Samples.Templates.tablet.jpg";
#endif
            assembly   = typeof(Images).GetTypeInfo().Assembly;
            fileStream = assembly.GetManifestResourceStream(resourcePath);
            slide2.Shapes.AddPicture(fileStream, 5.18 * 72, 1.15 * 72, 7.3 * 72, 5.31 * 72);
            fileStream.Dispose();
            #endregion

            MemoryStream stream = new MemoryStream();
            presentation.Save(stream);
            presentation.Close();
            stream.Position = 0;
            if (Device.RuntimePlatform == Device.UWP)
            {
                Xamarin.Forms.DependencyService.Get <ISaveWindowsPhone>().Save("ImagesSample.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", stream);
            }
            else
            {
                Xamarin.Forms.DependencyService.Get <ISave>().Save("ImagesSample.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", stream);
            }
        }
        private void SlideWithComments3(IPresentation presentation)
        {
            xValue = 250;
            yValue = 100;
            ISlide slide3 = presentation.Slides.Add(SlideLayoutType.ContentWithCaption);

            slide3.Background.Fill.FillType        = FillType.Solid;
            slide3.Background.Fill.SolidFill.Color = ColorObject.White;

            //Adds shape in slide
            IShape shape2 = (IShape)slide3.Shapes[0];

            shape2.Left   = 0.47 * 72;
            shape2.Top    = 1.15 * 72;
            shape2.Width  = 3.5 * 72;
            shape2.Height = 4.91 * 72;

            ITextBody textFrame1 = shape2.TextBody;

            //Instance to hold paragraphs in textframe
            IParagraphs paragraphs1 = textFrame1.Paragraphs;
            IParagraph  paragraph1  = paragraphs1.Add();

            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Left;
            ITextPart textpart1 = paragraph1.AddTextPart();

            textpart1.Text          = "Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum tempus.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            IParagraph paragraph2 = paragraphs1.Add();

            paragraph2.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph2.AddTextPart();
            textpart1.Text          = "Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            IParagraph paragraph3 = paragraphs1.Add();

            paragraph3.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph3.AddTextPart();
            textpart1.Text          = "Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            IParagraph paragraph4 = paragraphs1.Add();

            paragraph4.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph4.AddTextPart();
            textpart1.Text          = "Lorem tortor neque, purus taciti quis id. Elementum integer orci accumsan minim phasellus vel.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            slide3.Shapes.RemoveAt(1);
            slide3.Shapes.RemoveAt(1);

            //Adds picture in the shape
            string   dataPath    = ResolveApplicationImagePath("tablet.jpg");
            Stream   imageStream = System.IO.File.Open(dataPath, FileMode.Open);
            IPicture picture1    = slide3.Shapes.AddPicture(imageStream, 5.18 * 72, 1.15 * 72, 7.3 * 72, 5.31 * 72);

            imageStream.Close();

            //Add comment to the slide
            IComment comment = slide3.Comments.Add(xValue, yValue, "Author3", "A3", "Can we use a different font family for this text?", DateTime.Now);

            //Add reply to a parent comment
            slide3.Comments.Add("Author1", "A1", "Please specify the desired font for modification", DateTime.Now, comment);
        }
Exemplo n.º 26
0
        private void OnButtonClicked(object sender, EventArgs e)
        {
            string resourcePath = "";

                        #if COMMONSB
            resourcePath = "SampleBrowser.Samples.Presentation.Samples.Templates.Images.pptx";
            #else
            resourcePath = "SampleBrowser.Presentation.Samples.Templates.Images.pptx";
            #endif
            Assembly assembly   = typeof(Comments).GetTypeInfo().Assembly;
            Stream   fileStream = assembly.GetManifestResourceStream(resourcePath);

            IPresentation presentation = Syncfusion.Presentation.Presentation.Open(fileStream);

            #region Slide 1
            ISlide slide1 = presentation.Slides[0];
            IShape shape1 = (IShape)slide1.Shapes[0];
            shape1.Left   = 1.27 * 72;
            shape1.Top    = 0.85 * 72;
            shape1.Width  = 10.86 * 72;
            shape1.Height = 3.74 * 72;

            ITextBody   textFrame  = shape1.TextBody;
            IParagraphs paragraphs = textFrame.Paragraphs;
            paragraphs.Add();
            IParagraph paragraph = paragraphs[0];
            paragraph.HorizontalAlignment = HorizontalAlignmentType.Left;
            ITextParts textParts = paragraph.TextParts;
            textParts.Add();
            ITextPart textPart = textParts[0];
            textPart.Text          = "Essential Presentation ";
            textPart.Font.CapsType = TextCapsType.All;
            textPart.Font.FontName = "Calibri Light (Headings)";
            textPart.Font.FontSize = 80;
            textPart.Font.Color    = ColorObject.Black;

            IComment comment = slide1.Comments.Add(0.35, 0.04, "Author1", "A1", "Essential Presentation is available from 13.1 versions of Essential Studio", DateTime.Now);
            #endregion

            #region Slide2

            ISlide slide2 = presentation.Slides.Add(SlideLayoutType.Blank);

            IPresentationChart chart = slide2.Shapes.AddChart(230, 80, 500, 400);

            //Specifies the chart title

            chart.ChartTitle = "Sales Analysis";

            //Sets chart data - Row1

            chart.ChartData.SetValue(1, 2, "Jan");

            chart.ChartData.SetValue(1, 3, "Feb");

            chart.ChartData.SetValue(1, 4, "March");

            //Sets chart data - Row2

            chart.ChartData.SetValue(2, 1, 2010);

            chart.ChartData.SetValue(2, 2, 60);

            chart.ChartData.SetValue(2, 3, 70);

            chart.ChartData.SetValue(2, 4, 80);

            //Sets chart data - Row3

            chart.ChartData.SetValue(3, 1, 2011);

            chart.ChartData.SetValue(3, 2, 80);

            chart.ChartData.SetValue(3, 3, 70);

            chart.ChartData.SetValue(3, 4, 60);

            //Sets chart data - Row4

            chart.ChartData.SetValue(4, 1, 2012);

            chart.ChartData.SetValue(4, 2, 60);

            chart.ChartData.SetValue(4, 3, 70);

            chart.ChartData.SetValue(4, 4, 80);

            //Creates a new chart series with the name

            IOfficeChartSerie serieJan = chart.Series.Add("Jan");

            //Sets the data range of chart serie – start row, start column, end row, end column

            serieJan.Values = chart.ChartData[2, 2, 4, 2];

            //Creates a new chart series with the name

            IOfficeChartSerie serieFeb = chart.Series.Add("Feb");

            //Sets the data range of chart serie – start row, start column, end row, end column

            serieFeb.Values = chart.ChartData[2, 3, 4, 3];

            //Creates a new chart series with the name

            IOfficeChartSerie serieMarch = chart.Series.Add("March");

            //Sets the data range of chart series – start row, start column, end row, end column

            serieMarch.Values = chart.ChartData[2, 4, 4, 4];

            //Sets the data range of the category axis

            chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 4, 1];

            //Specifies the chart type

            chart.ChartType = OfficeChartType.Column_Clustered_3D;


            slide2.Comments.Add(0.35, 0.04, "Author2", "A2", "All 3D-chart types are supported in Presentation library.", DateTime.Now);
            #endregion

            #region Slide3
            ISlide slide3 = presentation.Slides.Add(SlideLayoutType.ContentWithCaption);
            slide3.Background.Fill.FillType        = FillType.Solid;
            slide3.Background.Fill.SolidFill.Color = ColorObject.White;

            //Adds shape in slide
            IShape shape2 = (IShape)slide3.Shapes[0];
            shape2.Left   = 0.47 * 72;
            shape2.Top    = 1.15 * 72;
            shape2.Width  = 3.5 * 72;
            shape2.Height = 4.91 * 72;

            ITextBody textFrame1 = shape2.TextBody;

            //Instance to hold paragraphs in textframe
            IParagraphs paragraphs1 = textFrame1.Paragraphs;
            IParagraph  paragraph1  = paragraphs1.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Left;
            ITextPart textpart1 = paragraph1.AddTextPart();
            textpart1.Text          = "Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum tempus.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            IParagraph paragraph2 = paragraphs1.Add();
            paragraph2.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph2.AddTextPart();
            textpart1.Text          = "Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            IParagraph paragraph3 = paragraphs1.Add();
            paragraph3.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph3.AddTextPart();
            textpart1.Text          = "Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            IParagraph paragraph4 = paragraphs1.Add();
            paragraph4.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph4.AddTextPart();
            textpart1.Text          = "Lorem tortor neque, purus taciti quis id. Elementum integer orci accumsan minim phasellus vel.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            slide3.Shapes.RemoveAt(1);
            slide3.Shapes.RemoveAt(1);

            //Adds picture in the shape
            resourcePath = "";
#if COMMONSB
            resourcePath = "SampleBrowser.Samples.Presentation.Samples.Templates.tablet.jpg";
#else
            resourcePath = "SampleBrowser.Presentation.Samples.Templates.tablet.jpg";
#endif
            fileStream = assembly.GetManifestResourceStream(resourcePath);

            IPicture picture1 = slide3.Shapes.AddPicture(fileStream, 5.18 * 72, 1.15 * 72, 7.3 * 72, 5.31 * 72);
            fileStream.Dispose();

            slide3.Comments.Add(0.14, 0.04, "Author3", "A3", "Can we use a different font family for this text?", DateTime.Now);
            #endregion

            MemoryStream memoryStream = new MemoryStream();

            presentation.Save(memoryStream);
            presentation.Close();
            memoryStream.Position = 0;
            if (Device.RuntimePlatform == Device.UWP)
            {
                Xamarin.Forms.DependencyService.Get <ISaveWindowsPhone>().Save("CommentsSamples.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", memoryStream);
            }
            else
            {
                Xamarin.Forms.DependencyService.Get <ISave>().Save("CommentsSamples.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", memoryStream);
            }
        }
Exemplo n.º 27
0
        private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            //Create an instance for PowerPoint
            IPresentation presentation = Presentation.Create();

            //Add a blank slide to Presentation
            ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);

            //Add header shape
            IShape headerTextBox = slide.Shapes.AddTextBox(58.44, 53.85, 221.93, 81.20);
            //Add a paragraph into the text box
            IParagraph paragraph = headerTextBox.TextBody.AddParagraph("Flow chart with ");
            //Add a textPart
            ITextPart textPart = paragraph.AddTextPart("Connector");

            //Change the color of the font
            textPart.Font.Color = ColorObject.FromArgb(44, 115, 230);
            //Make the textpart bold
            textPart.Font.Bold = true;
            //Set the font size of the paragraph
            paragraph.Font.FontSize = 28;

            //Add start shape to slide
            IShape startShape = slide.Shapes.AddShape(AutoShapeType.FlowChartTerminator, 420.45, 36.35, 133.93, 50.39);

            //Add a paragraph into the start shape text body
            AddParagraph(startShape, "Start", ColorObject.FromArgb(255, 149, 34));

            //Add alarm shape to slide
            IShape alarmShape = slide.Shapes.AddShape(AutoShapeType.FlowChartProcess, 420.45, 126.72, 133.93, 50.39);

            //Add a paragraph into the alarm shape text body
            AddParagraph(alarmShape, "Alarm Rings", ColorObject.FromArgb(255, 149, 34));

            //Add condition shape to slide
            IShape conditionShape = slide.Shapes.AddShape(AutoShapeType.FlowChartDecision, 420.45, 222.42, 133.93, 97.77);

            //Add a paragraph into the condition shape text body
            AddParagraph(conditionShape, "Ready to Get Up ?", ColorObject.FromArgb(44, 115, 213));

            //Add wake up shape to slide
            IShape wakeUpShape = slide.Shapes.AddShape(AutoShapeType.FlowChartProcess, 420.45, 361.52, 133.93, 50.39);

            //Add a paragraph into the wake up shape text body
            AddParagraph(wakeUpShape, "Wake Up", ColorObject.FromArgb(44, 115, 213));

            //Add end shape to slide
            IShape endShape = slide.Shapes.AddShape(AutoShapeType.FlowChartTerminator, 420.45, 453.27, 133.93, 50.39);

            //Add a paragraph into the end shape text body
            AddParagraph(endShape, "End", ColorObject.FromArgb(44, 115, 213));

            //Add snooze shape to slide
            IShape snoozeShape = slide.Shapes.AddShape(AutoShapeType.FlowChartProcess, 624.85, 245.79, 159.76, 50.02);

            //Add a paragraph into the snooze shape text body
            AddParagraph(snoozeShape, "Hit Snooze button", ColorObject.FromArgb(255, 149, 34));

            //Add relay shape to slide
            IShape relayShape = slide.Shapes.AddShape(AutoShapeType.FlowChartDelay, 624.85, 127.12, 159.76, 49.59);

            //Add a paragraph into the relay shape text body
            AddParagraph(relayShape, "Relay", ColorObject.FromArgb(255, 149, 34));

            //Connect the start shape with alarm shape using connector
            IConnector connector1 = slide.Shapes.AddConnector(ConnectorType.Straight, startShape, 2, alarmShape, 0);

            //Set the arrow style for the connector
            connector1.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the alarm shape with condition shape using connector
            IConnector connector2 = slide.Shapes.AddConnector(ConnectorType.Straight, alarmShape, 2, conditionShape, 0);

            //Set the arrow style for the connector
            connector2.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the condition shape with snooze shape using connector
            IConnector connector3 = slide.Shapes.AddConnector(ConnectorType.Straight, conditionShape, 3, snoozeShape, 1);

            //Set the arrow style for the connector
            connector3.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the snooze shape with relay shape using connector
            IConnector connector4 = slide.Shapes.AddConnector(ConnectorType.Straight, snoozeShape, 0, relayShape, 2);

            //Set the arrow style for the connector
            connector4.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the relay shape with alarm shape using connector
            IConnector connector5 = slide.Shapes.AddConnector(ConnectorType.Straight, relayShape, 1, alarmShape, 3);

            //Set the arrow style for the connector
            connector5.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the condition shape with wake up shape using connector
            IConnector connector6 = slide.Shapes.AddConnector(ConnectorType.Straight, conditionShape, 2, wakeUpShape, 0);

            //Set the arrow style for the connector
            connector6.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Connect the wake up shape with end shape using connector
            IConnector connector7 = slide.Shapes.AddConnector(ConnectorType.Straight, wakeUpShape, 2, endShape, 0);

            //Set the arrow style for the connector
            connector7.LineFormat.EndArrowheadStyle = ArrowheadStyle.Arrow;

            //Add No textbox to slide
            IShape noTextBox = slide.Shapes.AddTextBox(564.02, 245.43, 51.32, 26.22);

            //Add a paragraph into the text box
            noTextBox.TextBody.AddParagraph("No");

            //Add Yes textbox to slide
            IShape yesTextBox = slide.Shapes.AddTextBox(487.21, 327.99, 50.09, 26.23);

            //Add a paragraph into the text box
            yesTextBox.TextBody.AddParagraph("Yes");

            MemoryStream ms = new MemoryStream();

            SavePPTX(presentation);
        }
Exemplo n.º 28
0
        void OnButtonClicked(object sender, EventArgs e)
        {
            string   resourcePath = "SampleBrowser.Samples.Presentation.Templates.Slides.pptx";
            Assembly assembly     = Assembly.GetExecutingAssembly();
            Stream   fileStream   = assembly.GetManifestResourceStream(resourcePath);

            IPresentation presentation = Syncfusion.Presentation.Presentation.Open(fileStream);

            #region Slide1
            ISlide slide1 = presentation.Slides[0];
            IShape shape1 = slide1.Shapes[0] as IShape;
            shape1.Left   = 108;
            shape1.Top    = 139.68;
            shape1.Width  = 743.04;
            shape1.Height = 144;

            ITextBody   textFrame1  = shape1.TextBody;
            IParagraphs paragraphs1 = textFrame1.Paragraphs;
            IParagraph  paragraph1  = paragraphs1.Add();
            paragraphs1[0].IndentLevelNumber = 0;

            AddParagraphData(paragraph1, "ESSENTIAL PRESENTATION", "Calibri", 48, true);
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            slide1.Shapes.RemoveAt(1);
            #endregion

            #region Slide2
            ISlide slide2 = presentation.Slides.Add(SlideLayoutType.SectionHeader);
            shape1        = slide2.Shapes[0] as IShape;
            shape1.Left   = 55;
            shape1.Top    = 23;
            shape1.Width  = 573;
            shape1.Height = 71;
            textFrame1    = shape1.TextBody;

            //Instance to hold paragraphs in textframe
            paragraphs1 = textFrame1.Paragraphs;
            paragraph1  = paragraphs1.Add();
            AddParagraphData(paragraph1, "Slide with simple text", "Calibri", 40, false);
            paragraphs1[0].HorizontalAlignment = HorizontalAlignmentType.Left;

            IShape shape2 = slide2.Shapes[1] as IShape;
            shape2.Left   = 87;
            shape2.Top    = 119;
            shape2.Width  = 725;
            shape2.Height = 355;
            ITextBody textFrame2 = shape2.TextBody;

            //Instance to hold paragraphs in textframe
            IParagraphs paragraphs2 = textFrame2.Paragraphs;

            //Add paragrpah text
            IParagraph paragraph_1 = paragraphs2.Add();
            AddParagraphData(paragraph_1, "Adventure Works Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European and Asian commercial markets. While its base operation is located in Bothell, Washington with 290 employees, several regional sales teams are located throughout their market base.", "Calibri", 15, false);

            IParagraph paragraph_2 = paragraphs2.Add();
            AddParagraphData(paragraph_2, "In 2000, Adventure Works Cycles bought a small manufacturing plant, Importadores Neptuno, located in Mexico. Importadores Neptuno manufactures several critical subcomponents for the Adventure Works Cycles product line. These subcomponents are shipped to the Bothell location for final product assembly. In 2001, Importadores Neptuno, became the sole manufacturer and distributor of the touring bicycle product group.", "Calibri", 15, false);
            #endregion

            #region Slide3
            slide2        = presentation.Slides.Add(SlideLayoutType.TwoContent);
            shape1        = slide2.Shapes[0] as IShape;
            shape1.Left   = 26;
            shape1.Top    = 37;
            shape1.Width  = 815;
            shape1.Height = 76;

            //Adds textframe in shape
            textFrame1 = shape1.TextBody;

            //Instance to hold paragraphs in textframe
            paragraphs1 = textFrame1.Paragraphs;
            paragraphs1.Add();
            paragraph1 = paragraphs1[0];
            AddParagraphData(paragraph1, "Slide with Image", "Calibri", 44, false);

            //Adds shape in slide
            shape2        = slide2.Shapes[1] as IShape;
            shape2.Left   = 578;
            shape2.Top    = 141;
            shape2.Width  = 316;
            shape2.Height = 326;
            textFrame2    = shape2.TextBody;

            //Instance to hold paragraphs in textframe
            paragraphs2 = textFrame2.Paragraphs;
            IParagraph paragraph2 = paragraphs2.Add();

            AddParagraphData(paragraph2, "The Northwind sample database (Northwind.mdb) is included with all versions of Access. It provides data you can experiment with and database objects that demonstrate features you might want to implement in your own databases.", "Calibri", 16, false);
            IParagraph paragraph3 = paragraphs2.Add();

            AddParagraphData(paragraph3, "Using Northwind, you can become familiar with how a relational database is structured and how the database objects work together to help you enter, store, manipulate, and print your data.", "Calibri", 16, false);
            IParagraph paragraph4 = paragraphs2.Add();

            //           AddParagraphData(paragraph4, ref textpart1, "While its base operation is located in Bothell, Washington with 290 employees, several regional sales teams are located throughout their market base.", "Calibri", 16);
            IShape shape3 = (IShape)slide2.Shapes[2];
            slide2.Shapes.RemoveAt(2);


            //Adds picture in the shape
            resourcePath = "SampleBrowser.Samples.Presentation.Templates.tablet.jpg";
            assembly     = Assembly.GetExecutingAssembly();
            fileStream   = assembly.GetManifestResourceStream(resourcePath);
            IPicture picture1 = slide2.Shapes.AddPicture(fileStream, 58, 141, 477, 318);
            fileStream.Close();
            #endregion

            #region Slide4
            ISlide slide4 = presentation.Slides.Add(SlideLayoutType.TwoContent);
            shape1        = slide4.Shapes[0] as IShape;
            shape1.Left   = 37;
            shape1.Top    = 24;
            shape1.Width  = 815;
            shape1.Height = 76;
            textFrame1    = shape1.TextBody;

            //Instance to hold paragraphs in textframe
            paragraphs1 = textFrame1.Paragraphs;
            paragraphs1.Add();
            paragraph1 = paragraphs1[0];

            AddParagraphData(paragraph1, "Slide with Table", "Calibri", 44, false);
            shape2 = slide4.Shapes[1] as IShape;
            slide4.Shapes.Remove(shape2);

            ITable table = (ITable)slide4.Shapes.AddTable(6, 6, 58, 154, 823, 273);
            table.Rows[0].Height   = 61.2;
            table.Rows[1].Height   = 30;
            table.Rows[2].Height   = 61;
            table.Rows[3].Height   = 61;
            table.Rows[4].Height   = 61;
            table.Rows[5].Height   = 61;
            table.HasBandedRows    = true;
            table.HasHeaderRow     = true;
            table.HasBandedColumns = false;
            table.BuiltInStyle     = BuiltInTableStyle.MediumStyle2Accent1;

            ICell cell1 = table.Rows[0].Cells[0];
            textFrame2 = cell1.TextBody;
            paragraph2 = textFrame2.Paragraphs.Add();
            paragraph2.HorizontalAlignment = HorizontalAlignmentType.Center;
            ITextPart textPart2 = paragraph2.AddTextPart();
            textPart2.Text = "ID";

            ICell     cell2      = table.Rows[0].Cells[1];
            ITextBody textFrame3 = cell2.TextBody;
            paragraph3 = textFrame3.Paragraphs.Add();
            paragraph3.HorizontalAlignment = HorizontalAlignmentType.Center;
            ITextPart textPart3 = paragraph3.AddTextPart();
            textPart3.Text = "Company Name";

            ICell     cell3      = table.Rows[0].Cells[2];
            ITextBody textFrame4 = cell3.TextBody;
            paragraph4 = textFrame4.Paragraphs.Add();
            paragraph4.HorizontalAlignment = HorizontalAlignmentType.Center;
            ITextPart textPart4 = paragraph4.AddTextPart();
            textPart4.Text = "Contact Name";

            ICell      cell4      = table.Rows[0].Cells[3];
            ITextBody  textFrame5 = cell4.TextBody;
            IParagraph paragraph5 = textFrame5.Paragraphs.Add();
            paragraph5.HorizontalAlignment = HorizontalAlignmentType.Center;
            ITextPart textPart5 = paragraph5.AddTextPart();
            textPart5.Text = "Address";

            ICell      cell5      = table.Rows[0].Cells[4];
            ITextBody  textFrame6 = cell5.TextBody;
            IParagraph paragraph6 = textFrame6.Paragraphs.Add();
            paragraph6.HorizontalAlignment = HorizontalAlignmentType.Center;
            ITextPart textPart6 = paragraph6.AddTextPart();
            textPart6.Text = "City";

            ICell      cell6      = table.Rows[0].Cells[5];
            ITextBody  textFrame7 = cell6.TextBody;
            IParagraph paragraph7 = textFrame7.Paragraphs.Add();
            paragraph7.HorizontalAlignment = HorizontalAlignmentType.Center;
            ITextPart textPart7 = paragraph7.AddTextPart();
            textPart7.Text = "Country";

            //Add data in table
            AddTableData(cell1, table, textFrame1, paragraph1);
            slide4.Shapes.RemoveAt(1);
            #endregion

            MemoryStream stream = new MemoryStream();
            presentation.Save(stream);
            presentation.Close();
            stream.Position = 0;
            if (stream != null)
            {
                SaveAndroid androidSave = new SaveAndroid();
                androidSave.Save("Charts.pptx", "application/powerpoint", stream, m_context);
            }
        }
Exemplo n.º 29
0
        void OnButtonClicked(object sender, EventArgs e)
        {
            string   resourcePath = "SampleBrowser.Samples.Presentation.Templates.HelloWorld.pptx";
            Assembly assembly     = Assembly.GetExecutingAssembly();
            Stream   fileStream   = assembly.GetManifestResourceStream(resourcePath);

            IPresentation presentation = Syncfusion.Presentation.Presentation.Open(fileStream);

            #region Slide1
            ISlide slide1     = presentation.Slides[0];
            IShape titleShape = slide1.Shapes[0] as IShape;
            titleShape.Left   = 0.33 * 72;
            titleShape.Top    = 0.58 * 72;
            titleShape.Width  = 12.5 * 72;
            titleShape.Height = 1.75 * 72;

            ITextBody   textFrame1  = (slide1.Shapes[0] as IShape).TextBody;
            IParagraphs paragraphs1 = textFrame1.Paragraphs;
            IParagraph  paragraph   = paragraphs1.Add();
            paragraph.HorizontalAlignment = HorizontalAlignmentType.Center;
            ITextPart textPart1 = paragraph.AddTextPart();
            textPart1.Text          = "Essential Presentation";
            textPart1.Font.CapsType = TextCapsType.All;
            textPart1.Font.FontName = "Arial";
            textPart1.Font.Bold     = true;
            textPart1.Font.FontSize = 40;

            IShape subtitle = slide1.Shapes[1] as IShape;
            subtitle.Left   = 0.5 * 72;
            subtitle.Top    = 3 * 72;
            subtitle.Width  = 11.8 * 72;
            subtitle.Height = 1.7 * 72;

            ITextBody textFrame2 = (slide1.Shapes[1] as IShape).TextBody;
            textFrame2.VerticalAlignment = VerticalAlignmentType.Top;
            IParagraphs paragraphs2 = textFrame2.Paragraphs;
            IParagraph  para        = paragraphs2.Add();
            para.HorizontalAlignment = HorizontalAlignmentType.Left;
            ITextPart textPart2 = para.AddTextPart();
            textPart2.Text          = "Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum tempus.Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet.";
            textPart2.Font.FontName = "Arial";
            textPart2.Font.FontSize = 21;

            para = paragraphs2.Add();
            para.HorizontalAlignment = HorizontalAlignmentType.Left;
            textPart2               = para.AddTextPart();
            textPart2.Text          = "Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet. Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula.";
            textPart2.Font.FontName = "Arial";
            textPart2.Font.FontSize = 21;

            //Add hyperlink to the paragraph
            ITextPart textPart3 = para.AddTextPart();
            textPart3.Text          = "click here";
            textPart3.Font.FontName = "Arial";
            textPart3.SetHyperlink("https://msdn.microsoft.com/en-in/library/mt299001.aspx");

            #endregion

            MemoryStream stream = new MemoryStream();
            presentation.Save(stream);
            presentation.Close();
            stream.Position = 0;
            if (stream != null)
            {
                SaveAndroid androidSave = new SaveAndroid();
                androidSave.Save("GettingStarted.pptx", "application/powerpoint", stream, m_context);
            }
        }
Exemplo n.º 30
0
        internal static void SlideWithComments3(IPresentation presentation)
        {
            #region Slide3
            ISlide slide3 = presentation.Slides.Add(SlideLayoutType.ContentWithCaption);
            slide3.Background.Fill.FillType        = FillType.Solid;
            slide3.Background.Fill.SolidFill.Color = ColorObject.White;

            //Adds shape in slide
            IShape shape2 = (IShape)slide3.Shapes[0];
            shape2.Left   = 0.47 * 72;
            shape2.Top    = 1.15 * 72;
            shape2.Width  = 3.5 * 72;
            shape2.Height = 4.91 * 72;

            ITextBody textFrame1 = shape2.TextBody;

            //Instance to hold paragraphs in textframe
            IParagraphs paragraphs1 = textFrame1.Paragraphs;
            IParagraph  paragraph1  = paragraphs1.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Left;
            ITextPart textpart1 = paragraph1.AddTextPart();
            textpart1.Text          = "Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum tempus.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            IParagraph paragraph2 = paragraphs1.Add();
            paragraph2.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph2.AddTextPart();
            textpart1.Text          = "Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            IParagraph paragraph3 = paragraphs1.Add();
            paragraph3.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph3.AddTextPart();
            textpart1.Text          = "Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            IParagraph paragraph4 = paragraphs1.Add();
            paragraph4.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph4.AddTextPart();
            textpart1.Text          = "Lorem tortor neque, purus taciti quis id. Elementum integer orci accumsan minim phasellus vel.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            paragraphs1.Add();

            slide3.Shapes.RemoveAt(1);
            slide3.Shapes.RemoveAt(1);

            Assembly assembly = Assembly.GetExecutingAssembly();
            //Adds picture in the shape
            string resourcePath = "SampleBrowser.Samples.Presentation.Templates.tablet.jpg";
            Stream fileStream   = assembly.GetManifestResourceStream(resourcePath);

            IPicture picture1 = slide3.Shapes.AddPicture(fileStream, 5.18 * 72, 1.15 * 72, 7.3 * 72, 5.31 * 72);
            fileStream.Dispose();

            slide3.Comments.Add(0.14, 0.04, "Author3", "A3", "Can we use a different font family for this text?", DateTime.Now);
            #endregion
        }