Example #1
0
        public void ChangePresentation(IPresentation presentation)
        {
            if (presentation != CurrentPresentation)
            {
                //1. Detach the current presentation.
                if (CurrentPresentation != null)
                {
                    CurrentPresentation.Detach();
                }

                //2. Load the new theme.
                if (presentation != null)
                {
                    presentation.Attach();
                }

                //3. Restore the current theme.
                CurrentPresentation = presentation;
            }
        }
        internal static void SlideWithComments2(IPresentation presentation)
        {
            #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
        }
Example #3
0
 public void Initailize(IPresentation presentation, ISlide slide)
 {
     UpdateDisplay();
 }
        void OnInsertOleButtonClicked(object sender, EventArgs e)
        {
            Assembly assembly = typeof(GettingStarted).GetTypeInfo().Assembly;
            //New Instance of PowerPoint is Created.[Equivalent to launching MS PowerPoint with no slides].
            IPresentation presentation = Syncfusion.Presentation.Presentation.Create();

            ISlide slide = presentation.Slides.Add(SlideLayoutType.TitleOnly);

            IShape titleShape = slide.Shapes[0] as IShape;

            titleShape.Left   = 0.65 * 72;
            titleShape.Top    = 0.24 * 72;
            titleShape.Width  = 11.5 * 72;
            titleShape.Height = 1.45 * 72;
            titleShape.TextBody.AddParagraph("Ole Object");
            titleShape.TextBody.Paragraphs[0].Font.Bold           = true;
            titleShape.TextBody.Paragraphs[0].HorizontalAlignment = HorizontalAlignmentType.Left;

            IShape heading = slide.Shapes.AddTextBox(100, 100, 100, 100);

            heading.Left   = 0.84 * 72;
            heading.Top    = 1.65 * 72;
            heading.Width  = 2.23 * 72;
            heading.Height = 0.51 * 72;
            heading.TextBody.AddParagraph("MS Word Object");
            heading.TextBody.Paragraphs[0].Font.Italic   = true;
            heading.TextBody.Paragraphs[0].Font.Bold     = true;
            heading.TextBody.Paragraphs[0].Font.FontSize = 18;

            string mswordPath = "";

#if COMMONSB
            mswordPath = "SampleBrowser.Samples.Presentation.Samples.Templates.OleTemplate.docx";
#else
            mswordPath = "SampleBrowser.Presentation.Samples.Templates.OleTemplate.docx";
#endif
            //Get the word file as stream
            Stream wordStream = assembly.GetManifestResourceStream(mswordPath);
            string imagePath  = "";
#if COMMONSB
            imagePath = "SampleBrowser.Samples.Presentation.Samples.Templates.OlePicture.png";
#else
            imagePath = "SampleBrowser.Presentation.Samples.Templates.OlePicture.png";
#endif

            //Image to be displayed, This can be any image
            Stream imageStream = assembly.GetManifestResourceStream(imagePath);

            IOleObject oleObject = slide.Shapes.AddOleObject(imageStream, "Word.Document.12", wordStream);
            //Set size and position of the ole object
            oleObject.Left   = 4.53 * 72;
            oleObject.Top    = 0.79 * 72;
            oleObject.Width  = 4.26 * 72;
            oleObject.Height = 5.92 * 72;
            //Set DisplayAsIcon as true, to open the embedded document in separate (default) application.
            oleObject.DisplayAsIcon = true;
            MemoryStream stream = new MemoryStream();
            presentation.Save(stream);
            presentation.Close();
            stream.Position = 0;
            if (Device.RuntimePlatform == Device.UWP)
            {
                Xamarin.Forms.DependencyService.Get <ISaveWindowsPhone>().Save("InsertOLEObject.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", stream);
            }
            else
            {
                Xamarin.Forms.DependencyService.Get <ISave>().Save("InsertOLEObject.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", stream);
            }
        }
Example #5
0
        private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Assembly assembly     = typeof(ImagesPresentation).GetTypeInfo().Assembly;
            string   resourcePath = "Syncfusion.SampleBrowser.UWP.Presentation.Presentation.Assets.Images.pptx";
            Stream   fileStream   = assembly.GetManifestResourceStream(resourcePath);

            IPresentation presentation = await Presentation.OpenAsync(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 = "Syncfusion.SampleBrowser.UWP.Presentation.Presentation.Assets.tablet.jpg";
            fileStream   = assembly.GetManifestResourceStream(resourcePath);

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

            MemoryStream ms = new MemoryStream();

            SavePPTX(presentation);
        }
Example #6
0
 /// <summary>
 /// Determines whether this presentation useses the same presentation window as another specified presentation.
 /// </summary>
 /// <param name="presentation">The other presentation to check.</param>
 /// <returns>
 ///   <c>true</c> if the other presentation uses the same window; otherwise <c>false</c>
 /// </returns>
 public bool UsesSamePresentationWindow(IPresentation presentation)
 {
     return false;
 }
        /// <summary>
        /// Sets another control as the new content and starts a transition.
        /// </summary>
        /// <param name="control">The control to show next.</param>
        /// <param name="milliseconds">The duration of the transition in milliseconds.</param>
        public static void SetContent(FrameworkElement control, int milliseconds, Action callback, IPresentation previous)
        {
            bool transitionFromNonWpf = previous != null && !(previous is IWpfPresentation);

            if (Instance.MainContainer.Child == control && !transitionFromNonWpf)
                return;

            if (contentTransitionCallback != null)
                contentTransitionCallback();

            contentTransitionCallback = callback;

            Instance.PreviousContainer.Child = null;
            UIElement previousControl;
            if (transitionFromNonWpf)
                previousControl = null;
            else
                previousControl = Instance.MainContainer.Child;
            Instance.MainContainer.Child = control;
            Instance.PreviousContainer.Child = previousControl;
            Instance.PreviousContainer.Opacity = 1;
            Instance.MainContainer.Opacity = 0;

            Storyboard sbd = (Storyboard)Instance.FindResource("ContentTransition");
            sbd.Children[0].Duration = new TimeSpan(0, 0, 0, 0, milliseconds);
            sbd.Begin(Instance);
        }
