Example #1
0
        /// <summary>
        /// Create a Section
        /// </summary>
        /// <param name="tables"></param>
        /// <param name="startIndex"></param>
        /// <param name="endIndex"></param>
        /// <returns></returns>
        private Telerik.Windows.Documents.Model.Section GetSection(List <Table> tables, int startIndex, int endIndex)
        {
            Table    headerTable = new Table(1, 4);
            TableRow headerRow   = new TableRow();

            TableCell securityCell = new TableCell();

            Telerik.Windows.Documents.Model.Paragraph securityParagraph = new Telerik.Windows.Documents.Model.Paragraph();
            Telerik.Windows.Documents.Model.Span      securitySpan      = new Telerik.Windows.Documents.Model.Span("Security: " + SecurityName);
            securityParagraph.Inlines.Add(securitySpan);
            securityCell.Children.Add(securityParagraph);

            TableCell countryCell = new TableCell();

            Telerik.Windows.Documents.Model.Paragraph countryParagraph = new Telerik.Windows.Documents.Model.Paragraph();
            Telerik.Windows.Documents.Model.Span      countrySpan      = new Telerik.Windows.Documents.Model.Span("Country: " + CountryName);
            countryParagraph.Inlines.Add(countrySpan);
            countryCell.Children.Add(countryParagraph);

            TableCell createdByCell = new TableCell();

            Telerik.Windows.Documents.Model.Paragraph createdByParagraph = new Telerik.Windows.Documents.Model.Paragraph();
            Telerik.Windows.Documents.Model.Span      createdBySpan      = new Telerik.Windows.Documents.Model.Span("Created by: " + CreatedBy);
            createdByParagraph.Inlines.Add(createdBySpan);
            createdByCell.Children.Add(createdByParagraph);

            TableCell createdOn = new TableCell();

            Telerik.Windows.Documents.Model.Paragraph createdOnParagraph = new Telerik.Windows.Documents.Model.Paragraph();
            Telerik.Windows.Documents.Model.Span      createdOnSpan      = new Telerik.Windows.Documents.Model.Span("Created on: " + CreationDate);
            createdOnParagraph.Inlines.Add(createdOnSpan);
            createdOn.Children.Add(createdOnParagraph);

            headerRow.Cells.Add(securityCell);
            headerRow.Cells.AddAfter(securityCell, countryCell);
            headerRow.Cells.AddAfter(countryCell, createdByCell);
            headerRow.Cells.AddAfter(createdByCell, createdOn);
            headerTable.Rows.Add(headerRow);


            Telerik.Windows.Documents.Model.Section section = new Telerik.Windows.Documents.Model.Section();
            Table        documentTable     = new Table();
            List <Table> tablesToAddToPage = new List <Table>();

            for (int i = startIndex; i < endIndex; i++)
            {
                if (tables.Count >= i)
                {
                    tablesToAddToPage.Add(tables[i]);
                }
            }

            documentTable = GenerateCombinedTable(tablesToAddToPage);
            section.Blocks.Add(headerTable);
            section.Blocks.Add(documentTable);

            return(section);
        }
Example #2
0
        /// <summary>
        /// Helper Method for printing Chart
        /// </summary>
        /// <param name="chart">The Chart to be Printed</param>
        private static RadDocument CreateChartDocumentPart(RadChart chart)
        {
            try
            {
                RadDocument document = new RadDocument();
                Telerik.Windows.Documents.Model.Section   section   = new Telerik.Windows.Documents.Model.Section();
                Telerik.Windows.Documents.Model.Paragraph paragraph = new Telerik.Windows.Documents.Model.Paragraph();
                BitmapImage bi = new BitmapImage();

                using (MemoryStream ms = new MemoryStream())
                {
                    chart.ExportToImage(ms, new PngBitmapEncoder());
                    bi.SetSource(ms);
                }

                double imageWidth  = chart.ActualWidth;
                double imageHeight = chart.ActualHeight;

                if (imageWidth > 625)
                {
                    imageWidth  = 625;
                    imageHeight = chart.ActualHeight * imageWidth / chart.ActualWidth;
                }

                ImageInline image = new ImageInline(new WriteableBitmap(bi))
                {
                    Width = imageWidth, Height = imageHeight
                };
                paragraph.Inlines.Add(image);
                section.Blocks.Add(paragraph);
                document.Sections.Add(section);
                return(document);
            }
            catch (Exception ex)
            {
                Prompt.ShowDialog("Message: " + ex.Message + "\nStackTrace: " + Logging.StackTraceToString(ex), "Exception", MessageBoxButton.OK);
                return(null);
            }
        }
