Ejemplo n.º 1
0
        void DefineStyles(Document document, string fontName, Color fontColor, Color fontColor2, Color borderColor)
        {
            Unit unit = 7;
            string margin = (PageWidth / 2).ToString() + "cm";

            Border border = new Border();
            border.Width = 1;
            border.Color = borderColor;

            Style style = document.Styles["Normal"];
            style.Font.Name = fontName;
            style.Font.Size = 12;
            style.ParagraphFormat.SpaceBefore = unit;
            style.ParagraphFormat.SpaceAfter = unit;

            style = document.Styles["Heading1"];
            style.Font.Name = fontName;
            style.Font.Size = 20;
            style.Font.Bold = true;
            style.Font.Color = fontColor;
            style.ParagraphFormat.PageBreakBefore = false;
            style.ParagraphFormat.SpaceBefore = unit;
            style.ParagraphFormat.SpaceAfter = unit;
            style.ParagraphFormat.Borders.Bottom = border;
            style.ParagraphFormat.Alignment = ParagraphAlignment.Right;

            style = document.Styles["Heading2"];
            style.Font.Name = fontName;
            style.Font.Size = 15;
            style.Font.Bold = true;
            style.Font.Color = fontColor2;
            style.ParagraphFormat.PageBreakBefore = false;
            style.ParagraphFormat.SpaceBefore = unit;
            style.ParagraphFormat.SpaceAfter = unit;
            style.ParagraphFormat.Borders.Bottom.Visible = false;
            style.ParagraphFormat.Alignment = ParagraphAlignment.Left;
            style.ParagraphFormat.Shading.Color = fontColor;

            style = document.Styles["Heading3"];
            style.Font.Name = fontName;
            style.Font.Size = 12;
            style.Font.Bold = true;
            style.Font.Color = fontColor;
            style.ParagraphFormat.PageBreakBefore = false;
            style.ParagraphFormat.SpaceBefore = unit;
            style.ParagraphFormat.SpaceAfter = unit;
            style.ParagraphFormat.Borders.Bottom.Visible = false;
            style.ParagraphFormat.Shading.Color = Colors.Transparent;

            style = document.Styles[StyleNames.Header];
            style.ParagraphFormat.AddTabStop(margin, TabAlignment.Center);

            style = document.Styles[StyleNames.Footer];
            style.ParagraphFormat.AddTabStop(margin, TabAlignment.Center);

            style = document.Styles.AddStyle("TOC", "Normal");
            style.ParagraphFormat.AddTabStop(PageWidth.ToString() + "cm", TabAlignment.Right, TabLeader.Dots);
            style.ParagraphFormat.Font.Name = fontName;
            style.ParagraphFormat.Font.Color = fontColor;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add MigraDoc styles.
        /// </summary>
        /// <param name="doc">The document to add the styles to.</param>
        private static void AddStylesToDoc(MigraDoc.DocumentObjectModel.Document doc)
        {
            var body = doc.Styles["Normal"];

            body.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(10);

            if (doc.Styles["TableText"] == null)
            {
                var tableTextStyle = doc.AddStyle("TableText", "Normal");
                // tableTextStyle.ParagraphFormat.LineSpacing = 0;
                tableTextStyle.ParagraphFormat.SpaceAfter = 5;
            }

            body.ParagraphFormat.LineSpacingRule = MigraDoc.DocumentObjectModel.LineSpacingRule.Multiple;
            body.ParagraphFormat.LineSpacing     = 1.0;
            body.ParagraphFormat.SpaceAfter      = 10;

            var footer = doc.Styles["Footer"];

            footer.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(9);

            var h1 = doc.Styles["Heading1"];

            h1.Font.Bold = true;
            h1.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(15);
            h1.ParagraphFormat.SpaceBefore = 0;

            var h2 = doc.Styles["Heading2"];

            h2.Font.Bold = true;
            h2.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(13);
            h2.ParagraphFormat.SpaceBefore = 0;

            var h3 = doc.Styles["Heading3"];

            h3.Font.Bold = true;
            h3.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(11);
            h3.ParagraphFormat.SpaceBefore = 0;

            var h4 = doc.Styles["Heading4"];

            h4.Font.Bold = true;
            h4.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(10);
            h4.ParagraphFormat.SpaceBefore = 0;

            var h5 = doc.Styles["Heading5"];

            h5.Font.Bold = true;
            h5.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(9);
            h5.ParagraphFormat.SpaceBefore = 0;

            var h6 = doc.Styles["Heading6"];

            h6.Font.Bold = true;
            h6.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(9);
            h6.ParagraphFormat.SpaceBefore = 0;


            var links = doc.Styles["Hyperlink"];

            links.Font.Color = MigraDoc.DocumentObjectModel.Colors.Blue;

            if (doc.Styles["ListEnd"] == null)
            {
                var unorderedlist = doc.AddStyle("ListStart", "Normal");
                unorderedlist.ParagraphFormat.SpaceAfter = 0;
            }

            if (doc.Styles["UnorderedList"] == null)
            {
                var unorderedlist = doc.AddStyle("UnorderedList", "Normal");
                var listInfo      = new MigraDoc.DocumentObjectModel.ListInfo();
                listInfo.ListType = MigraDoc.DocumentObjectModel.ListType.BulletList1;
                unorderedlist.ParagraphFormat.ListInfo        = listInfo;
                unorderedlist.ParagraphFormat.LeftIndent      = "1cm";
                unorderedlist.ParagraphFormat.FirstLineIndent = "-0.5cm";
                unorderedlist.ParagraphFormat.SpaceAfter      = 0;
            }

            if (doc.Styles["OrderedList"] == null)
            {
                var orderedlist = doc.AddStyle("OrderedList", "UnorderedList");
                orderedlist.ParagraphFormat.ListInfo.ListType = MigraDoc.DocumentObjectModel.ListType.NumberList1;
                orderedlist.ParagraphFormat.LeftIndent        = "1cm";
                orderedlist.ParagraphFormat.FirstLineIndent   = "-0.5cm";
                orderedlist.ParagraphFormat.SpaceAfter        = 0;
            }

            if (doc.Styles["ListEnd"] == null)
            {
                var unorderedlist = doc.AddStyle("ListEnd", "Normal");
                unorderedlist.ParagraphFormat.SpaceAfter = 0;
            }

            if (doc.Styles["HorizontalRule"] == null)
            {
                var hr       = doc.AddStyle("HorizontalRule", "Normal");
                var hrBorder = new MigraDoc.DocumentObjectModel.Border();
                hrBorder.Width = "1pt";
                hrBorder.Color = MigraDoc.DocumentObjectModel.Colors.DarkGray;
                hr.ParagraphFormat.Borders.Bottom = hrBorder;
                hr.ParagraphFormat.LineSpacing    = 0;
                hr.ParagraphFormat.SpaceBefore    = 15;
            }
            if (doc.Styles["TableParagraph"] == null)
            {
                var style = doc.Styles.AddStyle("TableParagraph", "Normal");
                style.Font.Size = 8;
                style.ParagraphFormat.SpaceAfter = Unit.FromCentimeter(0);
                style.Font = new MigraDoc.DocumentObjectModel.Font("Courier New");
            }
        }
Ejemplo n.º 3
0
 BorderRenderer CreateBorderRenderer(Border border, BorderType borderType)
 {
   BorderRenderer brdrRndrr = new BorderRenderer(border, this.docRenderer);
   brdrRndrr.ParentCell = this.parentCell;
   brdrRndrr.ParentFormat = this.parentFormat;
   brdrRndrr.BorderType = borderType;
   return brdrRndrr;
 }
Ejemplo n.º 4
0
 public BorderRenderer(DocumentObject domObj, RtfDocumentRenderer docRenderer)
     : base(domObj, docRenderer)
 {
     this.border = domObj as Border;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Erstellt aus einer DataTable eine Micradoc Tabelle
        /// </summary>
        /// <param name="dt">DataTable</param>
        /// <param name="columnWidths">Spaltenbreite</param>
        /// <param name="shadedColumns">Spalten mit Schattierung</param>
        /// <param name="stretchToPageWidth">Gibt an ob die Tabelle auf das gesamte Blatt gestretcht werden soll</param>
        /// <returns>Micradoc Tabelle</returns>
        protected Table GetTableFromDataTable(DataTable dt, List<int> columnWidths, List<int> shadedColumns, bool stretchToPageWidth)
        {
            Table table = new Table();
            if (columnWidths != null)
            {
                foreach (int width in columnWidths)
                {
                    table.AddColumn(new Unit((double)width, UnitType.Millimeter));
                }
            }

            while (dt.Columns.Count > table.Columns.Count)
            {
                table.AddColumn();
            }

            if (stretchToPageWidth)
            {
                double pageWidth = this.Document.LastSection.PageSetup.PageWidth.Millimeter - this.Document.LastSection.PageSetup.LeftMargin.Millimeter - this.Document.LastSection.PageSetup.RightMargin.Millimeter;
                double columnWidthSum = 0;
                foreach (Column column in table.Columns)
                {
                    columnWidthSum += column.Width.Millimeter;
                }

                foreach (Column column in table.Columns)
                {
                    column.Width = new Unit(column.Width.Millimeter * pageWidth / columnWidthSum, UnitType.Millimeter);

                    if (!IsInvoice)
                    {
                        Border bor = new Border();
                        bor.Style = BorderStyle.Single;

                        column.Borders.Left = bor;

                        bor = new Border();
                        bor.Style = BorderStyle.Single;
                        column.Borders.Right = bor;
                    }
                }
            }

            var headerRow = table.AddRow();
            headerRow.HeadingFormat = true;
            headerRow.Format.Font.Bold = true;
            int i = 0;
            foreach (DataColumn dc in dt.Columns)
            {
                headerRow[i].AddParagraph(dc.ColumnName);
                headerRow[i].Shading.Color = this.TableShadingColor;
                i++;
            }

            foreach (DataRow dr in dt.Rows)
            {
                var row = table.AddRow(dr.ItemArray);
                row.Height = new Unit((IsInvoice)?0.5:0.8, UnitType.Centimeter);
                if (!IsInvoice)
                {
                    Border bor = new Border();
                    bor.Style = BorderStyle.Single;
                    row.Borders.Left = bor;
                    bor = new Border();
                    bor.Style = BorderStyle.Single;
                    row.Borders.Right = bor;

                    bor = new Border();
                    bor.Style = BorderStyle.Single;
                    row.Borders.Bottom = bor;
                }
                foreach (int sc in shadedColumns)
                {
                    row[sc].Shading.Color = this.TableShadingColor;
                }
            }

            table.SetEdge(0, 0, table.Columns.Count, 1, Edge.Box, BorderStyle.Single, new Unit(1, UnitType.Point));
            table.SetEdge(0, 1, table.Columns.Count, table.Rows.Count - 1, Edge.Box, BorderStyle.Single, new Unit(1, UnitType.Point));
            return table;
        }
Ejemplo n.º 6
0
        private void StyleDoc(Document doc)
        {
            Color green = new Color(108, 179, 63),
                  brown = new Color(88, 71, 76),
                  lightbrown = new Color(150, 132, 126);

            var body = doc.Styles["Normal"];

            body.Font.Size = Unit.FromInch(0.14);
            body.Font.Color = new Color(51, 51, 51);

            body.ParagraphFormat.LineSpacingRule = LineSpacingRule.Multiple;
            body.ParagraphFormat.LineSpacing = 1.25;
            body.ParagraphFormat.SpaceAfter = 10;

            var footer = doc.Styles["Footer"];
            footer.Font.Size = Unit.FromInch(0.125);
            footer.Font.Color = green;

            var h1 = doc.Styles["Heading1"];
            h1.Font.Color = green;
            h1.Font.Bold = true;
            h1.Font.Size = Unit.FromPoint(15);

            var h2 = doc.Styles["Heading2"];
            h2.Font.Color = green;
            h2.Font.Bold = true;
            h2.Font.Size = Unit.FromPoint(13);

            var h3 = doc.Styles["Heading3"];
            h3.Font.Bold = true;
            h3.Font.Color = Colors.Black;
            h3.Font.Size = Unit.FromPoint(11);

            var links = doc.Styles["Hyperlink"];
            links.Font.Color = green;

            var unorderedlist = doc.AddStyle("UnorderedList", "Normal");
            var listInfo = new ListInfo();
            listInfo.ListType = ListType.BulletList1;
            unorderedlist.ParagraphFormat.ListInfo = listInfo;
            unorderedlist.ParagraphFormat.LeftIndent = "1cm";
            unorderedlist.ParagraphFormat.FirstLineIndent = "-0.5cm";
            unorderedlist.ParagraphFormat.SpaceAfter = 0;

            var orderedlist = doc.AddStyle("OrderedList", "UnorderedList");
            orderedlist.ParagraphFormat.ListInfo.ListType = ListType.NumberList1;

            // for list spacing (since MigraDoc doesn't provide a list object that we can target)
            var listStart = doc.AddStyle("ListStart", "Normal");
            listStart.ParagraphFormat.SpaceAfter = 0;
            listStart.ParagraphFormat.LineSpacing = 0.5;
            var listEnd = doc.AddStyle("ListEnd", "ListStart");
            listEnd.ParagraphFormat.LineSpacing = 1;

            var hr = doc.AddStyle("HorizontalRule", "Normal");
            var hrBorder = new Border();
            hrBorder.Width = "1pt";
            hrBorder.Color = Colors.DarkGray;
            hr.ParagraphFormat.Borders.Bottom = hrBorder;
            hr.ParagraphFormat.LineSpacing = 0;
            hr.ParagraphFormat.SpaceBefore = 15;
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Gets a name of a border.
 /// </summary>
 internal string GetMyName(Border border)
 {
   if (border == this.top)
     return "Top";
   else if (border == this.bottom)
     return "Bottom";
   else if (border == this.left)
     return "Left";
   else if (border == this.right)
     return "Right";
   else if (border == this.diagonalUp)
     return "DiagonalUp";
   else if (border == this.diagonalDown)
     return "DiagonalDown";
   return null;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Converts Border into DDL.
        /// </summary>
        internal void Serialize(Serializer serializer, string name, Border refBorder)
        {
            if (_fClear.Value)
                serializer.WriteLine(name + " = null");

            int pos = serializer.BeginContent(name);

            if (!_visible.IsNull && (refBorder == null || (Visible != refBorder.Visible)))
                serializer.WriteSimpleAttribute("Visible", Visible);

            if (!_style.IsNull && (refBorder == null || (Style != refBorder.Style)))
                serializer.WriteSimpleAttribute("Style", Style);

            if (!_width.IsNull && (refBorder == null || (Width != refBorder.Width)))
                serializer.WriteSimpleAttribute("Width", Width);

            if (!_color.IsNull && (refBorder == null || (Color != refBorder.Color)))
                serializer.WriteSimpleAttribute("Color", Color);

            serializer.EndContent(pos);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Add MigraDoc styles.
        /// </summary>
        /// <param name="doc">The document to add the styles to.</param>
        private static void AddStylesToDoc(MigraDoc.DocumentObjectModel.Document doc)
        {
            var body = doc.Styles["Normal"];
            body.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(10);

            if (doc.Styles["TableText"] == null)
            {
                var tableTextStyle = doc.AddStyle("TableText", "Normal");
                //tableTextStyle.ParagraphFormat.LineSpacing = 0;
                tableTextStyle.ParagraphFormat.SpaceAfter = 5;
            }

            body.ParagraphFormat.LineSpacingRule = MigraDoc.DocumentObjectModel.LineSpacingRule.Multiple;
            body.ParagraphFormat.LineSpacing = 1.0;
            body.ParagraphFormat.SpaceAfter = 10;

            var footer = doc.Styles["Footer"];
            footer.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(9);

            var h1 = doc.Styles["Heading1"];
            h1.Font.Bold = true;
            h1.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(15);
            h1.ParagraphFormat.SpaceBefore = 0;

            var h2 = doc.Styles["Heading2"];
            h2.Font.Bold = true;
            h2.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(13);
            h2.ParagraphFormat.SpaceBefore = 0;

            var h3 = doc.Styles["Heading3"];
            h3.Font.Bold = true;
            h3.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(11);
            h3.ParagraphFormat.SpaceBefore = 0;

            var h4 = doc.Styles["Heading4"];
            h4.Font.Bold = true;
            h4.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(10);
            h4.ParagraphFormat.SpaceBefore = 0;

            var h5 = doc.Styles["Heading5"];
            h5.Font.Bold = true;
            h5.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(9);
            h5.ParagraphFormat.SpaceBefore = 0;

            var h6 = doc.Styles["Heading6"];
            h6.Font.Bold = true;
            h6.Font.Size = MigraDoc.DocumentObjectModel.Unit.FromPoint(9);
            h6.ParagraphFormat.SpaceBefore = 0;

            var links = doc.Styles["Hyperlink"];
            links.Font.Color = MigraDoc.DocumentObjectModel.Colors.Blue;

            if (doc.Styles["ListEnd"] == null)
            {
                var unorderedlist = doc.AddStyle("ListStart", "Normal");
                unorderedlist.ParagraphFormat.SpaceAfter = 0;
            }

            if (doc.Styles["UnorderedList"] == null)
            {
                var unorderedlist = doc.AddStyle("UnorderedList", "Normal");
                var listInfo = new MigraDoc.DocumentObjectModel.ListInfo();
                listInfo.ListType = MigraDoc.DocumentObjectModel.ListType.BulletList1;
                unorderedlist.ParagraphFormat.ListInfo = listInfo;
                unorderedlist.ParagraphFormat.LeftIndent = "1cm";
                unorderedlist.ParagraphFormat.FirstLineIndent = "-0.5cm";
                unorderedlist.ParagraphFormat.SpaceAfter = 0;
            }

            if (doc.Styles["OrderedList"] == null)
            {
                var orderedlist = doc.AddStyle("OrderedList", "UnorderedList");
                orderedlist.ParagraphFormat.ListInfo.ListType = MigraDoc.DocumentObjectModel.ListType.NumberList1;
                orderedlist.ParagraphFormat.LeftIndent = "1cm";
                orderedlist.ParagraphFormat.FirstLineIndent = "-0.5cm";
                orderedlist.ParagraphFormat.SpaceAfter = 0;
            }

            if (doc.Styles["ListEnd"] == null)
            {
                var unorderedlist = doc.AddStyle("ListEnd", "Normal");
                unorderedlist.ParagraphFormat.SpaceAfter = 0;
            }

            if (doc.Styles["HorizontalRule"] == null)
            {
                var hr = doc.AddStyle("HorizontalRule", "Normal");
                var hrBorder = new MigraDoc.DocumentObjectModel.Border();
                hrBorder.Width = "1pt";
                hrBorder.Color = MigraDoc.DocumentObjectModel.Colors.DarkGray;
                hr.ParagraphFormat.Borders.Bottom = hrBorder;
                hr.ParagraphFormat.LineSpacing = 0;
                hr.ParagraphFormat.SpaceBefore = 15;
            }
            if (doc.Styles["TableParagraph"] == null)
            {
                var style = doc.Styles.AddStyle("TableParagraph", "Normal");
                style.Font.Size = 8;
                style.ParagraphFormat.SpaceAfter = Unit.FromCentimeter(0);
                style.Font = new MigraDoc.DocumentObjectModel.Font("Courier New");
            }
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Gets a name of a border.
 /// </summary>
 internal string GetMyName(Border border)
 {
     if (border == _top)
         return "Top";
     if (border == _bottom)
         return "Bottom";
     if (border == _left)
         return "Left";
     if (border == _right)
         return "Right";
     if (border == _diagonalUp)
         return "DiagonalUp";
     if (border == _diagonalDown)
         return "DiagonalDown";
     return null;
 }
        private void CreateArticleListForDocket(Section section, Order.Order order)
        {
            // Create the article table
            var table = section.AddTable();
            table.Style = "Table";
            table.Borders.Color = TableBorder;
            table.Borders.Width = 0.25;
            table.Borders.Left.Width = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent = 0;

            // Article list columns
            foreach (var ArticleColumn in ParentViewModel.SettingsController.ArticleListColumnsDeliveryNote)
            {
                var column = table.AddColumn(Unit.FromCentimeter(ArticleColumn.ColumnWidth));
                column.Format.Alignment = ArticleColumn.Alignment;
            }

            if (ParentViewModel.SettingsController.ArticleListColumnsDeliveryNote.Count < 2)
            {
                Biller.UI.ViewModel.MainWindowViewModel.GetCurrentMainWindowViewModel().NotificationManager.ShowNotification("Zu wenig Artikelspalten", "Es werden mindestens zwei Artikelspalten benötigt!");
                return;
            }
            var row = table.AddRow();
            row.HeadingFormat = true;
            row.Format.SpaceBefore = "0,1cm";
            row.Format.SpaceAfter = "0,25cm";

            var index = 0;
            foreach (var ArticleColumn in ParentViewModel.SettingsController.ArticleListColumnsDeliveryNote)
            {
                row.Cells[index].AddParagraph(ArticleColumn.Header);
                index += 1;
            }

            logger.Trace("FillContent - AddArticle " + order.DocumentType + ":" + order.DocumentID);

            foreach (var article in order.OrderedArticles)
            {
                logger.Trace("AddArticle - " + article.ArticleID);

                Row row1 = table.AddRow();
                index = 0;
                foreach (var ArticleColumn in ParentViewModel.SettingsController.ArticleListColumnsDeliveryNote)
                {
                    row1.Cells[index].AddParagraph(ReplaceArticlePlaceHolder(ArticleColumn.Content, article));
                    index += 1;
                }

                row1.Format.SpaceBefore = "0,1cm";
                row1.Format.SpaceAfter = "0,4cm";
            }

            logger.Trace("Setting Borders");
            Border BlackThickBorder = new Border();
            BlackThickBorder.Visible = true;
            BlackThickBorder.Color = Colors.Black;
            BlackThickBorder.Width = 1.5;

            var lastcolumn = ParentViewModel.SettingsController.ArticleListColumnsDeliveryNote.Count - 1;

            logger.Trace("Adding total weight");
            row = table.AddRow();
            row.Cells[0].Borders.Bottom = BlackThickBorder.Clone();
            row.Cells[0].AddParagraph("Gesamtgewicht");
            row.Cells[0].Format.Font.Bold = true;
            row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
            row.Cells[0].MergeRight = lastcolumn - 1;
            row.Cells[lastcolumn].AddParagraph(kgUnit.ValueToString(order.OrderCalculation.OrderedWeight));
            row.Cells[lastcolumn].Borders.Bottom = BlackThickBorder.Clone();
            row.Format.SpaceBefore = "0,25cm";
            row.Format.SpaceAfter = "0,05cm";
        }
        private void CreateArticleListForInvoice(Section section, Order.Order order)
        {
            // Create the article table
            var table = section.AddTable();
            table.Style = "Table";
            table.Borders.Color = TableBorder;
            table.Borders.Width = 0.25;
            table.Borders.Left.Width = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent = 0;

            // Article list columns
            foreach (var ArticleColumn in ParentViewModel.SettingsController.ArticleListColumns)
            {
                var column = table.AddColumn(Unit.FromCentimeter(ArticleColumn.ColumnWidth));
                column.Format.Alignment = ArticleColumn.Alignment;
            }


            if (ParentViewModel.SettingsController.ArticleListColumns.Count < 2)
            {
                Biller.UI.ViewModel.MainWindowViewModel.GetCurrentMainWindowViewModel().NotificationManager.ShowNotification("Zu wenig Artikelspalten", "Es werden mindestens zwei Artikelspalten benötigt!");
                return;
            }
            var row = table.AddRow();
            row.HeadingFormat = true;
            row.Format.SpaceBefore = "0,1cm";
            row.Format.SpaceAfter = "0,25cm";

            var index = 0;
            foreach (var ArticleColumn in ParentViewModel.SettingsController.ArticleListColumns)
            {
                row.Cells[index].AddParagraph(ArticleColumn.Header);
                index += 1;
            }

            logger.Trace("FillContent - AddArticle " + order.DocumentType + ":" + order.DocumentID);

            foreach (var article in order.OrderedArticles)
            {
                logger.Trace("AddArticle - " + article.ArticleID);

                Row row1 = table.AddRow();
                index = 0;
                foreach (var ArticleColumn in ParentViewModel.SettingsController.ArticleListColumns)
                {
                    row1.Cells[index].AddParagraph(ReplaceArticlePlaceHolder(ArticleColumn.Content, article));
                    index += 1;
                }

                row1.Format.SpaceBefore = "0,1cm";
                row1.Format.SpaceAfter = "0,4cm";
            }

            logger.Trace("Setting Borders");
            Border BlackBorder = new Border();
            BlackBorder.Visible = true;
            BlackBorder.Color = Colors.Black;
            BlackBorder.Width = 0.75;

            Border BlackThickBorder = new Border();
            BlackThickBorder.Visible = true;
            BlackThickBorder.Color = Colors.Black;
            BlackThickBorder.Width = 1.5;

            Border NoBorder = new Border();
            NoBorder.Visible = false;

            logger.Trace("Adding subtotal net");
            var lastcolumn = ParentViewModel.SettingsController.ArticleListColumns.Count - 1;

            dynamic sb = Biller.UI.ViewModel.MainWindowViewModel.GetCurrentMainWindowViewModel().SettingsTabViewModel.KeyValueStore;
            if (sb.IsSmallBusiness == null)
                sb.IsSmallBusiness = false;

            if (sb.IsSmallBusiness)
            {
                // Add the total price row
                row = table.AddRow();
                row.Format.PageBreakBefore = true;
                row.Cells[0].AddParagraph("Zwischensumme");
                row.Cells[0].Format.Font.Bold = true;
                row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                row.Cells[0].MergeRight = lastcolumn - 1;
                row.Cells[lastcolumn].AddParagraph(order.OrderCalculation.ArticleSummary.AmountString);
                row.Format.SpaceBefore = "0,1cm";
                row.Cells[0].Borders.Bottom = NoBorder.Clone();
                row.Cells[lastcolumn].Borders.Bottom = NoBorder.Clone();
                row.Cells[0].Borders.Top = NoBorder.Clone();
                row.Cells[lastcolumn].Borders.Top = NoBorder.Clone();
            }
            else
            {
                // Add the total price row
                row = table.AddRow();
                row.Format.PageBreakBefore = true;
                row.Cells[0].AddParagraph("Zwischensumme Netto");
                row.Cells[0].Format.Font.Bold = true;
                row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                row.Cells[0].MergeRight = lastcolumn - 1;
                row.Cells[lastcolumn].AddParagraph(order.OrderCalculation.NetArticleSummary.AmountString);
                row.Format.SpaceBefore = "0,1cm";
                row.Cells[0].Borders.Bottom = NoBorder.Clone();
                row.Cells[lastcolumn].Borders.Bottom = NoBorder.Clone();
                row.Cells[0].Borders.Top = NoBorder.Clone();
                row.Cells[lastcolumn].Borders.Top = NoBorder.Clone();
            }

            if (order.OrderCalculation.OrderRebate.Amount > 0)
            {
                logger.Trace("Adding OrderRebate");
                row = table.AddRow();
                row.Cells[0].AddParagraph("Abzgl. " + order.OrderRebate.PercentageString + " Gesamtrabatt");
                row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                row.Cells[0].MergeRight = lastcolumn - 1;
                if (sb.IsSmallBusiness)
                    row.Cells[lastcolumn].AddParagraph(order.OrderCalculation.OrderRebate.AmountString);
                else
                    row.Cells[lastcolumn].AddParagraph(order.OrderCalculation.NetOrderRebate.AmountString);
                row.Format.SpaceBefore = "0,1cm";
                row.Cells[0].Borders.Bottom = NoBorder.Clone();
                row.Cells[lastcolumn].Borders.Bottom = NoBorder.Clone();
                row.Cells[0].Borders.Top = NoBorder.Clone();
                row.Cells[lastcolumn].Borders.Top = NoBorder.Clone();
            }

            if (!String.IsNullOrEmpty(order.OrderShipment.Name))
            {
                logger.Trace("Adding Shipment");
                row = table.AddRow();
                row.Cells[0].AddParagraph("Zzgl. " + order.OrderShipment.Name);
                row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                row.Cells[0].MergeRight = lastcolumn - 1;
                row.Cells[lastcolumn].AddParagraph(order.OrderCalculation.NetShipment.AmountString);
                row.Format.SpaceBefore = "0,1cm";
                row.Cells[0].Borders.Bottom = BlackBorder.Clone();
                row.Cells[lastcolumn].Borders.Bottom = BlackBorder.Clone();
                row.Cells[0].Borders.Top = NoBorder.Clone();
                row.Cells[lastcolumn].Borders.Top = NoBorder.Clone();
            }

            if (!sb.IsSmallBusiness)
            {
                if (order.OrderCalculation.OrderRebate.Amount > 0 || !String.IsNullOrEmpty(order.OrderShipment.Name))
                {
                    logger.Trace("Adding Subtotal");
                    row = table.AddRow();
                    row.Cells[0].AddParagraph("Zwischensumme Netto");
                    row.Cells[0].Format.Font.Bold = true;
                    row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                    row.Cells[0].MergeRight = lastcolumn - 1;
                    row.Cells[lastcolumn].AddParagraph(order.OrderCalculation.NetOrderSummary.AmountString);
                    row.Format.SpaceBefore = "0,1cm";
                    row.Cells[0].Borders.Bottom = NoBorder.Clone();
                    row.Cells[lastcolumn].Borders.Bottom = NoBorder.Clone();
                    row.Cells[0].Borders.Top = BlackBorder.Clone();
                    row.Cells[lastcolumn].Borders.Top = BlackBorder.Clone();
                }

                // Add the VAT row
                foreach (var tax in order.OrderCalculation.TaxValues)
                {
                    logger.Trace("Adding Tax - " + tax.TaxClass.Name);
                    row = table.AddRow();
                    row.Cells[0].AddParagraph("Zzgl. " + tax.TaxClass.Name + " " + tax.TaxClassAddition);
                    row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                    row.Cells[0].MergeRight = lastcolumn - 1;
                    row.Cells[lastcolumn].AddParagraph(tax.Value.AmountString);
                    row.Cells[0].Borders.Bottom = NoBorder.Clone();
                    row.Cells[lastcolumn].Borders.Bottom = NoBorder.Clone();
                    row.Cells[0].Borders.Top = NoBorder.Clone();
                    row.Cells[lastcolumn].Borders.Top = NoBorder.Clone();
                }
            }

            logger.Trace("Adding subtotal gross");
            row = table.AddRow();
            row.Cells[0].Borders.Bottom = BlackThickBorder.Clone();
            row.Cells[0].AddParagraph("Gesamtbetrag");
            row.Cells[0].Format.Font.Bold = true;
            row.Cells[0].Format.Alignment = ParagraphAlignment.Right;
            row.Cells[0].MergeRight = lastcolumn - 1;
            row.Cells[lastcolumn].AddParagraph(order.OrderCalculation.OrderSummary.AmountString);
            row.Cells[lastcolumn].Borders.Bottom = BlackThickBorder.Clone();
            row.Format.SpaceBefore = "0,25cm";
            row.Format.SpaceAfter = "0,05cm";
        }