Example #8
0
        public ActionResult InsertOLEObject(string Browser, string button)
        {
            if (button == "Create Presentation")
            {
                //New Instance of PowerPoint is Created.[Equivalent to launching MS PowerPoint with no slides].
                IPresentation presentation = Presentation.Create();

                ISlide slide = presentation.Slides.Add(SlideLayoutType.TitleOnly);

                IShape titleShape = slide.Shapes[0] as IShape;
                titleShape.Left   = 0.65 * 72;
                titleShape.Top    = 0.24 * 72;
                titleShape.Width  = 11.5 * 72;
                titleShape.Height = 1.45 * 72;
                titleShape.TextBody.AddParagraph("Ole Object");
                titleShape.TextBody.Paragraphs[0].Font.Bold           = true;
                titleShape.TextBody.Paragraphs[0].HorizontalAlignment = HorizontalAlignmentType.Left;

                IShape heading = slide.Shapes.AddTextBox(100, 100, 100, 100);
                heading.Left   = 0.84 * 72;
                heading.Top    = 1.65 * 72;
                heading.Width  = 2.23 * 72;
                heading.Height = 0.51 * 72;
                heading.TextBody.AddParagraph("MS Word Object");
                heading.TextBody.Paragraphs[0].Font.Italic   = true;
                heading.TextBody.Paragraphs[0].Font.Bold     = true;
                heading.TextBody.Paragraphs[0].Font.FontSize = 18;

                string mswordPath = "OleTemplate.docx";
                //Get the word file as stream
                Stream wordStream = new FileStream(ResolveApplicationDataPath(mswordPath), FileMode.Open);
                string imagePath  = "OlePicture.png";
                //Image to be displayed, This can be any image
                Stream imageStream = new FileStream(ResolveApplicationImagePath(imagePath), FileMode.Open);

                IOleObject oleObject = slide.Shapes.AddOleObject(imageStream, "Word.Document.12", wordStream);
                //Set size and position of the ole object
                oleObject.Left   = 4.53 * 72;
                oleObject.Top    = 0.79 * 72;
                oleObject.Width  = 4.26 * 72;
                oleObject.Height = 5.92 * 72;
                return(new PresentationResult(presentation, "InsertOLEObject.pptx", HttpContext.ApplicationInstance.Response));
            }
            else
            {
                string        file    = ResolveApplicationDataPath("EmbeddedOleObject.pptx");
                IPresentation pptxDoc = Presentation.Open(file);
                //Gets the first slide of the Presentation
                ISlide slide = pptxDoc.Slides[0];
                //Gets the Ole Object of the slide
                IOleObject oleObject = slide.Shapes[2] as IOleObject;
                //Gets the file data of embedded Ole Object.
                byte[] array = oleObject.ObjectData;
                //Gets the file Name of OLE Object
                string outputFile = oleObject.FileName;

                //Save the extracted Ole data into file system.
                MemoryStream memoryStream = new MemoryStream(array);
                pptxDoc.Close();
                return(File(memoryStream, "application/word", outputFile));
            }
        }
 public virtual bool TransitionPossibleFrom(IPresentation presentation)
 {
     return false;
 }
 public virtual void Show(int transitionDuration = 0, Action callback = null, IPresentation previous = null)
 {
     // NOTE: transition duration will be ignored (not possible with external presentations)
     Show();
     if (callback != null)
         callback();
 }
Example #11
0
        /// <summary>
        /// Create slide with table in presentation.
        /// </summary>
        /// <param name="presentation">Represents the presentation instance.</param>
        private void CreateSlideWithTable(IPresentation presentation)
        {
            #region Slide4
            ISlide slide = presentation.Slides.Add(SlideLayoutType.TwoContent);
            IShape shape = slide.Shapes[0] as IShape;
            SetShapeBounds(shape, 36.72, 24.48, 815.04, 76.32);

            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 Table";
            textpart.Font.FontName = "Helvetica CE 35 Thin";

            shape = slide.Shapes[1] as IShape;
            slide.Shapes.Remove(shape);

            ITable table = (ITable)slide.Shapes.AddTable(6, 6, 58.32, 154.08, 822.96, 273.6);
            foreach (IRow row in table.Rows)
            {
                row.Height = 61.2;
            }
            table.HasBandedRows    = true;
            table.HasHeaderRow     = true;
            table.HasBandedColumns = false;
            table.BuiltInStyle     = BuiltInTableStyle.MediumStyle2Accent1;

            AddTableCellContent(table.Rows[0].Cells[0], "ID");
            AddTableCellContent(table.Rows[0].Cells[1], "Company Name");
            AddTableCellContent(table.Rows[0].Cells[2], "Contact Name");
            AddTableCellContent(table.Rows[0].Cells[3], "Address");
            AddTableCellContent(table.Rows[0].Cells[4], "City");
            AddTableCellContent(table.Rows[0].Cells[5], "Country");
            AddTableCellContent(table.Rows[1].Cells[0], "1");
            AddTableCellContent(table.Rows[1].Cells[1], "New Orleans Cajun Delights");
            AddTableCellContent(table.Rows[1].Cells[2], "Shelley Burke");
            AddTableCellContent(table.Rows[1].Cells[3], "P.O. Box 78934");
            AddTableCellContent(table.Rows[1].Cells[4], "New Orleans");
            AddTableCellContent(table.Rows[1].Cells[5], "USA");
            AddTableCellContent(table.Rows[2].Cells[0], "2");
            AddTableCellContent(table.Rows[2].Cells[1], "Cooperativa de Quesos 'Las Cabras");
            AddTableCellContent(table.Rows[2].Cells[2], "Antonio del Valle Saavedra");
            AddTableCellContent(table.Rows[2].Cells[3], "Calle del Rosal 4");
            AddTableCellContent(table.Rows[2].Cells[4], "Oviedo");
            AddTableCellContent(table.Rows[2].Cells[5], "Spain");
            AddTableCellContent(table.Rows[3].Cells[0], "3");
            AddTableCellContent(table.Rows[3].Cells[1], "Mayumi");
            AddTableCellContent(table.Rows[3].Cells[2], "Mayumi Ohno");
            AddTableCellContent(table.Rows[3].Cells[3], "92 Setsuko Chuo-ku");
            AddTableCellContent(table.Rows[3].Cells[4], "Osaka");
            AddTableCellContent(table.Rows[3].Cells[5], "Japan");
            AddTableCellContent(table.Rows[4].Cells[0], "4");
            AddTableCellContent(table.Rows[4].Cells[1], "Pavlova, Ltd.");
            AddTableCellContent(table.Rows[4].Cells[2], "Ian Devling");
            AddTableCellContent(table.Rows[4].Cells[3], "74 Rose St. Moonie Ponds");
            AddTableCellContent(table.Rows[4].Cells[4], "Melbourne");
            AddTableCellContent(table.Rows[4].Cells[5], "Australia");
            AddTableCellContent(table.Rows[5].Cells[0], "5");
            AddTableCellContent(table.Rows[5].Cells[1], "Specialty Biscuits, Ltd.");
            AddTableCellContent(table.Rows[5].Cells[2], "Peter Wilson");
            AddTableCellContent(table.Rows[5].Cells[3], "29 King's Way");
            AddTableCellContent(table.Rows[5].Cells[4], "Manchester");
            AddTableCellContent(table.Rows[5].Cells[5], "UK");

            slide.Shapes.RemoveAt(1);
            #endregion
        }