Example #3
0
        /// <summary>
        /// Helper Function for PDF
        /// </summary>
        /// <param name="grid"></param>
        /// <returns></returns>
        public static RadDocument CreateDocument(RadGridView grid, List <int> skipColumnDisplayIndex          = null
                                                 , Func <int, int, object, object, object> cellValueOverwrite = null, Func <int, int, string> columnAggregateOverWrite = null
                                                 , Func <Block> initialHeaderBlock = null)
        {
            if (skipColumnDisplayIndex == null)
            {
                skipColumnDisplayIndex = new List <int>();
            }

            List <GridViewBoundColumnBase> columns = (from c in grid.Columns.OfType <GridViewBoundColumnBase>()
                                                      orderby c.DisplayIndex
                                                      select c).ToList();

            columns = columns.Where(g => g.IsVisible == true && (!skipColumnDisplayIndex.Contains(g.DisplayIndex))).ToList();

            List <int> aggregateLog = new List <int>();

            foreach (var column in grid.Columns)
            {
                if (column is GridViewDataColumn)
                {
                    if ((column as GridViewDataColumn).AggregateFunctions.Count != 0)
                    {
                        aggregateLog.Add(column.DisplayIndex);
                    }
                }
                if (column is GridViewComboBoxColumn)
                {
                    if ((column as GridViewComboBoxColumn).AggregateFunctions.Count != 0)
                    {
                        aggregateLog.Add(column.DisplayIndex);
                    }
                }
            }
            List <int> visibleAggregateResultIndex = new List <int>();

            for (int i = 0; i < aggregateLog.Count; i++)
            {
                if (grid.Columns[aggregateLog[i]].IsVisible)
                {
                    visibleAggregateResultIndex.Add(i);
                }
            }

            Table       table    = new Table();
            RadDocument document = new RadDocument();

            document.LayoutMode = DocumentLayoutMode.Paged;
            document.SectionDefaultPageOrientation = PageOrientation.Portrait;
            //document.Measure(RadDocument.MAX_DOCUMENT_SIZE);
            //document.Arrange(new RectangleF(PointF.Empty, document.DesiredSize));
            document.ParagraphDefaultSpacingAfter = document.ParagraphDefaultSpacingBefore = 0;
            document.PageViewMargin           = new SizeF(0, 0);
            document.SectionDefaultPageMargin = new Padding(0, 0, 0, 0);
            Telerik.Windows.Documents.Model.Section section = new Telerik.Windows.Documents.Model.Section();
            if (initialHeaderBlock != null)
            {
                Block result = initialHeaderBlock();

                RadDocument headerDoc = new RadDocument();
                headerDoc.Measure(RadDocument.MAX_DOCUMENT_SIZE);
                headerDoc.Arrange(new RectangleF(PointF.Empty, document.DesiredSize));
                headerDoc.ParagraphDefaultSpacingAfter = headerDoc.ParagraphDefaultSpacingBefore = 0;
                Section hSection = new Section();
                headerDoc.Sections.Add(hSection);
                headerDoc.SectionDefaultPageMargin = new Telerik.Windows.Documents.Layout.Padding(0, 0, 0, 0);
                hSection.Blocks.Add(result);

                Header header = new Header();
                header.Body = headerDoc;

                section.Headers.Default = header;
            }
            section.Blocks.Add(table);
            document.Sections.Add(section);
            if (grid.Items.Groups != null)
            {
                for (int i = 0; i < grid.Items.Groups.Count(); i++)
                {
                    AddGroupRow(table, grid.Items.Groups[i] as QueryableCollectionViewGroup, columns, grid, visibleAggregateResultIndex
                                , cellValueOverwrite);
                }
            }
            else
            {
                AddDataRows(table, grid.Items, columns, grid, cellValueOverwrite);
            }

            if (grid.ShowColumnFooters)
            {
                TableRow columnFooterRow = new TableRow();
                int      aggregateIndex  = -1;
                for (int i = 0; i < columns.Count(); i++)
                {
                    TableCell cell = new TableCell()
                    {
                        VerticalAlignment = RadVerticalAlignment.Center
                    };
                    cell.Background = Color.FromArgb(255, 228, 229, 229);
                    String footerString = String.Empty;

                    if (columns[i].AggregateFunctions.Count == 1)
                    {
                        aggregateIndex++;
                    }

                    if (columns[i].Footer != null)
                    {
                        if (columns[i].Footer is TextBlock)
                        {
                            footerString = (columns[i].Footer as TextBlock).Text;
                        }
                        else if (columns[i].Footer is AggregateResultsList)
                        {
                            footerString = (columns[i].Footer as AggregateResultsList).ChildrenOfType <TextBlock>().First().Text;
                        }
                        else
                        {
                            footerString = columns[i].Footer.ToString();
                        }
                    }
                    else if (columns[i].AggregateFunctions.Count == 1)
                    {
                        if (columnAggregateOverWrite != null)
                        {
                            footerString = columnAggregateOverWrite(i, aggregateIndex);
                        }
                        else if (grid.AggregateResults[aggregateIndex].FormattedValue != null)
                        {
                            footerString = grid.AggregateResults[aggregateIndex].FormattedValue.ToString();
                        }
                    }
                    AddCellValue(cell, footerString);
                    cell.PreferredWidth = new TableWidthUnit((float)columns[i].ActualWidth);
                    columnFooterRow.Cells.Add(cell);
                }

                table.Rows.Add(columnFooterRow);
            }
            return(document);
        }
