Essential Studio for Asp.Net | Demos

SHOWCASE SAMPLES
Showcase samples
    Gantt / Exporting
    Fit timeline to one page in PDF
    <%@ Page Title="Gantt-Exporting Gantt-ASP.NET-SYNCFUSION" Language="C#" MetaDescription="This example illustrates exporting Gantt project tasks to Excel and PDF formats." MasterPageFile="~/Samplebrowser.Master" AutoEventWireup="true" CodeBehind="GanttExporting.aspx.cs" Inherits="WebSampleBrowser.Gantt.GanttExporting" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="SampleHeading" runat="server">
        <span class="sampleName">Gantt / Exporting</span>
    </asp:Content>
    
    <asp:Content ID="ControlContent" runat="server" ContentPlaceHolderID="ControlsSection">
        <div>
            <ej:Gantt runat="server" ID="GanttControlExporting" ChildMapping="SubTasks" TreeColumnIndex="1" IsResponsive="true" 
                    
                TaskIdMapping="TaskID"
                TaskNameMapping="TaskName"
                StartDateMapping="StartDate"
                EndDateMapping="EndDate"
                ProgressMapping="Progress"   
                AllowGanttChartEditing="false"
                OnServerExcelExporting="GanttControlExporting_ServerExcelExporting" OnServerPdfExporting="GanttControlExporting_ServerPdfExporting" Load="load"
                 TaskSchedulingMode="Custom" TaskSchedulingModeMapping="IsManual">
                <EditSettings AllowDeleting="false" />
                <SizeSettings Width="100%" Height="450px" />
                <ToolbarSettings ShowToolbar="true" ToolbarItems="excelExport,pdfExport" />
                <StripLines>
                    <ej:GanttStripLine Day="02/06/2017" Label="Project Start" LineColor="darkblue" LineWidth="2" LineStyle="solid" />
                </StripLines>
            </ej:Gantt>
        </div>
    </asp:Content>
    <asp:Content ID="Content4" runat="server" ContentPlaceHolderID="PropertySection">
        <div id="sampleProperties">
            <div class="prop-grid">
                <div class="row">
                    <div class="col-md-3">
                        Fit timeline to one page in PDF
                    </div>
                    <div class="col-md-3">
                        <div style="padding-left: 10px;">
                            <ej:CheckBox Checked="false" runat="server" ID="EnablePageBreak"></ej:CheckBox>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </asp:Content>
    <asp:Content ID="Content3" runat="server" ContentPlaceHolderID="ScriptSection">
        <script type="text/javascript">
            $(function () {
                $("#sampleProperties").ejPropertiesPanel();
            });
            function load(args) {
                this.getColumns()[0].width = 60;
            }
        </script>
    </asp:Content>
    
    
    using Syncfusion.JavaScript;
    using Syncfusion.JavaScript.Models;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Collections;
    using Syncfusion.XlsIO;
    using Syncfusion.EJ.Export;
    using WebSampleBrowser.Gantt.Model;
    
    namespace WebSampleBrowser.Gantt
    {
        public partial class GanttExporting : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                TaskDetailsCollection TaskCollection = new TaskDetailsCollection();
                this.GanttControlExporting.DataSource = TaskCollection.GetDataSource();
                this.GanttControlExporting.DataBind();
            }
    
            protected void GanttControlExporting_ServerExcelExporting(object sender, Syncfusion.JavaScript.Web.GanttEventArgs e)
              {
                ExcelExport exp = new ExcelExport();
                GanttExportSettings settings = new GanttExportSettings();
                settings.Theme = ExportTheme.FlatLime;
                exp.Export(this.GanttControlExporting.Model, (IEnumerable)this.GanttControlExporting.DataSource, "Export.xlsx", ExcelVersion.Excel2010, new GanttExportSettings() { Theme = ExportTheme.FlatLime });
              }
    
            protected void GanttControlExporting_ServerPdfExporting(object sender, Syncfusion.JavaScript.Web.GanttEventArgs e)
            {
                PdfExport exp = new PdfExport();
                GanttPdfExportSettings settings = new GanttPdfExportSettings();
                settings.EnableFooter = true;
                settings.ProjectName = "Project Tracker";
                settings.Locale = e.Arguments["locale"].ToString();
                settings.Theme = GanttExportTheme.FlatLime;
                settings.IsFitToWidth = this.EnablePageBreak.Checked;
                exp.Export(this.GanttControlExporting.Model, (IEnumerable)this.GanttControlExporting.DataSource, settings, "Gantt");
            }
        }
    }