Example #12
0
        private void SlideWithComments(IPresentation presentation)
        {
            #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.5, 0.04, "Author1", "A1", "Essential Presentation is available from 13.1 versions of Essential Studio", DateTime.Now);
            //Author2 add reply to a parent comment
            slide1.Comments.Add("Author2", "A2", "Does it support rendering of slides as images or PDF?", DateTime.Now, comment);
            //Author1 add reply to a parent comment
            slide1.Comments.Add("Author1", "A1", "Yes, you may render slides as images and PDF.", DateTime.Now, comment);
            #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", "Do all 3D-chart types support in Presentation library?", DateTime.Now);

            #endregion
        }
 public void Add(IPresentation s)
 {
     _Children.Add(s);
 }
 private static void AddPictureToPresentation(IPresentation presentation, string tmpFile, Image image, ICaptureDetails captureDetails)
 {
     if (presentation != null) {
         //ISlide slide = presentation.Slides.AddSlide( presentation.Slides.Count + 1, PPSlideLayout.ppLayoutPictureWithCaption);
         LOG.DebugFormat("Slides before {0}", presentation.Slides.Count);
         ISlide slide = presentation.Slides.Add( presentation.Slides.Count + 1,  PPSlideLayout.ppLayoutPictureWithCaption);
         LOG.DebugFormat("Slides after {0}", presentation.Slides.Count);
         // Shapes[2] is the image shape on this layout.
         IShape shapeForLocation = slide.Shapes.item(2);
         shapeForLocation.Width = image.Width;
         shapeForLocation.Height = image.Height;
         LOG.DebugFormat("Shape {0},{1},{2},{3}", shapeForLocation.Left, shapeForLocation.Top, image.Width, image.Height);
         IShape shape = slide.Shapes.AddPicture(tmpFile, MsoTriState.msoFalse, MsoTriState.msoTrue, shapeForLocation.Left, shapeForLocation.Top, image.Width, image.Height);
         shape.Width = image.Width;
         shape.Height = image.Height;
         shape.ScaleWidth(1, MsoTriState.msoTrue, MsoScaleFrom.msoScaleFromMiddle);
         shape.ScaleHeight(1, MsoTriState.msoTrue, MsoScaleFrom.msoScaleFromMiddle);
         slide.Shapes.item(1).TextFrame.TextRange.Text = captureDetails.Title;
     }
 }
Example #15
0
        private void tvDocuments_AfterSelect(object sender, EventArgs e)
        {
            if(tvDocuments.SelectedNode.HasChildren)
            {
                if (tvDocuments.SelectedNode.Expanded)
                    tvDocuments.SelectedNode.CollapseAll();
                else
                    tvDocuments.SelectedNode.Expand();

                if (tvDocuments.SelectedNode.Parent == null)
                    return;
            }
            var nodeType = tvDocuments.SelectedNode.GetType();
            if (nodeType.Name.Equals("TreeNodeAdv"))
                return;
            DocumentTreeNode node = (DocumentTreeNode)tvDocuments.SelectedNode;
            if(mStream != null)
                mStream.Close();
            mStream = new MemoryStream(node.DocumentNode.DOCUMENT);
            FileType fileType = node.DocumentNode.DOCUMENT.GetFileType();

            if (fileType != null && (node.DocumentNode.DOCUMENT_TYPE.Equals("Spreadsheet") ||
                fileType.Extension.Equals("xlsx") || fileType.Extension.Equals("xls")))
            {
                docViewer.Visible = false;
                spreadsheetViewer.Visible = true;
                if (spreadsheetViewer == null)
                {
                    spreadsheetViewer = new Syncfusion.Windows.Forms.Spreadsheet.Spreadsheet();
                    tpDocuments.Controls.Add(spreadsheetViewer);
                }
                spreadsheetViewer.Refresh();
                spreadsheetViewer.Open(mStream);
            } 
            else if (node.DocumentNode.DOCUMENT_TYPE.Equals("Presentation"))
            {
                docViewer.Visible = true;
                spreadsheetViewer.Visible = false;
                presentation = Presentation.Open(mStream);
                mStream.Close();
                PDFdocument = PresentationToPdfConverter.Convert(presentation);
                mStream = new MemoryStream();
                PDFdocument.Save(mStream);
                docViewer.LoadDocument(mStream);
            }
            else
            {
                spreadsheetViewer.Visible = false;
                docViewer.Visible = true;
                docViewer.LoadDocument(mStream);
            }
        }
 public void LoadDefualtSFX(IPresentation presentation)
 {
     //presentation.Audio.Answer = "Defualt_Answer_Sound.mp3";
     //presentation.Audio.Question = "Defualt_Question_Sound.mp3";
 }
Example #17
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);
            }
        }
        private void SlideWithNotes1(IPresentation presentation)
        {
            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;

            //Adding Notes
            INotesSlide notesSlide    = slide1.AddNotesSlide();
            ITextPart   notesTextPart = notesSlide.NotesTextBody.Paragraphs[0].TextParts.Add();

            notesTextPart.Text = "The slide represents the title content of the presentation";

            IPresentationChart chart = notesSlide.Shapes.AddChart(1.24 * 72, 5.71 * 72, 5 * 72, 3.33 * 72);


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

            chart.ChartTitle = "Chart inside Notes section";
        }
 void IHtmlFormattingController.WriteDocumentEnd(IHtmlGenerator generator, IPresentation presentation)
 {}
        private void btnCreatePresn_Click(object sender, EventArgs e)
        {
            //New Instance of PowerPoint is Created.[Equivalent to launching MS PowerPoint with no slides].
            IPresentation presentation = Presentation.Create();
            //Add slide with titleonly layout to presentation
            ISlide slide = presentation.Slides.Add(SlideLayoutType.TitleOnly);
            //Get the title placeholder
            IShape titleShape = slide.Shapes[0] as IShape;

            //Set size and position of the title shape
            titleShape.Left   = 0.65 * 72;
            titleShape.Top    = 0.24 * 72;
            titleShape.Width  = 11.5 * 72;
            titleShape.Height = 1.45 * 72;

            //Add title content
            titleShape.TextBody.AddParagraph("Ole Object");
            //Set the title content as bold
            titleShape.TextBody.Paragraphs[0].Font.Bold = true;
            //Set the horizontal alignment as center
            titleShape.TextBody.Paragraphs[0].HorizontalAlignment = HorizontalAlignmentType.Left;
            //Add text box of specific size and position
            IShape heading = slide.Shapes.AddTextBox(0.84 * 72, 1.65 * 72, 2.23 * 72, 0.51 * 72);

            //Add paragraph to text box
            heading.TextBody.AddParagraph("MS Word Object");
            //Set the text content as italic
            heading.TextBody.Paragraphs[0].Font.Italic = true;
            //Set the text content as bold
            heading.TextBody.Paragraphs[0].Font.Bold = true;
            //Set the font size
            heading.TextBody.Paragraphs[0].Font.FontSize = 18;

#if !NETCore
            string mswordPath = @"..\..\..\..\..\..\Common\Data\Presentation\OleTemplate.docx";
            string imagePath  = @"..\..\..\..\..\..\Common\Images\Presentation\OlePicture.png";
#else
            string mswordPath = @"..\..\..\..\..\..\..\Common\Data\Presentation\OleTemplate.docx";
            string imagePath  = @"..\..\..\..\..\..\..\Common\Images\Presentation\OlePicture.png";
#endif
            //Get the word file as stream
            Stream wordStream = File.Open(mswordPath, FileMode.Open);
            //Image to be displayed, This can be any image
            Stream imageStream = File.Open(imagePath, FileMode.Open);
            //Add ole object to the slide
            IOleObject oleObject = slide.Shapes.AddOleObject(imageStream, "Word.Document.12", wordStream);
            //Set size and position of the ole object
            oleObject.Left   = 4.53 * 72;
            oleObject.Top    = 0.79 * 72;
            oleObject.Width  = 4.26 * 72;
            oleObject.Height = 5.92 * 72;

            //Save the presentation
            presentation.Save("InsertOLEObject.pptx");
            //Close the presentation
            presentation.Close();

            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("InsertOLEObject.pptx");
#else
                System.Diagnostics.Process process = new System.Diagnostics.Process();
                process.StartInfo = new System.Diagnostics.ProcessStartInfo("InsertOLEObject.pptx")
                {
                    UseShellExecute = true
                };
                process.Start();
#endif
                this.Close();
            }
        }
