private GanttProperties ConvertGridObject(string ganttProperty) { GanttProperties treeGridProp = new GanttProperties(); treeGridProp = (GanttProperties)JsonConvert.DeserializeObject(ganttProperty, typeof(GanttProperties)); return(treeGridProp); }
public void ExportToExcel(string GanttModel) { ExcelExport exp = new ExcelExport(); var DataSource = this.GetEditingDataSource(); GanttProperties obj = ConvertGanttObject(GanttModel); exp.Export(obj, DataSource, "GanttExport.xlsx", ExcelVersion.Excel2010, new GanttExportSettings() { Theme = ExportTheme.FlatSaffron }); }
public void PdfExport(string GanttModel, bool isFitToWidth) { PdfExport exp = new PdfExport(); var DataSource = this.GetEditingDataSource(); GanttProperties obj = ConvertGanttObject(GanttModel); GanttPdfExportSettings settings = new GanttPdfExportSettings(); settings.Theme = GanttExportTheme.FlatSaffron; settings.Locale = Request.Form["locale"]; settings.IsFitToWidth = isFitToWidth; exp.Export(obj, DataSource, settings, "Gantt"); }
public void ConditionalExcel(string GanttModel) { ExcelExport exp = new ExcelExport(); var DataSource = GetExportDataSource(); GanttProperties obj = ConvertToGanttObject(GanttModel); obj.ServerExcelQueryCellInfo = queryExcelCellDelegate; exp.Export(obj, DataSource, "GanttExport.xlsx", ExcelVersion.Excel2010, new GanttExportSettings() { Theme = ExportTheme.FlatSaffron }); }
public void PdfExport() { GanttProperties gantt = getGanttProperties(); PdfExport exp = new PdfExport(); GanttPdfExportSettings settings = new GanttPdfExportSettings(); settings.EnableFooter = true; settings.ProjectName = "Project Tracker"; settings.IsFitToWidth = true; settings.Theme = GanttExportTheme.FlatLime; exp.Export(gantt, (IEnumerable)gantt.DataSource, settings, "Gantt"); }
public void MultipleExportToPdf(string[] GanttModel) { PdfExport exp = new PdfExport(); var PlanData = this.GetPlanDataSource(); var DesignData = this.GetDesignDataSource(); var ImplementationData = this.GetImplementationDataSource(); PdfDocument document = null; GanttPdfExportSettings settings = new GanttPdfExportSettings(); settings.Theme = GanttExportTheme.FlatSaffron; settings.Locale = Request.Form["locale"]; //Create footer template RectangleF bounds = new RectangleF(0, 0, 762, 25); PdfSolidBrush brush = new PdfSolidBrush(new PdfColor(51, 51, 51)); PdfPen pen = new PdfPen(new PdfColor(200, 200, 200)); PdfFont font = new PdfTrueTypeFont(new Font("Segoe UI", 10), true); PdfStringFormat format = new PdfStringFormat(); format.Alignment = PdfTextAlignment.Center; format.LineAlignment = PdfVerticalAlignment.Middle; PdfPageTemplateElement footer = new PdfPageTemplateElement(bounds); PdfPageNumberField pageNumber = new PdfPageNumberField(font, brush); PdfCompositeField compositeField = new PdfCompositeField(font, brush, "Page {0}", pageNumber); compositeField.StringFormat = format; compositeField.Bounds = footer.Bounds; footer.Graphics.DrawRectangle(pen, bounds); compositeField.Draw(footer.Graphics, new PointF(0, 0)); PdfDocumentTemplate footerTemplate = new PdfDocumentTemplate(); footerTemplate.Bottom = footer; settings.PdfDocumentTemplate = footerTemplate; int count = 1; foreach (string gridProperty in GanttModel) { GanttProperties gridProp = this.ConvertGanttObject(gridProperty); if (count == 1) { document = exp.Export(gridProp, (IEnumerable)PlanData, settings, false); } else if (count == 2) { document = exp.Export(gridProp, (IEnumerable)DesignData, settings, document, false); } else { exp.Export(gridProp, (IEnumerable)ImplementationData, settings, "Gantt", document, true); } count++; } }
public ActionResult ExportToPdf(string GanttModel) { PdfExport exp = new PdfExport(); var DataSource = GetExportEditingTaskData(); GanttProperties ganttProp = ConvertGridObject(GanttModel); GanttPdfExport pdfExp = new GanttPdfExport(); pdfExp.FileName = "GanttExport"; pdfExp.ExportSettings = new GanttPdfExportSettings() { Theme = GanttExportTheme.FlatSaffron }; return(exp.Export(ganttProp, DataSource, pdfExp)); }
public void ConditionalPdfExport(string GanttModel) { PdfExport exp = new PdfExport(); var DataSource = GetExportDataSource(); GanttProperties obj = ConvertToGanttObject(GanttModel); obj.ServerPdfQueryCellInfo = queryCellDelegate; obj.ServerPdfQueryTaskbarInfo = queryTaskbarDelegate; GanttPdfExportSettings settings = new GanttPdfExportSettings(); settings.Theme = GanttExportTheme.FlatSaffron; settings.Locale = Request.Form["locale"]; settings.IsFitToWidth = true; exp.Export(obj, DataSource, settings, "Gantt"); }
public ActionResult ExportToExcel(string GanttModel) { ExcelExport exp = new ExcelExport(); var DataSource = GetExportEditingTaskData(); GanttProperties ganttProp = ConvertGridObject(GanttModel); GanttExcelExport excelExp = new GanttExcelExport(); excelExp.FileName = "Export.xlsx"; GanttExportSettings settings = new GanttExportSettings() { Theme = ExportTheme.FlatSaffron }; excelExp.ExcelVersion = ExcelVersion.Excel2010; return(exp.Export(ganttProp, DataSource, settings)); }
private GanttProperties getGanttProperties() { GanttProperties gantt = new GanttProperties(); gantt.TaskIdMapping = "taskID"; gantt.TaskNameMapping = "taskName"; gantt.StartDateMapping = "startDate"; gantt.EndDateMapping = "endDate"; gantt.ProgressMapping = "progress"; gantt.DurationMapping = "duration"; gantt.ChildMapping = "subtasks"; gantt.PredecessorMapping = "predecessor"; gantt.DataSource = GetData(); List <GanttColumn> colList = new List <GanttColumn>(); colList.Add(new GanttColumn() { Field = "taskID", MappingName = "taskID", HeaderText = "ID", Width = 70 }); colList.Add(new GanttColumn() { Field = "taskName", MappingName = "taskName", HeaderText = "Task Name", Width = 100 }); colList.Add(new GanttColumn() { Field = "startDate", MappingName = "startDate", HeaderText = "Start Date", Width = 100 }); colList.Add(new GanttColumn() { Field = "endDate", MappingName = "endDate", HeaderText = "End Date", Width = 100 }); colList.Add(new GanttColumn() { Field = "duration", MappingName = "duration", HeaderText = "duration", Width = 70 }); colList.Add(new GanttColumn() { Field = "progress", MappingName = "progress", HeaderText = "progress", Width = 70 }); gantt.Columns = colList; gantt.ScheduleStartDate = "02/26/2017"; gantt.ScheduleEndDate = "03/18/2017"; return(gantt); }
private GanttProperties ConvertGridObject(string gridProperty) { JavaScriptSerializer serializer = new JavaScriptSerializer(); IEnumerable div = (IEnumerable)serializer.Deserialize(gridProperty, typeof(IEnumerable)); GanttProperties gridProp = new GanttProperties(); foreach (KeyValuePair <string, object> ds in div) { var property = gridProp.GetType().GetProperty(ds.Key, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase); if (property != null) { Type type = property.PropertyType; string serialize = serializer.Serialize(ds.Value); object value = serializer.Deserialize(serialize, type); property.SetValue(gridProp, value, null); } } return(gridProp); }
public void MultipleExportToExcel(string[] GanttModel) { ExcelExport exp = new ExcelExport(); var PlanData = this.GetPlanDataSource(); var DesignData = this.GetDesignDataSource(); var ImplementationData = this.GetImplementationDataSource(); IWorkbook document = null; int count = 1; foreach (string gridProperty in GanttModel) { GanttProperties gridProp = this.ConvertGanttObject(gridProperty); if (count == 1) { document = exp.Export(gridProp, PlanData, new GanttExportSettings() { Theme = ExportTheme.FlatSaffron }, true, "Planning Phase"); } else if (count == 2) { exp.Export(gridProp, DesignData, new GanttExportSettings() { Theme = ExportTheme.FlatSaffron }, "Export", document, true, "Design Phase"); } else { exp.Export(gridProp, ImplementationData, new GanttExportSettings() { Theme = ExportTheme.FlatSaffron }, "Export.xlsx", document, false, "Implementation Phase"); } count++; } }