Essential Studio for Asp.Net | Demos

SHOWCASE SAMPLES
Showcase samples

    Essential Presentation library has support for creating, editing and converting PowerPoint slides.

    This sample demonstrates how to create slides, shapes, paragraphs and adding texts in a PowerPoint presentation.

    Features:

    • Create a PowerPoint presentation from scratch with few lines of code.
    • Open the existing PowerPoint presentation from file system or stream, modify and save it back.
    • Save the PowerPoint presentation to a local file, stream, or stream it to the client browser.
    • Create, edit and convert shapes.
    • Create, edit and convert text.
    • Add and manipulate single-level and multilevel lists equivalent to Microsoft PowerPoint.
    • Create, edit and convert charts.
    • Create, edit and convert SmartArt diagrams.
    • Create, edit and convert tables with different styles.
    • Copy and paste PowerPoint slides with source and destination paste options.
    • Create, reply and edit comments.
    • Create, edit and convert notes pages.
    • Apply, edit and convert formatting of slide elements.

    Click the button to view a presentation document generated by Essential Presentation. Please note that MS PowerPoint viewer is required to view the resultant document.

    <%@ Page Language="C#" MasterPageFile="~/Samplebrowser.Master" AutoEventWireup="true" CodeBehind="HelloWorld.aspx.cs" Inherits="WebSampleBrowser.PPTX.HelloWorld" %>
    
    <asp:Content ID="Content2" ContentPlaceHolderID="ControlsSection" runat="server">
        <p>Essential Presentation library has support for creating, editing and converting PowerPoint slides.</p>
        <p>This sample demonstrates how to create slides, shapes, paragraphs and adding texts in a PowerPoint presentation.</p>
        <p><b>Features:</b></p>    
        <p>
            <ul>
            <li>Create a PowerPoint presentation from scratch with few lines of code.</li>
            <li>Open the existing PowerPoint presentation from file system or stream, modify and save it back.</li>
            <li>Save the PowerPoint presentation to a local file, stream, or stream it to the client browser.</li>
            <li>Create, edit and convert shapes.</li>
            <li>Create, edit and convert text.</li>
            <li>Add and manipulate single-level and multilevel lists equivalent to Microsoft PowerPoint.</li>
            <li>Create, edit and convert charts.</li>
            <li>Create, edit and convert SmartArt diagrams.</li>
            <li>Create, edit and convert tables with different styles.</li>
            <li>Copy and paste PowerPoint slides with source and destination paste options.</li>
            <li>Create, reply and edit comments.</li>
            <li>Create, edit and convert notes pages.</li>
            <li>Apply, edit and convert formatting of slide elements.</li>
            </ul>
        </p>
        <table width="100%">
            <tr>
                <td align="left">
                    <div>
                        <asp:Label Width="100%"  Style="text-align: justify;"
                            ID="label6" runat="server" Text="Click the button to view a presentation document generated by Essential Presentation.  Please note that MS PowerPoint viewer is required to view the resultant document."></asp:Label>
                    </div>
                    <br />
                    <div style="border: solid 0px #788DB3; padding: 5px 7px 5px 7px;">
                        <table width="100%">
                            <tr>
                                <td align="left" width="100%" cellpadding="0" cellspacing="0" border="0">
                                    <asp:Button Width="165px" Style="margin-right: 3px" ID="Button1" Height="27px" runat="server"
                                         OnClick="Button1_Click" Text="Create Presentation" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
        </table>
    </asp:Content>
    
    #region Copyright Syncfusion Inc. 2001 - 2015
    // Copyright Syncfusion Inc. 2001 - 2015. All rights reserved.
    // Use of this code is subject to the terms of our license.
    // A copy of the current license can be obtained at any time by e-mailing
    // licensing@syncfusion.com. Any infringement will be prosecuted under
    // applicable laws. 
    #endregion
    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.IO;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Drawing;
    using Syncfusion.Presentation;
    
    
    namespace WebSampleBrowser.PPTX
    {
        public partial class HelloWorld : System.Web.UI.Page
        {
            # region Page Load
            /// <summary>
            /// Handles page load
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            protected void Page_Load(object sender, EventArgs e)
            {
    
            }
            # endregion
            # region Events
            /// <summary>
            /// Creates Presentation
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            protected void Button1_Click(object sender, EventArgs e)
            {
                Stream file1 = new FileStream(ResolveApplicationDataPath("HelloWorld.pptx"), FileMode.Open, FileAccess.Read, FileShare.Read);
    
                IPresentation presentation = Presentation.Open(file1);
                // New Instance of PowerPoint is Created.[Equivalent to launching MS PowerPoint with no slides].
    
                //  Method call to create slides
                CreateSlide1(presentation);
    
                presentation.Save("HelloWorldSample.pptx", FormatType.Pptx, Response);
    
            }
            #endregion
    
            # region Slide1
            private void CreateSlide1(IPresentation presentation)
            {
                ISlide slide1 = presentation.Slides[0];
                IShape titleShape = slide1.Shapes[0] as IShape;
                titleShape.Left = 0.33 * 72;
                titleShape.Top = 0.58 * 72;
                titleShape.Width = 12.5 * 72;
                titleShape.Height = 1.75 * 72;
    
                ITextBody textFrame1 = (slide1.Shapes[0] as IShape).TextBody;
                IParagraphs paragraphs1 = textFrame1.Paragraphs;
                IParagraph paragraph = paragraphs1.Add();
                paragraph.HorizontalAlignment = HorizontalAlignmentType.Center;
                ITextPart textPart1 = paragraph.AddTextPart();
                textPart1.Text = "Essential Presentation";
                textPart1.Font.CapsType = TextCapsType.All;
                textPart1.Font.FontName = "Adobe Garamond Pro";
                textPart1.Font.Bold = true;
                textPart1.Font.FontSize = 40;
    
                IShape subtitle = slide1.Shapes[1] as IShape;
                subtitle.Left = 0.5 * 72;
                subtitle.Top = 3 * 72;
                subtitle.Width = 11.8 * 72;
                subtitle.Height = 1.7 * 72;
    
                ITextBody textFrame2 = (slide1.Shapes[1] as IShape).TextBody;
                textFrame2.VerticalAlignment = VerticalAlignmentType.Top;
                IParagraphs paragraphs2 = textFrame2.Paragraphs;
                IParagraph para = paragraphs2.Add();
                para.HorizontalAlignment = HorizontalAlignmentType.Left;
                ITextPart textPart2 = para.AddTextPart();
                textPart2.Text = "Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum tempus.Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet.";
                textPart2.Font.FontName = "Adobe Garamond Pro";
                textPart2.Font.FontSize = 21;
    
                para = paragraphs2.Add();
                para.HorizontalAlignment = HorizontalAlignmentType.Left;
                textPart2 = para.AddTextPart();
                textPart2.Text = "Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet. Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula.";
                textPart2.Font.FontName = "Adobe Garamond Pro";
                textPart2.Font.FontSize = 21;
            }
            #endregion
            
            protected string ResolveApplicationDataPath(string fileName)
            {
                string dataPath = new System.IO.DirectoryInfo(Request.PhysicalPath + "..\\..\\..\\App_Data\\Presentation").FullName;
                return string.Format("{0}\\{1}", dataPath, fileName);
            }
        }
    }