Example #21
0
 public bool TransitionPossibleTo(IPresentation presentation)
 {
     return false;
 }
        private void btnCreateImage_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string inputPath = @"..\..\..\..\..\..\Common\Data\Presentation\SmartArts.pptx";
#if NETCore
                inputPath = @"..\..\..\..\..\..\..\Common\Data\Presentation\SmartArts.pptx";
#endif
                //Opens the specified presentation
                IPresentation presentation = Presentation.Open(inputPath);

                //Method call to edit slides
                CreateSlide1(presentation);
                CreateSlide2(presentation);
                CreateSlide3(presentation);
                if (this.radioButton.IsChecked.Value)
                {
                    presentation.Save("SmartArtSample.pptx");
                    if (System.Windows.MessageBox.Show("Do you want to view the generated PowerPoint Presentation?", "SmartArt Modification",
                                                       MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
                    {
#if !NETCore
                        System.Diagnostics.Process.Start("SmartArtSample.pptx");
#else
                        System.Diagnostics.Process process = new System.Diagnostics.Process();
                        process.StartInfo = new System.Diagnostics.ProcessStartInfo("SmartArtSample.pptx")
                        {
                            UseShellExecute = true
                        };
                        process.Start();
#endif
                        this.Close();
                    }
                }
                else if (this.radioButton1.IsChecked.Value)
                {
                    //To set each slide in a pdf page.
                    PresentationToPdfConverterSettings settings = new PresentationToPdfConverterSettings();

                    settings.ShowHiddenSlides = true;

                    //Instance to create pdf document from presentation
                    PdfDocument doc = PresentationToPdfConverter.Convert(presentation, settings);

                    //Saves the pdf document
                    doc.Save("Sample.pdf");
                    if (System.Windows.MessageBox.Show("Do you want to view the generated PDF document?", "SmartArt Modification",
                                                       MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
                    {
#if !NETCore
                        System.Diagnostics.Process.Start("Sample.pdf");
#else
                        System.Diagnostics.Process process = new System.Diagnostics.Process();
                        process.StartInfo = new System.Diagnostics.ProcessStartInfo("Sample.pdf")
                        {
                            UseShellExecute = true
                        };
                        process.Start();
#endif
                    }
                }
            }
            catch (Exception exception)
            {
                System.Windows.MessageBox.Show("This file could not be converted, please contact Syncfusion Direct-Trac system at http://www.syncfusion.com/support/default.aspx for any queries. ", "OOPS..Sorry!",
                                               MessageBoxButton.OK);
                this.Close();
            }
        }
 private UIElement GetPreviewControl(IPresentation presentation)
 {
     if (presentation == null)
     {
         this.previewBorder.Child = null;
         return this.previewBorder;
     }
     else if (!presentation.Preview.IsPreviewAvailable)
     {
         this.previewBorder.Child = null;
         return new TextBlock { Text = Resource.vNoPreviewAvailable, TextAlignment = TextAlignment.Center, Foreground = Brushes.Black };
     }
     else if (presentation.Preview is WordsLive.Presentation.Wpf.WpfPreviewProvider)
     {
         this.previewBorder.Child = (presentation.Preview as WordsLive.Presentation.Wpf.WpfPreviewProvider).WpfPreviewControl;
         return this.previewBorder;
     }
     else
     {
         var host = new System.Windows.Forms.Integration.WindowsFormsHost();
         host.Child = presentation.Preview.PreviewControl;
         this.previewBorder.Child = host;
         return this.previewBorder;
     }
 }
Example #24
0
        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);
        }