Example #4
0
        private RadDocument GenerateRadDocument()
        {
            var export      = pivot.GenerateExport();
            int rowCount    = export.RowCount;
            int columnCount = export.ColumnCount;

            RadDocument document = new RadDocument();

            document.SectionDefaultPageMargin = new Telerik.Windows.Documents.Layout.Padding(10);
            document.LayoutMode = DocumentLayoutMode.Paged;
            document.SectionDefaultPageOrientation          = PageOrientation.Landscape;
            document.Style.SpanProperties.FontFamily        = pivot.FontFamily;
            document.Style.SpanProperties.FontSize          = pivot.FontSize;
            document.Style.ParagraphProperties.SpacingAfter = 0;

            var section = new Telerik.Windows.Documents.Model.Section();

            document.Sections.Add(section);
            section.Blocks.Add(new Telerik.Windows.Documents.Model.Paragraph());

            var table = new Telerik.Windows.Documents.Model.Table(rowCount, columnCount);

            section.Blocks.Add(table);

            var tableRows = table.Rows.ToArray();

            foreach (var cellInfo in export.Cells)
            {
                int rowStartIndex    = cellInfo.Row;
                int rowEndIndex      = rowStartIndex + cellInfo.RowSpan - 1;
                int columnStartIndex = cellInfo.Column;
                int columnEndIndex   = columnStartIndex + cellInfo.ColumnSpan - 1;

                var value = cellInfo.Value;
                var text  = Convert.ToString(value);
                if (!string.IsNullOrWhiteSpace(text))
                {
                    var       cells     = tableRows[rowStartIndex].Cells.ToArray();
                    var       cell      = cells[columnStartIndex];
                    Paragraph paragraph = new Paragraph();
                    cell.Blocks.Add(paragraph);
                    var span = new Span(text);
                    paragraph.Inlines.Add(span);
                    paragraph.TextAlignment = GetTextAlignment(cellInfo.TextAlignment);

                    if (cellInfo.FontWeight.HasValue)
                    {
                        span.FontWeight = cellInfo.FontWeight.Value;
                    }

                    Color foreColor;
                    if (GetColor(cellInfo.Foreground, out foreColor))
                    {
                        span.ForeColor = foreColor;
                    }

                    cell.VerticalAlignment = GetVerticalAlignment(cellInfo.VerticalAlignment);
                    paragraph.LeftIndent   = cellInfo.Indent * 20;
                }

                var borderThickness = cellInfo.BorderThickness;
                var borderBrush     = cellInfo.BorderBrush;
                var background      = cellInfo.Background;

                Color backColor;
                bool  hasBackground = GetColor(cellInfo.Background, out backColor);

                if (cellInfo.RowSpan > 1 && cellInfo.ColumnSpan > 1)
                {
                    for (int k = rowStartIndex; k <= rowEndIndex; k++)
                    {
                        var cells = tableRows[k].Cells.ToArray();
                        for (int j = columnStartIndex; j <= columnEndIndex; j++)
                        {
                            var cell = cells[j];
                            if (hasBackground)
                            {
                                cell.Background = backColor;
                            }

                            cell.Borders = GetCellBorders(borderThickness, borderBrush, cell.Borders, k, rowStartIndex, rowEndIndex, j, columnStartIndex, columnEndIndex, hasBackground);
                        }
                    }
                }
                else if (cellInfo.RowSpan > 1)
                {
                    for (int j = rowStartIndex; j <= rowEndIndex; j++)
                    {
                        // TODO: check when ColumnSpan > 1;
                        var cell = tableRows[j].Cells.ToArray()[columnStartIndex];

                        Position position = j == rowStartIndex ? Position.First : ((j == rowEndIndex) ? Position.Last : Position.Middle);

                        cell.Borders = GetCellBorders(borderThickness, borderBrush, position, cell.Borders, true, cellInfo.Background != null);
                        if (hasBackground)
                        {
                            cell.Background = backColor;
                        }
                    }
                }
                else if (cellInfo.ColumnSpan > 1)
                {
                    var cells = tableRows[rowStartIndex].Cells.ToArray();
                    for (int j = columnStartIndex; j <= columnEndIndex; j++)
                    {
                        // TODO: check when RowSpan > 1;
                        var cell = cells[j];

                        Position position = j == columnStartIndex ? Position.First : ((j == columnEndIndex) ? Position.Last : Position.Middle);
                        if (hasBackground)
                        {
                            cell.Background = backColor;
                        }

                        cell.Borders = GetCellBorders(borderThickness, borderBrush, position, cell.Borders, false, hasBackground);
                    }
                }
            }

            return(document);
        }
        /// <summary>
        /// method for pdf exporting
        /// </summary>
        /// <param name="grid"></param>
        /// <returns></returns>
        private RadDocument CreateDocument(RadGridView grid)
        {
            List <GridViewBoundColumnBase> columns = (from c in grid.Columns.OfType <GridViewBoundColumnBase>()
                                                      orderby c.DisplayIndex
                                                      select c).ToList();
            Table       table    = new Table();
            RadDocument document = new RadDocument();

            Telerik.Windows.Documents.Model.Section section = new Telerik.Windows.Documents.Model.Section();
            section.Blocks.Add(table);
            document.Sections.Add(section);

            if (grid.ShowColumnHeaders)
            {
                TableRow headerRow = new TableRow();
                if (grid.GroupDescriptors.Count() > 0)
                {
                    TableCell indentCell = new TableCell();
                    indentCell.PreferredWidth = new TableWidthUnit(grid.GroupDescriptors.Count() * 20);
                    indentCell.Background     = Colors.Gray;
                    headerRow.Cells.Add(indentCell);
                }

                for (int i = 0; i < columns.Count(); i++)
                {
                    TableCell cell = new TableCell();
                    cell.Background = Colors.White;
                    AddCellValue(cell, columns[i].Header.ToString());
                    cell.PreferredWidth = new TableWidthUnit((float)columns[i].ActualWidth);
                    headerRow.Cells.Add(cell);
                }

                table.Rows.Add(headerRow);
            }

            if (grid.Items.Groups != null)
            {
                for (int i = 0; i < grid.Items.Groups.Count(); i++)
                {
                    AddGroupRow(table, grid.Items.Groups[i] as QueryableCollectionViewGroup, columns, grid);
                }
            }
            else
            {
                AddDataRows(table, grid.Items, columns, grid);
            }

            if (grid.ShowColumnFooters)
            {
                TableRow footerRow = new TableRow();
                for (int i = 0; i < columns.Count(); i++)
                {
                    TableCell cell = new TableCell();
                    cell.Background = Colors.Gray;
                    string value = ((columns[i].Footer) as TextBlock) != null ? ((columns[i].Footer) as TextBlock).Text.ToString() : columns[i].Footer.ToString();
                    AddCellValue(cell, value != null ? value.ToString() : string.Empty);
                    cell.PreferredWidth = new TableWidthUnit((float)columns[i].ActualWidth);
                    footerRow.Cells.Add(cell);
                }
                table.Rows.Add(footerRow);
            }
            return(document);
        }
