Example #1
0
        public static void FillDocument(IDocument document,
                                        Action <object> log)
        {
            var data = new Data
            {
                CashBookLines = new[]
                {
                    new CashBookLine
                    {
                        Date                  = new DateTime(2017, 1, 1),
                        ContractorName        = "some name",
                        BeginOfTheDaySum      = "123",
                        CorrespondingAccount  = "asdf",
                        DayTotalExpense       = "123",
                        DayTotalIncome        = "123",
                        DocumentNumber        = "2",
                        EndOfTheDaySum        = "234",
                        Expense               = "23",
                        ExpenseDocumentsCount = "2",
                        Income                = "23",
                        IncomeDocumentsCount  = "4",
                        PageNumber            = "2",
                        SalaryPart            = "32"
                    }
                }
            };
            var linesGroupedByPages = data.CashBookLines
                                      .GroupBy(x => x.PageNumber)
                                      .OrderBy(x => int.Parse(x.Key));

            foreach (var pageLines in linesGroupedByPages)
            {
                document.AddPage(GetCashBookPage(pageLines.Key, pageLines.ToArray()));
            }
        }
Example #2
0
        /// <summary>
        /// Duplicate page,folder or Branch
        /// </summary>
        /// <param name="bBranch">Is duplicate branch or node only</param>
        /// <returns></returns>
        public INodeViewModel Duplicate(bool bBranch = true)
        {
            if (_document == null)
            {
                return(null);
            }

            string    nodename = GetCopyeName(this.Name);
            ITreeNode treeNode = _treeNodeObject.InsertSiblingAfter(NodeType);

            if (this.NodeType == TreeNodeType.Page)
            {
                IDocumentPage sourcePage = this.TreeNodeObject.AttachedObject;
                IDocumentPage newPage    = _document.DuplicatePage(sourcePage.Guid);
                treeNode.AttachedObject = newPage;
                _document.AddPage(newPage);

                //open this page
                if (_ListEventAggregator != null)
                {
                    _ListEventAggregator.GetEvent <OpenNormalPageEvent>().Publish(newPage.Guid);
                }
            }
            else
            {
                treeNode.Name = nodename;
            }
            var idx = IndexInParent;

            NodeViewModel newNode = new NodeViewModel(_document, _undoManager, treeNode, Parent);

            newNode.IsExpanded     = true;
            newNode.IsNodeEditable = true;
            newNode.IsSelected     = true;
            Parent.Children.Insert(++idx, newNode);

            //clone child node page
            if (bBranch)
            {
                foreach (var item in Children)
                {
                    item.DuplicateChild(newNode);
                }
            }
            return(newNode);
        }
Example #3
0
 private static void FillDocument(IDocument document,
                                  Data[] cashOrders)
 {
     foreach (var cashOrderInfo in cashOrders)
     {
         var page = GetPage(cashOrderInfo);
         document.AddPage(page.Margin(top: 50, left: 60));
     }
 }
Example #4
0
 private static void FillDocument(IDocument document,
                                  Data data)
 {
     document.AddPage(Page()
                      .Orientation(PageOrientation.Portrait)
                      .Margin(10, 0, 0, 0)
                      .Size(new PageSize
     {
         Width  = 143,
         Height = 51
     })
                      .Add(GetPageContent(data)));
 }
Example #5
0
        public static void FillDocument(IDocument document,
                                        Action <object> log)
        {
            var footer = Table(300)
                         .Add(Row(Cell()
                                  .Add(Paragraph()
                                       .Add(Field.PageNumber)
                                       .Add(" / ")
                                       .Add(Field.PageCount))));

            document.AddPage(Page()
                             .Orientation(PageOrientation.Portrait)
                             .Footer(footer)
                             .Add(Paragraph("This is the first paragraph on the first page"),
                                  Paragraph("\\n in text will add new line \n just like that"),
                                  Paragraph("Text with right alignment")
                                  .Alignment(Alignment.Right),
                                  Paragraph("Bold 14pt with background color")
                                  .Bold()
                                  .BackgroundColor(Color.Aqua)
                                  .FontSize(14),
                                  Paragraph("Let's add another page and play with tables")));

            var page = Page()
                       .Orientation(PageOrientation.Landscape)
                       .Footer(footer)
                       .Add(Table(400)
                            .Borders(Borders.All)
                            .Add(Row(Cell("1,1", 200)
                                     .Alignment(Alignment.Right),
                                     Cell("1,2", 200)
                                     .BorderSize(3)),
                                 Row(Cell("2,1", 200)
                                     .BackgroundColor(Color.Aqua),
                                     Cell("2,2", 100)
                                     .MergeDown()
                                     .Alignment(Alignment.Center)
                                     .VerticalAlignment(VerticalAlignment.Center)
                                     .TextDirection(TextDirection.RightLeft_TopBottom)),
                                 Row(Cell("3,1", 200),
                                     Cell("3,2", 100)
                                     .MergeUp())));

            page.Add(Paragraph());

            var table = Table(700)
                        .Borders(Borders.Top | Borders.Bottom);

            for (var i = 16; i < 100; i += 10)
            {
                table.Add(Row(i)
                          .HeightType(RowHeightType.Exact)
                          .Add(Cell($"row with height = {i}")
                               .VerticalAlignment(VerticalAlignment.Center)));
            }

            page.Add(table);

            page.Add(Paragraph()
                     .Add(StubPicture()
                          .MaxWidth(200)
                          .MaxHeight(100)
                          .Color(Color.Brown)));

            document.AddPage(page);

            var variableName = "Some log text";

            log(variableName);
        }