Example #25
0
        private void btnMergeDocument_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.radioDestination.IsChecked == true)
                {
                    //Creates instance for source presentation
                    IPresentation sourcePresentation = Presentation.Open(txtFile1.Tag.ToString());

                    //Creates instance for destination presentation
                    IPresentation destinationPresentation = Presentation.Open(txtFile.Tag.ToString());

                    ISlides slides = sourcePresentation.Slides;

                    foreach (ISlide slide in slides)
                    {
                        //Clones the slides from source to destination
                        destinationPresentation.Slides.Add(slide.Clone(), PasteOptions.UseDestinationTheme, sourcePresentation);
                    }

                    //Closing the Source presentation
                    sourcePresentation.Close();

                    //Saving the Destination presentaiton.
                    destinationPresentation.Save("MergedUsingDestination.pptx");

                    destinationPresentation.Close();
                    if (System.Windows.MessageBox.Show("Do you want to view the merged PowerPoint Presentation?", "Finished Merging",
                                                       MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
                    {
                        System.Diagnostics.Process.Start("MergedUsingDestination.pptx");
                    }
                }
                else
                {
                    //Creates instance for source presentation
                    IPresentation sourcePresentation = Presentation.Open(txtFile1.Tag.ToString());
                    //Creates instance for destination presentation
                    IPresentation destinationPresentation = Presentation.Open(txtFile.Tag.ToString());

                    ISlides slides = sourcePresentation.Slides;

                    foreach (ISlide slide in slides)
                    {
                        //Clones the slides from source to destination
                        destinationPresentation.Slides.Add(slide.Clone(), PasteOptions.SourceFormatting, sourcePresentation);
                    }

                    //Closing the Source presentation
                    sourcePresentation.Close();

                    //Saving the Destination presentaiton.
                    destinationPresentation.Save("MergedUsingSource.pptx");

                    //Closing the destination presentation
                    destinationPresentation.Close();

                    if (System.Windows.MessageBox.Show("Do you want to view the merged PowerPoint Presentation?", "Finished Merging",
                                                       MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
                    {
                        System.Diagnostics.Process.Start("MergedUsingSource.pptx");
                    }
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show("This file could not be merged, please contact Syncfusion Direct-Trac system at http://www.syncfusion.com/support/default.aspx for any queries. ", "OOPS..Sorry!",
                                MessageBoxButton.OK);
                this.Close();
            }
        }
Example #26
0
        private async void Convert_BtnClick(System.Object sender, RoutedEventArgs e)
        {
            Assembly assembly = typeof(PPTXToImagePresentation).GetTypeInfo().Assembly;

            switch (documentOptions.SelectedIndex)
            {
            case 0:
                string resourcePath = "Syncfusion.SampleBrowser.UWP.Presentation.Presentation.Assets.GettingStarted.pptx";
                Stream fileStream   = assembly.GetManifestResourceStream(resourcePath);
                presentation = await Presentation.OpenAsync(fileStream);

                fileStream.Dispose();
                break;

            case 1:
                resourcePath = "Syncfusion.SampleBrowser.UWP.Presentation.Presentation.Assets.Charts.pptx";
                fileStream   = assembly.GetManifestResourceStream(resourcePath);
                presentation = await Presentation.OpenAsync(fileStream);

                fileStream.Dispose();
                break;
            }
            if (presentation != null)
            {
                StorageFolder storageFolder;
                if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))
                {
                    // Pick the folder to save the converted images.
                    FolderPicker folderPicker = new FolderPicker();
                    folderPicker.ViewMode = PickerViewMode.Thumbnail;
                    folderPicker.FileTypeFilter.Add("*");
                    storageFolder = await folderPicker.PickSingleFolderAsync();
                }
                else
                {
                    storageFolder = ApplicationData.Current.LocalFolder;
                }
                if (storageFolder != null)
                {
                    // Intialize the ChartToImageConverter instance to convert the chart to image.
                    presentation.ChartToImageConverter = new ChartToImageConverter();
                    int i = 1;
                    // Convert the slide to image.
                    foreach (ISlide slide in presentation.Slides)
                    {
                        StorageFile imageFile = await storageFolder.CreateFileAsync("Slide" + i ++ + ".jpg", CreationCollisionOption.ReplaceExisting);

                        await slide.SaveAsImageAsync(imageFile);
                    }
                    // Close the presentation instance
                    presentation.Close();
                    presentation = null;

                    // View the popup message
                    MessageDialog msgDialog = new MessageDialog("Do you want to view the generated images?", "Slides has been saved as images successfully.");
                    UICommand     yesCmd    = new UICommand("Yes");
                    msgDialog.Commands.Add(yesCmd);
                    UICommand noCmd = new UICommand("No");
                    msgDialog.Commands.Add(noCmd);
                    IUICommand cmd = await msgDialog.ShowAsync();

                    if (cmd == yesCmd)
                    {
                        // Launch the image generated folder
                        bool success = await Windows.System.Launcher.LaunchFolderAsync(storageFolder);
                    }
                }
            }
            else
            {
                // View the popup message
                MessageDialog msgDialog = new MessageDialog("Please browse the input file to convert as image.");
                await msgDialog.ShowAsync();
            }
            inputFilePath.Text = "No file chosen";
        }
Example #27
0
 public PresentationResult(IPresentation source, string fileName, HttpResponse response)
 {
     this.FileName = fileName;
     this.m_source = source;
     m_response    = response;
 }
Example #28
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)
            {
                return;
            }

            //ISlide slide = presentation.Slides.AddSlide( presentation.Slides.Count + 1, PPSlideLayout.ppLayoutPictureWithCaption);
            ISlide slide;
            var    left            = presentation.PageSetup.SlideWidth / 2 - imageSize.Width / 2f;
            var    top             = presentation.PageSetup.SlideHeight / 2 - imageSize.Height / 2f;
            float  width           = imageSize.Width;
            float  height          = imageSize.Height;
            IShape shapeForCaption = null;
            var    hasScaledWidth  = false;
            var    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);
                var 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().WriteLine(e);
                slide = presentation.Slides.Add(presentation.Slides.Count + 1, (int)PPSlideLayout.ppLayoutBlank);
            }
            var shape = slide.Shapes.AddPicture(tmpFile, MsoTriState.msoFalse, MsoTriState.msoTrue, 0, 0, width, height);

            shape.LockAspectRatio = officeConfiguration.PowerpointLockAspectRatio ? MsoTriState.msoTrue : 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.
                    var textFrame = shapeForCaption.TextFrame;
                    textFrame.TextRange.Text = title;
                }
                catch (Exception ex)
                {
                    Log.Warn().WriteLine(ex, "Problem setting the title to a text-range");
                }
            }
            presentation.Application.ActiveWindow.View.GotoSlide(slide.SlideNumber);
            presentation.Application.Activate();
        }
        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
        }
Example #30
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.Close();
            #endregion

            MemoryStream stream = new MemoryStream();
            presentation.Save(stream);
            presentation.Close();
            stream.Position = 0;
            if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows)
            {
                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);
            }
        }
        // Export PPT slide
        private void Button_Click_Generate(object sender, RoutedEventArgs e)
        {
            //Create a new PowerPoint presentation
            IPresentation powerpointDoc = Presentation.Create();

            //Add a blank slide to the presentation
            ISlide slide = powerpointDoc.Slides.Add(SlideLayoutType.TitleOnly);

            IShape titleShape = slide.Shapes[0] as IShape;

            titleShape.TextBody.AddParagraph(TitleBox.Text).HorizontalAlignment = HorizontalAlignmentType.Center;
            //Add a textbox to the slide

            IShape descriptionShape = slide.AddTextBox(53.22, 141.73, 874.19, 77.70);

            descriptionShape.TextBody.Text = TextBox.Text;

            List <Stream> pictureStreams = new List <Stream>();

            if (btn1.IsChecked == true)
            {
                pictureStreams.Add(new MemoryStream(GetImage(luckyUrls[0])));
            }
            if (btn2.IsChecked == true)
            {
                pictureStreams.Add(new MemoryStream(GetImage(luckyUrls[1])));
            }
            if (btn3.IsChecked == true)
            {
                pictureStreams.Add(new MemoryStream(GetImage(luckyUrls[2])));
            }
            if (btn4.IsChecked == true)
            {
                pictureStreams.Add(new MemoryStream(GetImage(luckyUrls[3])));
            }
            if (btn5.IsChecked == true)
            {
                pictureStreams.Add(new MemoryStream(GetImage(luckyUrls[4])));
            }
            if (btn6.IsChecked == true)
            {
                pictureStreams.Add(new MemoryStream(GetImage(luckyUrls[5])));
            }
            if (btn7.IsChecked == true)
            {
                pictureStreams.Add(new MemoryStream(GetImage(luckyUrls[6])));
            }
            if (btn8.IsChecked == true)
            {
                pictureStreams.Add(new MemoryStream(GetImage(luckyUrls[7])));
            }
            if (btn9.IsChecked == true)
            {
                pictureStreams.Add(new MemoryStream(GetImage(luckyUrls[8])));
            }

            double top    = 53.22;
            double left   = 219.43;
            double width  = 75;
            double height = 75;

            foreach (Stream pictureStream in pictureStreams)
            {
                //Adds the picture to a slide by specifying its size and position.
                slide.Shapes.AddPicture(pictureStream, top, left, width, height);
                top += width;
            }



            //Save the PowerPoint presentation
            powerpointDoc.Save("Sample.pptx");

            //Close the PowerPoint presentation
            powerpointDoc.Close();
            MessageBox.Show("PPT is generated at the repo's bin file!");
        }