Example #6
0
        private RadDocument GenerateRadDocument()
        {
            var export = pivot.GenerateExport();
            int rowCount = export.RowCount;
            int columnCount = export.ColumnCount;

            RadDocument document = new RadDocument();
            document.SectionDefaultPageMargin = new Telerik.Windows.Documents.Layout.Padding(10);
            document.LayoutMode = DocumentLayoutMode.Paged;
            document.SectionDefaultPageOrientation = PageOrientation.Landscape;
            document.Style.SpanProperties.FontFamily = pivot.FontFamily;
            document.Style.SpanProperties.FontSize = pivot.FontSize;
            document.Style.ParagraphProperties.SpacingAfter = 0;

            var section = new Telerik.Windows.Documents.Model.Section();
            document.Sections.Add(section);
            section.Blocks.Add(new Telerik.Windows.Documents.Model.Paragraph());

            var table = new Telerik.Windows.Documents.Model.Table(rowCount, columnCount);
            section.Blocks.Add(table);

            var tableRows = table.Rows.ToArray();
            foreach (var cellInfo in export.Cells)
            {
                int rowStartIndex = cellInfo.Row;
                int rowEndIndex = rowStartIndex + cellInfo.RowSpan - 1;
                int columnStartIndex = cellInfo.Column;
                int columnEndIndex = columnStartIndex + cellInfo.ColumnSpan - 1;

                var value = cellInfo.Value;
                var text = Convert.ToString(value);
                if (!string.IsNullOrWhiteSpace(text))
                {
                    var cells = tableRows[rowStartIndex].Cells.ToArray();
                    var cell = cells[columnStartIndex];
                    Paragraph paragraph = new Paragraph();
                    cell.Blocks.Add(paragraph);
                    var span = new Span(text);
                    paragraph.Inlines.Add(span);
                    paragraph.TextAlignment = GetTextAlignment(cellInfo.TextAlignment);

                    if (cellInfo.FontWeight.HasValue)
                    {
                        span.FontWeight = cellInfo.FontWeight.Value;
                    }

                    Color foreColor;
                    if (GetColor(cellInfo.Foreground, out foreColor))
                    {
                        span.ForeColor = foreColor;
                    }

                    cell.VerticalAlignment = GetVerticalAlignment(cellInfo.VerticalAlignment);
                    paragraph.LeftIndent = cellInfo.Indent * 20;
                }

                var borderThickness = cellInfo.BorderThickness;
                var borderBrush = cellInfo.BorderBrush;
                var background = cellInfo.Background;

                Color backColor;
                bool hasBackground = GetColor(cellInfo.Background, out backColor);

                if (cellInfo.RowSpan > 1 && cellInfo.ColumnSpan > 1)
                {
                    for (int k = rowStartIndex; k <= rowEndIndex; k++)
                    {
                        var cells = tableRows[k].Cells.ToArray();
                        for (int j = columnStartIndex; j <= columnEndIndex; j++)
                        {
                            var cell = cells[j];
                            if (hasBackground)
                            {
                                cell.Background = backColor;
                            }

                            cell.Borders = GetCellBorders(borderThickness, borderBrush, cell.Borders, k, rowStartIndex, rowEndIndex, j, columnStartIndex, columnEndIndex, hasBackground);
                        }

                    }
                }
                else if (cellInfo.RowSpan > 1)
                {
                    for (int j = rowStartIndex; j <= rowEndIndex; j++)
                    {
                        // TODO: check when ColumnSpan > 1;
                        var cell = tableRows[j].Cells.ToArray()[columnStartIndex];

                        Position position = j == rowStartIndex ? Position.First : ((j == rowEndIndex) ? Position.Last : Position.Middle);

                        cell.Borders = GetCellBorders(borderThickness, borderBrush, position, cell.Borders, true, cellInfo.Background != null);
                        if (hasBackground)
                        {
                            cell.Background = backColor;
                        }
                    }
                }
                else if (cellInfo.ColumnSpan > 1)
                {
                    var cells = tableRows[rowStartIndex].Cells.ToArray();
                    for (int j = columnStartIndex; j <= columnEndIndex; j++)
                    {
                        // TODO: check when RowSpan > 1;
                        var cell = cells[j];

                        Position position = j == columnStartIndex ? Position.First : ((j == columnEndIndex) ? Position.Last : Position.Middle);
                        if (hasBackground)
                        {
                            cell.Background = backColor;
                        }

                        cell.Borders = GetCellBorders(borderThickness, borderBrush, position, cell.Borders, false, hasBackground);
                    }
                }
            }

            return document;
        }