Example #32
0
        /// <summary>
        /// Creates slides in PowerPoint Presentation file.
        /// </summary>
        private static void CreateDefaultSlide(IPresentation presentation)
        {
            //Retrieves the first slide of the presentation.
            ISlide slide1 = presentation.Slides[0];
            //Retrieves the first shape of the slide.
            IShape titleShape = slide1.Shapes[0] as IShape;

            //Sets the size and position of the shape.
            titleShape.Left   = 0.33 * 72;
            titleShape.Top    = 0.58 * 72;
            titleShape.Width  = 12.5 * 72;
            titleShape.Height = 1.75 * 72;

            //Retrieves the text body of the shape.
            ITextBody   textFrame1  = (slide1.Shapes[0] as IShape).TextBody;
            IParagraphs paragraphs1 = textFrame1.Paragraphs;
            //Adds a new paragraph.
            IParagraph paragraph = paragraphs1.Add();

            //Sets the horizontal alignment type for the paragraph.
            paragraph.HorizontalAlignment = HorizontalAlignmentType.Center;
            //Adds a text part.
            ITextPart textPart1 = paragraph.AddTextPart();

            //Adds text to the text part.
            textPart1.Text = "Essential Presentation";
            //Sets the font properties for the text part.
            textPart1.Font.CapsType = TextCapsType.All;
            textPart1.Font.FontName = "Adobe Garamond Pro";
            textPart1.Font.Bold     = true;
            textPart1.Font.FontSize = 40;

            //Retrieves the second shape of the slide.
            IShape subtitle = slide1.Shapes[1] as IShape;

            //Sets the size and position of the shape.
            subtitle.Left   = 1.33 * 72;
            subtitle.Top    = 2.67 * 72;
            subtitle.Width  = 10 * 72;
            subtitle.Height = 1.7 * 72;

            //Retrieves the text body of the shape.
            ITextBody textFrame2 = (slide1.Shapes[1] as IShape).TextBody;

            textFrame2.VerticalAlignment = VerticalAlignmentType.Top;
            IParagraphs paragraphs2 = textFrame2.Paragraphs;
            //Adds a new paragraph.
            IParagraph para = paragraphs2.Add();

            //Sets the horizontal alignment type for the paragraph.
            para.HorizontalAlignment = HorizontalAlignmentType.Left;
            //Adds a text part.
            ITextPart textPart2 = para.AddTextPart();

            //Adds text to the text part.
            textPart2.Text          = "Adventure Works Cycles, the fictitious company on which the Adventure Works 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.";
            textPart2.Font.FontName = "Adobe Garamond Pro";
            textPart2.Font.FontSize = 21;

            //Adds a new paragraph.
            para = paragraphs2.Add();
            //Sets the horizontal alignment type for the paragraph.
            para.HorizontalAlignment = HorizontalAlignmentType.Left;
            //Adds a text part.
            textPart2 = para.AddTextPart();
            //Adds text to the text part.
            textPart2.Text = "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.";
            //Sets the font properties.
            textPart2.Font.FontName = "Adobe Garamond Pro";
            textPart2.Font.FontSize = 21;
        }
Example #33
0
 /// <summary>
 /// Load the PowerPoint presentation to convert images
 /// </summary>
 /// <param name="pptxStream">The stream instance of PowerPoint file</param>
 private void LoadPresentation(Stream pptxStream)
 {
     _presentation = Presentation.Open(pptxStream);
     _slideCount   = _presentation.Slides.Count;
     _presentation.ChartToImageConverter = new ChartToImageConverter();
 }
 void IHtmlFormattingController.WriteDocumentEnd(IHtmlGenerator generator, IPresentation presentation)
 {
 }
Example #35
0
        private void btnGeneateDocument_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtFile.Text))
                {
                    MessageBox.Show("Please browse the files to generate document", "Input missing", MessageBoxButton.OK);
                }
                else
                {
                    if (this.radioDestination.IsChecked == true)
                    {
                        //Creates presentation instance for source
                        IPresentation sourcePresentation = Presentation.Open(txtFile.Tag.ToString());

                        //Clones the first slide of the presentation
                        ISlide slide = sourcePresentation.Slides[0].Clone();

                        //Creates instance for the destination presentation
                        IPresentation destinationPresentation = Presentation.Open(destTextBox.Tag.ToString());

                        //Adding the cloned slide to the destination presentation by using Destination option.
                        destinationPresentation.Slides.Add(slide, PasteOptions.UseDestinationTheme, sourcePresentation);

                        //Closing the Source presentation
                        sourcePresentation.Close();

                        //Saving the Destination presentaiton.
                        destinationPresentation.Save("ClonedUsingDestination.pptx");

                        //Closing the destination presentation
                        destinationPresentation.Close();

                        if (MessageBox.Show("First slide is cloned and added as last slide to the Presentation,Do you want to view the resultant Presentation?", "Finished Cloning",
                                            MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
                        {
                            System.Diagnostics.Process process = new System.Diagnostics.Process();
                            process.StartInfo = new System.Diagnostics.ProcessStartInfo("ClonedUsingDestination.pptx")
                            {
                                UseShellExecute = true
                            };
                            process.Start();
                        }
                    }
                    else
                    {
                        //Creates instance for the source presentation
                        IPresentation sourcePresentation = Presentation.Open(txtFile.Tag.ToString());

                        //Clones the first slide of the presentation
                        ISlide slide = sourcePresentation.Slides[0].Clone();

                        //Creates instance for the destination presentation
                        IPresentation destinationPresentation = Presentation.Open(destTextBox.Tag.ToString());

                        //Adding the cloned slide to the destination presentation by using Destination option.
                        destinationPresentation.Slides.Add(slide, PasteOptions.SourceFormatting, sourcePresentation);

                        //Closing the Source presentation
                        sourcePresentation.Close();

                        //Saving the Destination presentaiton.
                        destinationPresentation.Save("ClonedUsingSource.pptx");

                        //Closing the destinatin presentation
                        destinationPresentation.Close();

                        if (MessageBox.Show("First slide is cloned and added as last slide to the Presentation,Do you want to view the resultant Presentation?", "Finished Cloning",
                                            MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
                        {
                            System.Diagnostics.Process process = new System.Diagnostics.Process();
                            process.StartInfo = new System.Diagnostics.ProcessStartInfo("ClonedUsingSource.pptx")
                            {
                                UseShellExecute = true
                            };
                            process.Start();
                        }
                    }
                }
            }
            catch (IOException)
            {
                MessageBox.Show("Please close the generated Presentation", "File is open", MessageBoxButton.OK);
            }
            catch (Exception)
            {
                MessageBox.Show("This file could not be cloned , please contact Syncfusion Direct-Trac system at http://www.syncfusion.com/support/default.aspx for any queries. ", "OOPS..Sorry!",
                                MessageBoxButton.OK);
            }
        }
        void OnButtonClicked(object sender, EventArgs e)
        {
            string resourcePath = "";

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

            //Open a existing PowerPoint presentation
            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 = "";
#if COMMONSB
            resourcePath = "SampleBrowser.Samples.Presentation.Samples.Templates.tablet.jpg";
#else
            resourcePath = "SampleBrowser.Presentation.Samples.Templates.tablet.jpg";
#endif
            assembly   = typeof(Slides).GetTypeInfo().Assembly;
            fileStream = assembly.GetManifestResourceStream(resourcePath);
            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 (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows)
            {
                Xamarin.Forms.DependencyService.Get <ISaveWindowsPhone>().Save("SlidesSample.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", stream);
            }
            else
            {
                Xamarin.Forms.DependencyService.Get <ISave>().Save("SlidesSample.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", stream);
            }
        }
Example #37
0
        void OnButtonClicked(object sender, EventArgs e)
        {
            string   resourcePath = "SampleBrowser.Samples.Presentation.Templates.Images.pptx";
            Assembly assembly     = Assembly.GetExecutingAssembly();
            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 = "SampleBrowser.Samples.Presentation.Templates.tablet.jpg";
            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 stream = new MemoryStream();
            presentation.Save(stream);
            presentation.Close();
            stream.Position = 0;
            if (stream != null)
            {
                SaveAndroid androidSave = new SaveAndroid();
                androidSave.Save("Comments.pptx", "application/powerpoint", stream, m_context);
            }
        }
Example #38
0
		/// <summary>
		/// Evaluate and translate into a presentation
		/// </summary>
		/// <returns>true if success, false if failure</returns>
		public bool EvaluateToPresentation(TopicContext topicContext, Hashtable externalWikimap)
		{
			IBELObject evaluated = EvaluateToObject(topicContext, externalWikimap);
			if (evaluated == null)
				return false;
			IOutputSequence seq = evaluated.ToOutputSequence();
			// output sequence -> pure presentation tree
			_Value = seq.ToPresentation(Presenter);
			return true;
		}
Example #39
0
        private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Assembly assembly     = typeof(SlidesPresentation).GetTypeInfo().Assembly;
            string   resourcePath = "Syncfusion.SampleBrowser.UWP.Presentation.Presentation.Assets.Slides.pptx";
            Stream   fileStream   = assembly.GetManifestResourceStream(resourcePath);

            IPresentation presentation = await Presentation.OpenAsync(fileStream);


            #region Slide1
            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.FontSize = 48;
            textPart1.Font.Bold     = true;
            slide1.Shapes.RemoveAt(1);
            #endregion

            #region Slide2
            ISlide slide2 = presentation.Slides.Add(SlideLayoutType.SectionHeader);
            shape1        = slide2.Shapes[0] as IShape;
            shape1.Left   = 0.77 * 72;
            shape1.Top    = 0.32 * 72;
            shape1.Width  = 7.96 * 72;
            shape1.Height = 0.99 * 72;

            textFrame1 = shape1.TextBody;

            //Instance to hold paragraphs in textframe
            paragraphs1 = textFrame1.Paragraphs;
            paragraph1  = paragraphs1.Add();
            ITextPart textpart1 = paragraph1.AddTextPart();
            paragraphs1[0].HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1.Text          = "Slide with simple text";
            textpart1.Font.FontName = "Helvetica CE 35 Thin";
            textpart1.Font.FontSize = 40;

            IShape shape2 = slide2.Shapes[1] as IShape;
            shape2.Left   = 1.21 * 72;
            shape2.Top    = 1.66 * 72;
            shape2.Width  = 10.08 * 72;
            shape2.Height = 4.93 * 72;

            ITextBody textFrame2 = shape2.TextBody;

            //Instance to hold paragraphs in textframe
            IParagraphs paragraphs2 = textFrame2.Paragraphs;
            IParagraph  paragraph2  = paragraphs2.Add();
            paragraph2.HorizontalAlignment = HorizontalAlignmentType.Left;
            ITextPart textpart2 = paragraph2.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.";
            textpart2.Font.FontName = "Calibri (Body)";
            textpart2.Font.FontSize = 15;
            textpart2.Font.Color    = ColorObject.Black;

            //Instance to hold paragraphs in textframe
            IParagraph paragraph3 = paragraphs2.Add();
            paragraph3.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph3.AddTextPart();
            textpart1.Text          = "Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet.";
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            textpart1.Font.Color    = ColorObject.Black;

            //Instance to hold paragraphs in textframe
            IParagraph paragraph4 = paragraphs2.Add();
            paragraph4.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph4.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.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            textpart1.Font.Color    = ColorObject.Black;

            //Instance to hold paragraphs in textframe
            IParagraph paragraph5 = paragraphs2.Add();
            paragraph5.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph5.AddTextPart();
            textpart1.Text          = "Vestibulum duis integer diam mi libero felis, sollicitudin id dictum etiam blandit lacus, ac condimentum magna dictumst interdum et,";
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            textpart1.Font.Color    = ColorObject.Black;

            //Instance to hold paragraphs in textframe
            IParagraph paragraph6 = paragraphs2.Add();
            paragraph6.HorizontalAlignment = HorizontalAlignmentType.Left;
            ITextPart textpart3 = paragraph6.AddTextPart();
            textpart1.Text          = "nam commodo mi habitasse enim fringilla nunc, amet aliquam sapien per tortor luctus. Conubia voluptates at nunc, congue lectus, malesuada nulla.";
            textpart1.Font.Color    = ColorObject.White;
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            textpart1.Font.Color    = ColorObject.Black;

            //Instance to hold paragraphs in textframe
            IParagraph paragraph7 = paragraphs2.Add();
            paragraph7.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph7.AddTextPart();
            textpart1.Text          = "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,";
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            textpart1.Font.Color    = ColorObject.Black;

            //Instance to hold paragraphs in textframe
            IParagraph paragraph8 = paragraphs2.Add();
            paragraph8.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph8.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.FontName = "Calibri (Body)";
            textpart1.Font.FontSize = 15;
            textpart1.Font.Color    = ColorObject.Black;

            //Instance to hold paragraphs in textframe
            IParagraph paragraph9 = paragraphs2.Add();
            paragraph9.HorizontalAlignment = HorizontalAlignmentType.Left;
            textpart1               = paragraph9.AddTextPart();
            textpart1.Text          = "arcu nec fringilla vel aliquam, mollis lorem rerum hac vestibulum ante nullam. Volutpat a lectus, lorem pulvinar quis. Lobortis vehicula in imperdiet orci urna.";
            textpart1.Font.FontName = "Calibri (Body)";
            textpart1.Font.Color    = ColorObject.Black;
            textpart1.Font.FontSize = 15;
            #endregion

            #region Slide3
            slide2        = presentation.Slides.Add(SlideLayoutType.TwoContent);
            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
            textFrame1 = shape1.TextBody;

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

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

            //Adds shape in slide
            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;
            textFrame2    = shape2.TextBody;

            //Instance to hold paragraphs in textframe
            paragraphs2 = textFrame2.Paragraphs;
            paragraph2  = paragraphs2.Add();
            textpart2   = paragraph2.AddTextPart();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Left;

            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.";
            textpart2.Font.FontName = "Helvetica CE 35 Thin";
            textpart2.Font.FontSize = 16;

            paragraph3 = paragraphs2.Add();
            textpart2  = paragraph3.AddTextPart();
            paragraph3.HorizontalAlignment = HorizontalAlignmentType.Left;

            textpart2.Text          = "Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet.";
            textpart2.Font.FontName = "Helvetica CE 35 Thin";
            textpart2.Font.FontSize = 16;


            paragraph4 = paragraphs2.Add();
            textpart2  = paragraph4.AddTextPart();
            paragraph4.HorizontalAlignment = HorizontalAlignmentType.Left;

            textpart2.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.";
            textpart2.Font.FontName = "Helvetica CE 35 Thin";
            textpart2.Font.FontSize = 16;

            IShape shape3 = (IShape)slide2.Shapes[2];
            slide2.Shapes.RemoveAt(2);

            //Adds picture in the shape
            resourcePath = "Syncfusion.SampleBrowser.UWP.Presentation.Presentation.Assets.tablet.jpg";
            fileStream   = assembly.GetManifestResourceStream(resourcePath);
            IPicture picture1 = slide2.Shapes.AddPicture(fileStream, 0.81 * 72, 1.96 * 72, 6.63 * 72, 4.43 * 72);
            fileStream.Dispose();
            #endregion

            #region Slide4
            ISlide slide4 = presentation.Slides.Add(SlideLayoutType.TwoContent);
            shape1        = slide4.Shapes[0] as IShape;
            shape1.Left   = 0.51 * 72;
            shape1.Top    = 0.34 * 72;
            shape1.Width  = 11.32 * 72;
            shape1.Height = 1.06 * 72;

            textFrame1 = shape1.TextBody;

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

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

            shape2 = slide4.Shapes[1] as IShape;
            slide4.Shapes.Remove(shape2);

            ITable table = (ITable)slide4.Shapes.AddTable(6, 6, 0.81 * 72, 2.14 * 72, 11.43 * 72, 3.8 * 72);
            table.Rows[0].Height   = 0.85 * 72;
            table.Rows[1].Height   = 0.42 * 72;
            table.Rows[2].Height   = 0.85 * 72;
            table.Rows[3].Height   = 0.85 * 72;
            table.Rows[4].Height   = 0.85 * 72;
            table.Rows[5].Height   = 0.85 * 72;
            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;
            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;
            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;
            paragraph7 = textFrame7.Paragraphs.Add();
            paragraph7.HorizontalAlignment = HorizontalAlignmentType.Center;
            ITextPart textPart7 = paragraph7.AddTextPart();
            textPart7.Text = "Country";

            cell1      = table.Rows[1].Cells[0];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "1";

            cell1      = table.Rows[1].Cells[1];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "New Orleans Cajun Delights";

            cell1      = table.Rows[1].Cells[2];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Shelley Burke";

            cell1      = table.Rows[1].Cells[3];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "P.O. Box 78934";

            cell1      = table.Rows[1].Cells[4];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "New Orleans";

            cell1      = table.Rows[1].Cells[5];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "USA";

            cell1      = table.Rows[2].Cells[0];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "2";

            cell1      = table.Rows[2].Cells[1];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Cooperativa de Quesos 'Las Cabras";

            cell1      = table.Rows[2].Cells[2];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Antonio del Valle Saavedra";

            cell1      = table.Rows[2].Cells[3];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Calle del Rosal 4";

            cell1      = table.Rows[2].Cells[4];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Oviedo";

            cell1      = table.Rows[2].Cells[5];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Spain";

            cell1      = table.Rows[3].Cells[0];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "3";

            cell1      = table.Rows[3].Cells[1];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Mayumi";

            cell1      = table.Rows[3].Cells[2];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Mayumi Ohno";

            cell1      = table.Rows[3].Cells[3];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "92 Setsuko Chuo-ku";

            cell1      = table.Rows[3].Cells[4];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Osaka";

            cell1      = table.Rows[3].Cells[5];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Japan";

            cell1      = table.Rows[4].Cells[0];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "4";

            cell1      = table.Rows[4].Cells[1];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Pavlova, Ltd.";

            cell1      = table.Rows[4].Cells[2];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Ian Devling";

            cell1      = table.Rows[4].Cells[3];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "74 Rose St. Moonie Ponds";

            cell1      = table.Rows[4].Cells[4];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Melbourne";

            cell1      = table.Rows[4].Cells[5];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Australia";

            cell1      = table.Rows[5].Cells[0];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "5";

            cell1      = table.Rows[5].Cells[1];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Specialty Biscuits, Ltd.";

            cell1      = table.Rows[5].Cells[2];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Peter Wilson";

            cell1      = table.Rows[5].Cells[3];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "29 King's Way";

            cell1      = table.Rows[5].Cells[4];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "Manchester";

            cell1      = table.Rows[5].Cells[5];
            textFrame1 = cell1.TextBody;
            paragraph1 = textFrame1.Paragraphs.Add();
            paragraph1.HorizontalAlignment = HorizontalAlignmentType.Center;
            textpart1      = paragraph1.AddTextPart();
            textpart1.Text = "UK";

            slide4.Shapes.RemoveAt(1);
            #endregion

            MemoryStream ms = new MemoryStream();

            SavePPTX(presentation);
        }
Example #40
0
 public void AddOrUpdatePresentation(IPresentation presentation)
 {
     throw new NotImplementedException();
 }
Example #41
0
 /// <summary>
 /// Shows this presentation (either for the first time or after it has been hidden).
 /// </summary>
 /// <param name="transitionDuration">Duration of the transition in milliseconds.
 /// As this presentation does not support transitions, this parameter will be ignored.</param>
 /// <param name="callback">An optional callback action that will be called after the transition
 /// (or instantly when there is no transition).</param>
 public void Show(int transitionDuration = 0, Action callback = null, IPresentation previous = null)
 {
     this.form.Show();
     if (callback != null)
         callback();
 }
Example #42
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);
        }