Example #7
0
 private static void BuildDocument()
 {
     var section    = new Telerik.Windows.Documents.Model.Section();
     var paragraph  = new Telerik.Windows.Documents.Model.Paragraph();
     var paragraph1 = new Telerik.Windows.Documents.Model.Paragraph();
 }
        /// <summary>
        /// Updates the document.
        /// </summary>
        private void UpdateDocument()
        {
            //Only load the manifest when the viewer is open, it is not printing, and the details are loaded
            if (!VM.Routes.ManifestOpen || _currentlyPrinting || VM.Routes.SelectedEntity == null || !VM.Routes.SelectedEntity.ManifestDetailsLoaded)
                return;

            //If the manifest is currently updating retry in a second
            if (_updatingDocument)
            {
                if (_retry != null)
                    _retry.Dispose();

                _retry = Rxx3.RunDelayed(TimeSpan.FromSeconds(1), () => _updateManifest.OnNext(true));
            }

            //Disable printing and saving
            CanPrintOrSave = false;

            //Open busy indicator, used to add things to visual tree
            ManifestBusyIndicator.IsBusy = true;

            //Wait for the busy indicator to open
            Rxx3.RunDelayed(TimeSpan.FromMilliseconds(500), () =>
            {
                _updatingDocument = true;

                var document = new RadDocument { LayoutMode = DocumentLayoutMode.Paged };
                var mainSection = new Section { FooterBottomMargin = 0, HeaderTopMargin = 0, ActualPageMargin = new Padding(0, 20, 0, 20) };
                var bodyParagraph = new Paragraph();

                #region Add the Header

                if (Settings.IsHeaderVisible)
                {
                    //We only want the header to show up once, so just add it first to the body paragraph.
                    var manifestHeader = new ManifestHeader { Margin = new Thickness(0) };

                    bodyParagraph.Inlines.Add(ConvertToImageInline(manifestHeader));
                }

                #endregion

                #region Add the Summary

                if (Settings.IsSummaryVisible)
                {
                    //We only want the summary to show up once, so just add it first to the body paragraph.
                    var manifestSummary = new ManifestSummary { Margin = new Thickness(0, 0, 0, _summaryPadding) };

                    bodyParagraph.Inlines.Add(ConvertToImageInline(manifestSummary));
                }

                #endregion

                #region Add the Route Destinations

                foreach (var routeDestination in VM.Routes.SelectedEntity.RouteDestinationsListWrapper)
                {
                    var manifestRouteDestination = new ManifestRouteDestination { Margin = new Thickness(0, 6, 0, 6), RouteDestination = routeDestination };

                    bodyParagraph.Inlines.Add(ConvertToImageInline(manifestRouteDestination, () =>
                    {
                        //Force the manifestRouteDestination's itemscontrol to layout RouteTasks
                        manifestRouteDestination.UpdateLayout();
                        manifestRouteDestination.Measure(new Size(double.MaxValue, double.MaxValue));

                        //Force the FieldsControl's ItemsControls to layout fields
                        foreach (var manifestFieldsControl in manifestRouteDestination.GetDescendants<ManifestFields>())
                        {
                            var routeTask = manifestFieldsControl.DataContext as RouteTask;

                            if (routeTask == null || routeTask.ServiceHolder == null
                                || routeTask.ServiceHolder.Service == null)
                                continue;

                            var serviceTemplate = routeTask.ServiceHolder.Service.ServiceTemplate;

                            manifestFieldsControl.ServiceTemplate = serviceTemplate;
                            manifestFieldsControl.UpdateLayout();
                            manifestFieldsControl.Measure(new Size(double.MaxValue, double.MaxValue));
                        }

                        manifestRouteDestination.Measure(new Size(double.MaxValue, double.MaxValue));
                    }));
                }

                #endregion

                if (Settings.IsFooterVisible)
                    mainSection.Footers.Default = GetFooterDocument();

                ////Setup the main section
                mainSection.Blocks.Add(bodyParagraph);

                //Setup the Document
                document.Sections.Add(mainSection);
                ManifestRichTextBox.Document = document;
                ManifestRichTextBox.IsSpellCheckingEnabled = false;
                ManifestRichTextBox.Width = 870;

                //Close busy indicator
                ManifestBusyIndicator.IsBusy = false;

                //Allow printing and saving
                CanPrintOrSave = true;

                _updatingDocument = false;
            });
        }
        /// <summary>
        /// Sets up the Footer
        /// </summary>
        private Footer GetFooterDocument()
        {
            var footer = new Footer();
            var footerDoc = new RadDocument();
            var footerSection = new Section();
            footerDoc.Sections.Add(footerSection);
            var cell1Paragraph = new Paragraph();
            var cell2Paragraph = new Paragraph();
            var cell3Paragraph = new Paragraph();

            var cell1Span = new Span("Generated By FoundOPS.")
            {
                FontSize = 10,
                FontFamily = new FontFamily("Century Gothic")
            };

            cell1Paragraph.Inlines.Add(cell1Span);
            var table = new Table { Borders = new TableBorders(new Border(BorderStyle.None)) };
            var row1 = new TableRow();
            var cell1 = new TableCell { Padding = new Padding(35, 0, 0, 0) };
            cell1.Blocks.Add(cell1Paragraph);

            var cell2Span = new Span
            {
                Text =
                    " ",
                FontSize = 10,
                FontFamily = new FontFamily("Century Gothic")
            };
            cell2Paragraph.Inlines.Add(cell2Span);
            var cell2 = new TableCell();
            cell2.Blocks.Add(cell2Paragraph);
            cell2.TextAlignment = RadTextAlignment.Center;

            var cell3Span = new Span
            {
                Text =
                    Settings.IsCustomMessageVisible
                        ? VM.RouteManifest.RouteManifestSettings.CustomMessage
                        : " ",
                FontSize = 10,
                FontFamily = new FontFamily("Century Gothic")
            };

            cell3Paragraph.Inlines.Add(cell3Span);
            var cell3 = new TableCell { Padding = new Padding(0, 0, 35, 0) };
            cell3.Blocks.Add(cell3Paragraph);
            cell3.TextAlignment = RadTextAlignment.Right;

            row1.Cells.Add(cell1);
            row1.Cells.Add(cell2);
            row1.Cells.Add(cell3);

            table.Rows.Add(row1);

            footerSection.Blocks.Add(table);

            footer.Body = footerDoc;

            return footer;
        }