Example #43
0
 public void TransitionTo(IPresentation target, int transitionDuration, Action callback)
 {
     // not possible
 }
Example #44
0
        void OnButtonClicked(object sender, EventArgs e)
        {
            string   resourcePath = "SampleBrowser.Presentation.Samples.Templates.HelloWorld.pptx";
            Assembly assembly     = typeof(GettingStarted).GetTypeInfo().Assembly;
            Stream   fileStream   = assembly.GetManifestResourceStream(resourcePath);

            //Open a PowerPoint presentation
            IPresentation presentation = Syncfusion.Presentation.Presentation.Open(fileStream);

            #region Slide1
            //Get the first slide from Presentation
            ISlide slide1 = presentation.Slides[0];
            //Get the shape from slide and set bounds
            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;
            //Set a content to the text box and apply text formatting
            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.For more details please ";
            textPart2.Font.FontName = "Arial";
            textPart2.Font.FontSize = 21;

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

            //Save the Presentation to stream
            MemoryStream stream = new MemoryStream();
            presentation.Save(stream);
            presentation.Close();
            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);
            }
        }
Example #45
0
        private void AcceptLoop(IPresentation personality)
        {
            Console.WriteLine("in accept loop");

            while (true)
            {
                MessageChannel newChannel = personality.AwaitNextConnection();
                Console.WriteLine("accepted");
                _channels.Add(newChannel);

                // TODO: we're going to need to maintain a list of "canonical" clients for each personality at some point
                newChannel.MessageReceived += ((msg) => MakeActionAndDispatch(msg, newChannel));
                newChannel.ChannelClosed += (() => OnChannelClosed(newChannel));
            }
        }
Example #46
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();
			}
		}