コード例 #1
0
ファイル: PDFHelper.cs プロジェクト: rjakech/SCMS
        public static Table AddNewTable(this Section section, string[] hearders, Unit[] columnSizes = null, Action <Row> rowCallback = null, Action <Cell, Paragraph, int> cellCallback = null)
        {
            var table = section.AddTable();

            table.Borders.Visible = true;
            if (hearders.IsNotNullOrEmpty())
            {
                var pageWidth   = section.Document.DefaultPageSetup.PageWidth;
                var columnWidth = new Unit(pageWidth.Value / hearders.Length, pageWidth.Type);

                // Add columns
                for (var headerIndex = 0; headerIndex < hearders.Length; headerIndex++)
                {
                    table.AddColumn((columnSizes != null && headerIndex < columnSizes.Length)
                                        ? columnSizes[headerIndex]
                                        : columnWidth);
                }

                table.AddNewRow(hearders, row => { row.Shading.Color = SkyCloudyBlueColor; if (rowCallback != null)
                                                   {
                                                       rowCallback(row);
                                                   }
                                }, cellCallback);
            }

            return(table);
        }
コード例 #2
0
ファイル: PDFHelper.cs プロジェクト: rjakech/SCMS
        public static Section AddTextBlock(this Section section, string text)
        {
            var table = section.AddTable();

            table.Borders.Visible = false;
            table.AddColumn(Unit.FromCentimeter(14.0));
            table.AddNewRow(new object[] { text }, row =>
            {
                row.Format.Alignment  = ParagraphAlignment.Left;
                row.VerticalAlignment = VerticalAlignment.Top;
                row.Format.Font       = PDFHelper.CallibriFont11.Clone();
            }, (cell, paragraph, columnIndex) =>
            {
                cell.Format.Alignment      = ParagraphAlignment.Left;
                paragraph.Format.Alignment = ParagraphAlignment.Left;
            });
            return(section);
        }
コード例 #3
0
ファイル: HtmlToMigraDoc.cs プロジェクト: hol353/ApsimX
        /// <summary>
        /// Add a text frame.
        /// </summary>
        /// <param name="section"></param>
        private static void AddCodeBlock(Section section, string text)
        {
            Table table = section.AddTable();
            table.Borders.Width = "0.5pt";
            table.Borders.Color = MigraDoc.DocumentObjectModel.Colors.DarkGray;
            table.LeftPadding = "5mm";
            table.Rows.LeftIndent = "0cm";

            var column = table.AddColumn();
            column.Width = Unit.FromMillimeter(180);

            Row row = table.AddRow();

            string[] lines = text.Split(new string[] { "\r\n" }, StringSplitOptions.None);

            foreach (string line in lines)
            {
                int numSpaces = StringUtilities.IndexNotOfAny(line, " ".ToCharArray(), 0);
                Paragraph p = row[0].AddParagraph();
                p.AddSpace(numSpaces);
                p.AddText(line);
                p.Style = "TableParagraph";
            }
        }
コード例 #4
0
        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";
        }
コード例 #5
0
ファイル: ExportNodeCommand.cs プロジェクト: hut104/ApsimX
        /// <summary>Creates the graph.</summary>
        /// <param name="writer">The writer.</param>
        /// <param name="graphAndTable">The graph and table to convert to html.</param>
        /// <param name="workingDirectory">The working directory.</param>
        private void CreateGraphPDF(Section section, AutoDocumentation.GraphAndTable graphAndTable, string workingDirectory)
        {
            // Create a 2 column, 1 row table. Image in first cell, X/Y data in second cell.
            Table table = section.AddTable();
            table.Style = "GraphAndTable";
            table.Rows.LeftIndent = graphAndTable.indent + "cm";

            Column column1 = table.AddColumn();
            column1.Width = "8cm";
            //column1.Format.Alignment = ParagraphAlignment.Right;
            Column column2 = table.AddColumn();
            column2.Width = "8cm";
            //column2.Format.Alignment = ParagraphAlignment.Right;
            Row row = table.AddRow();

            // Ensure graphs directory exists.
            string graphDirectory = Path.Combine(workingDirectory, "Graphs");
            Directory.CreateDirectory(graphDirectory);

            // Determine the name of the .png file to write.
            string PNGFileName = Path.Combine(graphDirectory,
                                              graphAndTable.xyPairs.Parent.Parent.Name + graphAndTable.xyPairs.Parent.Name + ".png");

            // Setup graph.
            GraphView graph = new GraphView();
            graph.Clear();

            // Create a line series.
            graph.DrawLineAndMarkers("", graphAndTable.xyPairs.X, graphAndTable.xyPairs.Y,
                                     Models.Graph.Axis.AxisType.Bottom, Models.Graph.Axis.AxisType.Left,
                                     System.Drawing.Color.Blue, Models.Graph.LineType.Solid, Models.Graph.MarkerType.None,
                                     Models.Graph.LineThicknessType.Normal, Models.Graph.MarkerSizeType.Normal, true);

            // Format the axes.
            graph.FormatAxis(Models.Graph.Axis.AxisType.Bottom, graphAndTable.xName, false, double.NaN, double.NaN, double.NaN);
            graph.FormatAxis(Models.Graph.Axis.AxisType.Left, graphAndTable.yName, false, double.NaN, double.NaN, double.NaN);
            graph.BackColor = System.Drawing.Color.White;
            graph.FontSize = 10;
            graph.Refresh();

            // Export graph to bitmap file.
            Bitmap image = new Bitmap(400, 250);
            graph.Export(image, false);
            image.Save(PNGFileName, System.Drawing.Imaging.ImageFormat.Png);
            MigraDoc.DocumentObjectModel.Shapes.Image image1 = row.Cells[0].AddImage(PNGFileName);

            // Add x/y data.
            Paragraph xyParagraph = row.Cells[1].AddParagraph();
            xyParagraph.Style = "xyStyle";
            AddFixedWidthText(xyParagraph, "X", 10);
            AddFixedWidthText(xyParagraph, "Y", 10);
            xyParagraph.AddLineBreak();
            for (int i = 0; i < graphAndTable.xyPairs.X.Length; i++)
            {

                AddFixedWidthText(xyParagraph, graphAndTable.xyPairs.X[i].ToString(), 10);
                AddFixedWidthText(xyParagraph, graphAndTable.xyPairs.Y[i].ToString(), 10);
                xyParagraph.AddLineBreak();
            }

            // Add an empty paragraph for spacing.
            Paragraph spacing = section.AddParagraph();
        }
コード例 #6
0
ファイル: Table.cs プロジェクト: JuanCruzReines/PDFBuilder
        /// <summary>
        /// Render table into section
        /// </summary>
        public void RenderInto(MigraDoc.DocumentObjectModel.Section section)
        {
            MigraDoc.DocumentObjectModel.Tables.Table table = section.AddTable();

            this.RenderComponents(table);
        }
コード例 #7
0
        /// <summary>
        /// Creates the invoice table with header row
        /// </summary>
        /// <param name="section">The section onto which to create the table</param>
        /// <returns>The table</returns>
        private static Table CreateTableWithHeader(Section section)
        {
            // Create the item table
            var table = section.AddTable();
            table.Style = "Table";
            table.Borders.Color = Colors.Black;
            table.Borders.Width = 0.25;
            table.Borders.Left.Width = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent = 0;

            // Before you can add a row, you must define the columns
            //line number or item
            //Description
            Column column = table.AddColumn("12cm");
            column.Format.Alignment = ParagraphAlignment.Left;
            //Cost
            column = table.AddColumn("4cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            // Create the header of the table
            Row row = table.AddRow();
            row.HeadingFormat = true;
            row.Format.Alignment = ParagraphAlignment.Center;
            row.Format.Font.Bold = true;
            row.Shading.Color = Colors.LightBlue;
            row.Cells[0].AddParagraph("Description"); //TODO localize
            row.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            row.Cells[1].AddParagraph("Cost"); //TODO localize
            row.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            table.SetEdge(0, 0, 2, 1, Edge.Box, BorderStyle.Single, 0.75, Color.Empty);

            return table;
        }
コード例 #8
0
        /// <summary>
        /// Create a report table. This is the containing table to draw/visualize the class in the report document.
        /// </summary>
        public void Create_ReportTable()
        {
            _tbl = _section.AddTable();
            _tbl.Rows.Alignment   = RowAlignment.Center;
            _tbl.Format.Font.Size = 11;
            _tbl.Borders.Color    = Colors.Black;

            // Add columns
            _tbl.AddColumn(new Unit(.60, UnitType.Inch));
            _tbl.AddColumn(new Unit(.60, UnitType.Inch));

            // determine if report has saturday/sunday classes
            if (this.hasWeekEnd)
            {
                for (int i = 0; i < 7; i++)
                {
                    _tbl.AddColumn(new Unit(1.00, UnitType.Inch));
                }
            }
            else
            {
                // if no saturday/sunday classes
                for (int i = 0; i < 5; i++)
                {
                    _tbl.AddColumn(new Unit(1.25, UnitType.Inch));
                }
            }

            // Add rows
            _tbl.AddRow();
            _tbl.AddRow();

            _tbl.Rows[0].Cells[0].MergeRight = 1;

            if (this.hasWeekEnd)
            {
                _tbl.Rows[0].Cells[2].MergeRight = 6;
            }
            else
            {
                _tbl.Rows[0].Cells[2].MergeRight = 4;
            }

            // Add text to table headers
            _tbl.Rows[0].TopPadding    = new Unit(.05, UnitType.Inch);
            _tbl.Rows[0].BottomPadding = new Unit(.05, UnitType.Inch);

            _tbl.Format.Font.Name = "Arial Narrow";
            _tbl.Format.Font.Size = 10;
            _p = _tbl.Rows[0].Cells[0].AddParagraph("TIME");
            _p.Format.Font.Bold = true;
            _p.Format.Alignment = ParagraphAlignment.Center;

            _p = _tbl.Rows[0].Cells[2].AddParagraph("DAYS");
            _p.Format.Font.Bold = true;
            _p.Format.Alignment = ParagraphAlignment.Center;

            _p = _tbl.Rows[1].Cells[0].AddParagraph("FROM");
            _p.Format.Font.Bold = true;

            _p = _tbl.Rows[1].Cells[1].AddParagraph("TO");
            _p.Format.Font.Bold = true;

            _p = _tbl.Rows[1].Cells[2].AddParagraph("MONDAY");
            _p.Format.Font.Bold = true;
            _p = _tbl.Rows[1].Cells[3].AddParagraph("TUESDAY");
            _p.Format.Font.Bold = true;
            _p = _tbl.Rows[1].Cells[4].AddParagraph("WEDNESDAY");
            _p.Format.Font.Bold = true;
            _p = _tbl.Rows[1].Cells[5].AddParagraph("THURSDAY");
            _p.Format.Font.Bold = true;
            _p = _tbl.Rows[1].Cells[6].AddParagraph("FRIDAY");
            _p.Format.Font.Bold = true;

            if (this.hasWeekEnd)
            {
                _p = _tbl.Rows[1].Cells[7].AddParagraph("SATURDAY");
                _p.Format.Font.Bold = true;
                _p = _tbl.Rows[1].Cells[8].AddParagraph("SUNDAY");
                _p.Format.Font.Bold = true;
            }


            // Add the time rows (session time)
            for (int i = 1; i <= 34; i++)
            {
                _tbl.AddRow();
            }

            // declare a datetime object
            DateTime timeloader = DateTime.Parse("6:00 AM");
            int      counter    = 0;

            for (int i = 2; i <= 35; i++)
            {
                _p = _tbl.Rows[i].Cells[0].AddParagraph(timeloader.AddMinutes(counter).ToShortTimeString());
                _p.Format.Alignment = ParagraphAlignment.Right;
                counter            += 30;
                _p = _tbl.Rows[i].Cells[1].AddParagraph(timeloader.AddMinutes(counter).ToShortTimeString());
                _p.Format.Alignment = ParagraphAlignment.Right;
            }

            // remove borders in days cells
            for (int i = 2; i <= 35; i++)
            {
                _tbl.Rows[i].Cells[2].Borders.Top.Visible    = false;
                _tbl.Rows[i].Cells[2].Borders.Left.Visible   = false;
                _tbl.Rows[i].Cells[2].Borders.Bottom.Visible = false;

                _tbl.Rows[i].Cells[3].Borders.Top.Visible    = false;
                _tbl.Rows[i].Cells[3].Borders.Left.Visible   = false;
                _tbl.Rows[i].Cells[3].Borders.Bottom.Visible = false;

                _tbl.Rows[i].Cells[4].Borders.Top.Visible    = false;
                _tbl.Rows[i].Cells[4].Borders.Left.Visible   = false;
                _tbl.Rows[i].Cells[4].Borders.Bottom.Visible = false;

                _tbl.Rows[i].Cells[5].Borders.Top.Visible    = false;
                _tbl.Rows[i].Cells[5].Borders.Left.Visible   = false;
                _tbl.Rows[i].Cells[5].Borders.Bottom.Visible = false;

                _tbl.Rows[i].Cells[6].Borders.Top.Visible    = false;
                _tbl.Rows[i].Cells[6].Borders.Left.Visible   = false;
                _tbl.Rows[i].Cells[6].Borders.Bottom.Visible = false;

                if (this.hasWeekEnd)
                {
                    _tbl.Rows[i].Cells[7].Borders.Top.Visible    = false;
                    _tbl.Rows[i].Cells[7].Borders.Left.Visible   = false;
                    _tbl.Rows[i].Cells[7].Borders.Bottom.Visible = false;

                    _tbl.Rows[i].Cells[8].Borders.Top.Visible    = false;
                    _tbl.Rows[i].Cells[8].Borders.Left.Visible   = false;
                    _tbl.Rows[i].Cells[8].Borders.Bottom.Visible = false;
                }
            }
            _tbl.Rows[35].Cells[2].Borders.Bottom.Visible = true;
            _tbl.Rows[35].Cells[3].Borders.Bottom.Visible = true;
            _tbl.Rows[35].Cells[4].Borders.Bottom.Visible = true;
            _tbl.Rows[35].Cells[5].Borders.Bottom.Visible = true;
            _tbl.Rows[35].Cells[6].Borders.Bottom.Visible = true;

            if (this.hasWeekEnd)
            {
                _tbl.Rows[35].Cells[7].Borders.Bottom.Visible = true;
                _tbl.Rows[35].Cells[8].Borders.Bottom.Visible = true;
            }
        }
コード例 #9
0
ファイル: PdfRendererVisitor.cs プロジェクト: guz-guz/docgen
 public void VisitTable(Table table)
 {
     _pdfTable = _pdfCell == null
         ? _pdfSection.AddTable()
         : _pdfCell.Elements.AddTable();
 }
コード例 #10
0
 private void AddOutputData(Section section, float CrEq, float NiEq)
 {
     Table table = section.AddTable();
     table.Style = "Table";
 }
コード例 #11
0
        private void AddInputDataSection(Section section, string text)
        {
            Table table = section.AddTable();
            table.Style = "Table";
            table.Format.Font.Size = 8;

            table.Borders.Color = Colors.Black;
            table.Borders.Width = 0;
            table.Borders.Top.Visible = false;
            table.Borders.Left.Visible = false;
            table.Borders.Right.Visible = false;

            table.Borders.Bottom.Color = Colors.Black;
            table.Borders.Bottom.Width = 0.25;
            table.Borders.Bottom.Visible = true;

            Column column = table.AddColumn("16cm");
            column.Format.Alignment = ParagraphAlignment.Left;

            Row row = table.AddRow();
            row.Format.Alignment = ParagraphAlignment.Left;
            row.Cells[0].AddParagraph(text);

            table.SetEdge(0, 0, table.Columns.Count, table.Rows.Count, Edge.Box, BorderStyle.DashSmallGap, 0.25, Color.Empty);
        }
コード例 #12
0
        private void AddEquivalentsTable(Section section, double addMaterialQuantity)
        {
            Table table = section.AddTable();
            table.Style = "Table";
            table.Format.Font.Size = 8;

            table.Borders.Color = Colors.Black;
            table.Borders.Width = 0.25;
            table.Borders.Left.Width = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent = 0;

            Column column = table.AddColumn("5cm");
            for (int i = 0; i < 2; i++)
            {
                column = table.AddColumn("3cm");
                column.Format.Alignment = ParagraphAlignment.Center;
            }

            Row tableHeaderRow = table.AddRow();
            tableHeaderRow.HeadingFormat = true;
            tableHeaderRow.Format.Alignment = ParagraphAlignment.Center;
            tableHeaderRow.Format.Font.Bold = true;

            tableHeaderRow.Cells[0].AddParagraph("Material");

            tableHeaderRow.Cells[0].Format.Font.Bold = true;
            tableHeaderRow.Cells[1].AddParagraph("CrEq");
            tableHeaderRow.Cells[1].Format.Font.Bold = true;
            tableHeaderRow.Cells[2].AddParagraph("NiEq");
            tableHeaderRow.Cells[2].Format.Font.Bold = true;

            // TODO TYLKO DLA WRC1992
            Row baseMaterial1Row = table.AddRow();
            baseMaterial1Row.HeadingFormat = true;
            baseMaterial1Row.Format.Alignment = ParagraphAlignment.Center;
            baseMaterial1Row.Shading.Color = Colors.Aquamarine;
            baseMaterial1Row.Cells[0].AddParagraph(_baseMaterial1.Name);
            baseMaterial1Row.Cells[1].AddParagraph(_baseMaterial1.CrEqWRC1992.ToString());
            baseMaterial1Row.Cells[2].AddParagraph(_baseMaterial1.CrEqWRC1992.ToString());

            Row baseMaterial2Row = table.AddRow();
            baseMaterial2Row.HeadingFormat = true;
            baseMaterial2Row.Format.Alignment = ParagraphAlignment.Center;
            baseMaterial2Row.Shading.Color = Colors.YellowGreen;
            baseMaterial2Row.Cells[0].AddParagraph(_baseMaterial2.Name);
            baseMaterial2Row.Cells[1].AddParagraph(_baseMaterial2.CrEqWRC1992.ToString());
            baseMaterial2Row.Cells[2].AddParagraph(_baseMaterial2.CrEqWRC1992.ToString());

            Row addMaterialRow = table.AddRow();
            addMaterialRow.HeadingFormat = true;
            addMaterialRow.Format.Alignment = ParagraphAlignment.Center;
            addMaterialRow.Shading.Color = Colors.LightPink;
            addMaterialRow.Cells[0].AddParagraph(_addMaterial.Name);
            addMaterialRow.Cells[1].AddParagraph(_addMaterial.CrEqWRC1992.ToString());
            addMaterialRow.Cells[2].AddParagraph(_addMaterial.CrEqWRC1992.ToString());

            Row addMaterialQuantityRow = table.AddRow();
            addMaterialQuantityRow.HeadingFormat = true;
            addMaterialQuantityRow.Format.Alignment = ParagraphAlignment.Center;
            addMaterialQuantityRow.Cells[0].MergeRight = 1;
            addMaterialQuantityRow.Cells[0].AddParagraph("% materialu dodatkowego");
            addMaterialQuantityRow.Cells[0].Format.Font.Bold = true;
            addMaterialQuantityRow.Cells[2].AddParagraph(addMaterialQuantity.ToString());
            addMaterialQuantityRow.Cells[2].Format.Font.Bold = true;

            table.SetEdge(0, 0, table.Columns.Count, table.Rows.Count, Edge.Box, BorderStyle.Single, 2, Color.Empty);
        }
コード例 #13
0
        private void AddEmptySpace(Section section, double height)
        {
            Table table = section.AddTable();
            table.Style = "Table";

            table.Borders.Color = Color.Empty;
            table.Borders.Width = 0;
            table.Borders.Left.Width = 0;
            table.Borders.Right.Width = 0;
            table.Rows.LeftIndent = 0;
            table.Borders.Color = Color.Empty;
            // Before you can add a row, you must define the columns
            Column column = table.AddColumn("16cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            // Create the header of the table
            Row row_1 = table.AddRow();
            row_1.Format.Alignment = ParagraphAlignment.Center;

            row_1.Cells[0].Format.Alignment = ParagraphAlignment.Center;
            row_1.Cells[0].VerticalAlignment = VerticalAlignment.Center;
            row_1.Height = new Unit(height, UnitType.Centimeter);
            table.SetEdge(0, 0, table.Columns.Count, table.Rows.Count, Edge.Box, BorderStyle.Single, 0, Color.Empty);
        }
コード例 #14
0
        private void AddElementsTable(Section section)
        {
            Table table = section.AddTable();
            table.Style = "Table";
            table.Format.Font.Size = 8;

            table.Borders.Color = Colors.Black;
            table.Borders.Width = 0.25;
            table.Borders.Left.Width = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent = 0;

            // Before you can add a row, you must define the columns
            Column column = table.AddColumn("2cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            for (int i = 0; i < 14; i++)
            {
                column = table.AddColumn("1cm");
                column.Format.Alignment = ParagraphAlignment.Center;
            }

            // Create the header of the table
            Row row_1 = table.AddRow();
            row_1.HeadingFormat = true;
            row_1.Format.Alignment = ParagraphAlignment.Center;
            row_1.Format.Font.Bold = true;

            row_1.Cells[0].AddParagraph("Materialy");
            row_1.Cells[0].Format.Font.Bold = true;

            row_1.Cells[1].AddParagraph("C");
            row_1.Cells[2].AddParagraph("Si");
            row_1.Cells[3].AddParagraph("Mn");
            row_1.Cells[4].AddParagraph("P");
            row_1.Cells[5].AddParagraph("S");
            row_1.Cells[6].AddParagraph("Cr");
            row_1.Cells[7].AddParagraph("Ni");
            row_1.Cells[8].AddParagraph("Mo");
            row_1.Cells[9].AddParagraph("N");
            row_1.Cells[10].AddParagraph("Cu");
            row_1.Cells[11].AddParagraph("Nb");
            row_1.Cells[12].AddParagraph("Ti");
            row_1.Cells[13].AddParagraph("V");
            row_1.Cells[14].AddParagraph("Al");

            for (int i = 0; i < 15; i++)
            {
                row_1.Cells[i].Format.Alignment = ParagraphAlignment.Center;
                row_1.Cells[i].VerticalAlignment = VerticalAlignment.Center;
            }

            Row row_material1 = table.AddRow();
            row_material1.HeadingFormat = true;
            row_material1.Format.Alignment = ParagraphAlignment.Center;
            row_material1.Format.Font.Bold = false;

            row_material1.Cells[0].AddParagraph(_baseMaterial1.Name);
            row_material1.Cells[1].AddParagraph(_baseMaterial1.GetElement(Category.OfElement.C).RealValue.ToString());
            row_material1.Cells[2].AddParagraph(_baseMaterial1.GetElement(Category.OfElement.Si).RealValue.ToString());
            row_material1.Cells[3].AddParagraph(_baseMaterial1.GetElement(Category.OfElement.Mn).RealValue.ToString());
            row_material1.Cells[4].AddParagraph(_baseMaterial1.GetElement(Category.OfElement.P).RealValue.ToString());
            row_material1.Cells[5].AddParagraph(_baseMaterial1.GetElement(Category.OfElement.S).RealValue.ToString());
            row_material1.Cells[6].AddParagraph(_baseMaterial1.GetElement(Category.OfElement.Cr).RealValue.ToString());
            row_material1.Cells[7].AddParagraph(_baseMaterial1.GetElement(Category.OfElement.Ni).RealValue.ToString());
            row_material1.Cells[8].AddParagraph(_baseMaterial1.GetElement(Category.OfElement.Mo).RealValue.ToString());
            row_material1.Cells[9].AddParagraph(_baseMaterial1.GetElement(Category.OfElement.N).RealValue.ToString());
            row_material1.Cells[10].AddParagraph(_baseMaterial1.GetElement(Category.OfElement.Cu).RealValue.ToString());
            row_material1.Cells[11].AddParagraph(_baseMaterial1.GetElement(Category.OfElement.Nb).RealValue.ToString());
            row_material1.Cells[12].AddParagraph(_baseMaterial1.GetElement(Category.OfElement.Ti).RealValue.ToString());
            row_material1.Cells[13].AddParagraph(_baseMaterial1.GetElement(Category.OfElement.V).RealValue.ToString());
            row_material1.Cells[14].AddParagraph(_baseMaterial1.GetElement(Category.OfElement.Al).RealValue.ToString());

            for (int i = 0; i < 15; i++)
                row_material1.Cells[i].Shading.Color = Colors.Aquamarine;

            Row row_material2 = table.AddRow();
            row_material2.HeadingFormat = true;
            row_material2.Format.Alignment = ParagraphAlignment.Center;
            row_material2.Format.Font.Bold = false;

            row_material2.Cells[0].AddParagraph(_baseMaterial2.Name);
            row_material2.Cells[1].AddParagraph(_baseMaterial2.GetElement(Category.OfElement.C).RealValue.ToString());
            row_material2.Cells[2].AddParagraph(_baseMaterial2.GetElement(Category.OfElement.Si).RealValue.ToString());
            row_material2.Cells[3].AddParagraph(_baseMaterial2.GetElement(Category.OfElement.Mn).RealValue.ToString());
            row_material2.Cells[4].AddParagraph(_baseMaterial2.GetElement(Category.OfElement.P).RealValue.ToString());
            row_material2.Cells[5].AddParagraph(_baseMaterial2.GetElement(Category.OfElement.S).RealValue.ToString());
            row_material2.Cells[6].AddParagraph(_baseMaterial2.GetElement(Category.OfElement.Cr).RealValue.ToString());
            row_material2.Cells[7].AddParagraph(_baseMaterial2.GetElement(Category.OfElement.Ni).RealValue.ToString());
            row_material2.Cells[8].AddParagraph(_baseMaterial2.GetElement(Category.OfElement.Mo).RealValue.ToString());
            row_material2.Cells[9].AddParagraph(_baseMaterial2.GetElement(Category.OfElement.N).RealValue.ToString());
            row_material2.Cells[10].AddParagraph(_baseMaterial2.GetElement(Category.OfElement.Cu).RealValue.ToString());
            row_material2.Cells[11].AddParagraph(_baseMaterial2.GetElement(Category.OfElement.Nb).RealValue.ToString());
            row_material2.Cells[12].AddParagraph(_baseMaterial2.GetElement(Category.OfElement.Ti).RealValue.ToString());
            row_material2.Cells[13].AddParagraph(_baseMaterial2.GetElement(Category.OfElement.V).RealValue.ToString());
            row_material2.Cells[14].AddParagraph(_baseMaterial2.GetElement(Category.OfElement.Al).RealValue.ToString());

            for (int i = 0; i < 15; i++)
                row_material2.Cells[i].Shading.Color = Colors.YellowGreen;

            Row row_addMaterial = table.AddRow();
            row_addMaterial.HeadingFormat = true;
            row_addMaterial.Format.Alignment = ParagraphAlignment.Center;
            row_addMaterial.Format.Font.Bold = false;

            row_addMaterial.Cells[0].AddParagraph(_addMaterial.Name);
            row_addMaterial.Cells[1].AddParagraph(_addMaterial.GetElement(Category.OfElement.C).RealValue.ToString());
            row_addMaterial.Cells[2].AddParagraph(_addMaterial.GetElement(Category.OfElement.Si).RealValue.ToString());
            row_addMaterial.Cells[3].AddParagraph(_addMaterial.GetElement(Category.OfElement.Mn).RealValue.ToString());
            row_addMaterial.Cells[4].AddParagraph(_addMaterial.GetElement(Category.OfElement.P).RealValue.ToString());
            row_addMaterial.Cells[5].AddParagraph(_addMaterial.GetElement(Category.OfElement.S).RealValue.ToString());
            row_addMaterial.Cells[6].AddParagraph(_addMaterial.GetElement(Category.OfElement.Cr).RealValue.ToString());
            row_addMaterial.Cells[7].AddParagraph(_addMaterial.GetElement(Category.OfElement.Ni).RealValue.ToString());
            row_addMaterial.Cells[8].AddParagraph(_addMaterial.GetElement(Category.OfElement.Mo).RealValue.ToString());
            row_addMaterial.Cells[9].AddParagraph(_addMaterial.GetElement(Category.OfElement.N).RealValue.ToString());
            row_addMaterial.Cells[10].AddParagraph(_addMaterial.GetElement(Category.OfElement.Cu).RealValue.ToString());
            row_addMaterial.Cells[11].AddParagraph(_addMaterial.GetElement(Category.OfElement.Nb).RealValue.ToString());
            row_addMaterial.Cells[12].AddParagraph(_addMaterial.GetElement(Category.OfElement.Ti).RealValue.ToString());
            row_addMaterial.Cells[13].AddParagraph(_addMaterial.GetElement(Category.OfElement.V).RealValue.ToString());

            for (int i = 0; i < 15; i++)
                row_addMaterial.Cells[i].Shading.Color = Colors.LightPink;

            table.SetEdge(0, 0, table.Columns.Count, table.Rows.Count, Edge.Box, BorderStyle.Single, 2, Color.Empty);
        }
コード例 #15
0
        /// <summary>
        /// Creates the static parts of the invoice.
        /// </summary>
        void CreatePage()
        {
            // Each MigraDoc document needs at least one section.
            Section section = this.document.AddSection();

            // Put a logo in the header
            Image image = section.AddImage(path);

            image.Top              = ShapePosition.Top;
            image.Left             = ShapePosition.Left;
            image.WrapFormat.Style = WrapStyle.Through;

            // Create footer
            Paragraph paragraph = section.Footers.Primary.AddParagraph();

            paragraph.AddText("Health And Social Services.");
            paragraph.Format.Font.Size = 9;
            paragraph.Format.Alignment = ParagraphAlignment.Center;

            // Create the text frame for the address
            this.addressFrame                    = section.AddTextFrame();
            this.addressFrame.Height             = "3.0cm";
            this.addressFrame.Width              = "7.0cm";
            this.addressFrame.Left               = ShapePosition.Left;
            this.addressFrame.RelativeHorizontal = RelativeHorizontal.Margin;
            this.addressFrame.Top                = "5.0cm";
            this.addressFrame.RelativeVertical   = RelativeVertical.Page;

            // Put sender in address frame
            paragraph = this.addressFrame.AddParagraph("Karachi,Pakistan");
            paragraph.Format.Font.Name  = "Times New Roman";
            paragraph.Format.Font.Size  = 7;
            paragraph.Format.SpaceAfter = 3;

            // Add the print date field
            paragraph = section.AddParagraph();
            paragraph.Format.SpaceBefore = "6cm";
            paragraph.Style = "Reference";
            paragraph.AddFormattedText("Patients Detail", TextFormat.Bold);
            paragraph.AddTab();
            paragraph.AddText("Date, ");
            paragraph.AddDateField("dd.MM.yyyy");

            // Create the item table
            this.table                     = section.AddTable();
            this.table.Style               = "Table";
            this.table.Borders.Color       = TableBorder;
            this.table.Borders.Width       = 0.25;
            this.table.Borders.Left.Width  = 0.5;
            this.table.Borders.Right.Width = 0.5;
            this.table.Rows.LeftIndent     = 0;



            // Before you can add a row, you must define the columns
            Column column;

            foreach (DataColumn col in dt.Columns)
            {
                column = this.table.AddColumn(Unit.FromCentimeter(3));
                column.Format.Alignment = ParagraphAlignment.Center;
            }

            // Create the header of the table
            Row row = table.AddRow();

            row.HeadingFormat    = true;
            row.Format.Alignment = ParagraphAlignment.Center;
            row.Format.Font.Bold = true;
            row.Shading.Color    = TableBlue;


            for (int i = 0; i < dt.Columns.Count; i++)
            {
                row.Cells[i].AddParagraph(dt.Columns[i].ColumnName);
                row.Cells[i].Format.Font.Bold  = false;
                row.Cells[i].Format.Alignment  = ParagraphAlignment.Left;
                row.Cells[i].VerticalAlignment = VerticalAlignment.Bottom;
            }

            this.table.SetEdge(0, 0, dt.Columns.Count, 1, Edge.Box, BorderStyle.Single, 0.75, Color.Empty);
        }
コード例 #16
0
ファイル: PdfAssembler2.cs プロジェクト: gdlprj/duscusys
        private void SummaryTable(Section s, ReportCollector hardReport)
        {
            var t = s.AddTable().TableDefaults();
            t.AddColumn(0.5*ContentWidth());
            t.AddColumn(0.5*ContentWidth());

            var r = t.AddRow();
            r.Cells[0].AddParagraph("Arg.points");
            r.Cells[1].AddParagraph(hardReport.TotalArgPointReport.numPoints.ToString());

            var r1 = t.AddRow();
            r1.Cells[0].AddParagraph("Attachments");
            r1.Cells[1].AddParagraph(hardReport.TotalArgPointReport.numMediaAttachments.ToString());

            var r2 = t.AddRow();
            r2.Cells[0].AddParagraph("Sources (total events) ");
            r2.Cells[1].AddParagraph(hardReport.EventTotals.TotalSourceAdded.ToString());

            var r3 = t.AddRow();
            r3.Cells[0].AddParagraph("Clusters");
            r3.Cells[1].AddParagraph(hardReport.ClusterReports.Count.ToString());

            var r4 = t.AddRow();
            r4.Cells[0].AddParagraph("Links");
            r4.Cells[1].AddParagraph(hardReport.LinkReports.Count.ToString());

            var r5 = t.AddRow();
            r5.Cells[0].AddParagraph("Comments");
            r5.Cells[1].AddParagraph(hardReport.TotalArgPointReport.numComments.ToString());
        }
コード例 #17
0
ファイル: PdfMaker.cs プロジェクト: ChristophWurst/UFO
        private void CreateTableForAreas(Section section)
        {
            var table = section.AddTable();
            table.Style = "Table";
            table.Borders.Width = 0.25;

            CreateColumns(table);

            foreach (var area in areas) {
                CreateTableForArea(table, area);
                section.AddParagraph("");
            }
        }
コード例 #18
0
        private void AddWrcOutputData(Section section)
        {
            Table table = section.AddTable();
            table.Style = "Table";
            table.Format.Font.Size = 8;

            table.Borders.Color = Colors.Black;
            table.Borders.Width = 0.25;
            table.Borders.Left.Width = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent = 0;

            // Before you can add a row, you must define the columns
            Column column = table.AddColumn("6cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            for (int i = 0; i < 1; i++)
            {
                column = table.AddColumn("6cm");
                column.Format.Alignment = ParagraphAlignment.Center;
            }

            // Create the header of the table
            Row row_1 = table.AddRow();
            row_1.HeadingFormat = true;
            row_1.Format.Alignment = ParagraphAlignment.Center;
            row_1.Format.Font.Bold = true;

            row_1.Cells[0].AddParagraph("Faza");
            row_1.Cells[0].Format.Font.Bold = true;
            row_1.Cells[1].AddParagraph(_wrcPhase);

            Row row_2 = table.AddRow();
            row_2.HeadingFormat = true;
            row_2.Format.Alignment = ParagraphAlignment.Center;
            row_2.Format.Font.Bold = true;

            row_2.Cells[0].AddParagraph("Liczba ferrytyczna");
            row_2.Cells[0].Format.Font.Bold = true;
            row_2.Cells[1].AddParagraph(_wrcFerriticNumber);

            for (int i = 0; i < 1; i++)
            {
                row_1.Cells[i].Format.Alignment = ParagraphAlignment.Center;
                row_1.Cells[i].VerticalAlignment = VerticalAlignment.Center;
            }
            table.SetEdge(0, 0, table.Columns.Count, table.Rows.Count, Edge.Box, BorderStyle.Single, 2, Color.Empty);
        }
コード例 #19
0
        private void CreatePage()
        {
            // Each MigraDoc document needs at least one section.
            MigraDoc.DocumentObjectModel.Section section = this.document.AddSection();

            // Put a logo in the header
            Image image = section.Headers.Primary.AddImage("Image_Icons/logo1.png");

            image.Height             = "2.5cm";
            image.Width              = "5cm";
            image.LockAspectRatio    = true;
            image.RelativeVertical   = RelativeVertical.Line;
            image.RelativeHorizontal = RelativeHorizontal.Margin;
            image.Top              = ShapePosition.Top;
            image.Left             = ShapePosition.Right;
            image.WrapFormat.Style = WrapStyle.Through;

            // Create the text frame for the address
            this.addressFrame                    = section.AddTextFrame();
            this.addressFrame.Height             = "8.0cm";
            this.addressFrame.Width              = "10.0cm";
            this.addressFrame.Left               = ShapePosition.Left;
            this.addressFrame.RelativeHorizontal = RelativeHorizontal.Margin;
            this.addressFrame.Top                = "4cm";
            this.addressFrame.RelativeVertical   = RelativeVertical.Page;

            this.PriceFrame                    = section.AddTextFrame();
            this.PriceFrame.Height             = "5.0cm";
            this.PriceFrame.Width              = "5.0cm";
            this.PriceFrame.Left               = ShapePosition.Right;
            this.PriceFrame.RelativeHorizontal = RelativeHorizontal.Margin;
            this.PriceFrame.Top                = "4.0cm";
            this.PriceFrame.RelativeVertical   = RelativeVertical.Page;

            // Put sender in address frame
            //= addressFrame.AddParagraph("ul.Pralki 5, 13-342 Lodówka");
            //paragraph.Format.Font.Name = "Times New Roman";
            //paragraph.Format.Font.Size = 7;
            //paragraph.Format.SpaceAfter = 3;

            // Add the print date field
            MigraDoc.DocumentObjectModel.Paragraph paragraph = section.AddParagraph();
            paragraph.Format.SpaceBefore = "8cm";
            paragraph.Style = "Reference";
            paragraph.AddFormattedText($"Faktura nr {order.Date.Year}/{order.Id}", TextFormat.Bold);
            paragraph.AddTab();
            paragraph.AddText("Białystok, ");
            paragraph.AddDateField("dd.MM.yyyy");

            paragraph = section.Footers.Primary.AddParagraph();
            paragraph.AddText($"\u00a9 2021 RTV&AGD \n ul.Pralki 5, 13-342 Lodówka \n Data wydruku: {DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss")} ");
            paragraph.Format.Font.Size = 9;
            paragraph.Format.Alignment = ParagraphAlignment.Center;

            // Create the item table
            this.table                = section.AddTable();
            table.Format.Alignment    = ParagraphAlignment.Justify;
            table.Borders.Color       = MigraDoc.DocumentObjectModel.Colors.Black;
            table.Borders.Width       = 0.25;
            table.Borders.Left.Width  = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent     = 5;
            table.TopPadding          = 10;
            table.BottomPadding       = 10;

            // Before you can add a row, you must define the columns
            Column column = this.table.AddColumn("7.5cm");

            column.Format.Alignment = ParagraphAlignment.Center;

            column = this.table.AddColumn("1.5cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = this.table.AddColumn("3.5cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = this.table.AddColumn("3.5cm");
            column.Format.Alignment = ParagraphAlignment.Right;


            // Create the header of the table
            Row row = table.AddRow();

            row.HeadingFormat    = true;
            row.Format.Alignment = ParagraphAlignment.Left;
            row.Format.Font.Bold = true;
            row.Shading.Color    = TableBlue;
            row.Cells[0].AddParagraph("Nazwa");
            row.Cells[0].Format.Font.Bold  = true;
            row.Cells[0].Format.Alignment  = ParagraphAlignment.Left;
            row.Cells[0].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Center;

            row.Cells[1].AddParagraph("Ilość");
            row.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[2].AddParagraph("Cena/szt");
            row.Cells[2].Format.Alignment  = ParagraphAlignment.Left;
            row.Cells[2].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Center;

            row.Cells[3].AddParagraph("Wartosc");
            row.Cells[3].Format.Alignment  = ParagraphAlignment.Left;
            row.Cells[3].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Center;



            this.table.SetEdge(0, 0, 4, 1, Edge.Box, BorderStyle.Single, 0.75, MigraDoc.DocumentObjectModel.Color.Empty);
        }
コード例 #20
0
ファイル: PdfAssembler2.cs プロジェクト: gdlprj/duscusys
        private void MediaTable(Section s, IEnumerable<Attachment> media, int tableColor = -1)
        {
            Table t = null;
            if (tableColor == -1)
                t = s.AddTable().TableDefaults();
            else
                t = s.AddTable().TableDefaults(tableColor);

            var colWidth = 0.5*ContentWidth();
            var c0 = t.AddColumn(colWidth);
            var c1 = t.AddColumn(colWidth);

            var r0 = t.AddRow();
            r0.Cells[0].AddParagraph().AddBold("Number");
            r0.Cells[1].AddParagraph().AddBold("Media");

            double maxImgWidth = colWidth - 10;
            int number = 1;
            foreach (var att in media)
            {
                var row = t.AddRow();
                row.BottomPadding = 5;
                row.TopPadding = 5;

                //number                
                var header = row.Cells[0].AddParagraph();
                header.AddText(string.Format("{0}. {1}", number, att.Link));
                number++;

                //thumb               
                var pathName = Utils2.RandomFilePath(".png");
                var bmpSrc = AttachmentManager.GetAttachmentBitmap3(att);
                AttachmentManager.SaveBitmapSource(AttachmentManager.GetAttachmentBitmap3(att), pathName);

                var para = row.Cells[1].AddImage(pathName);
                if (att.Format == (int) AttachmentFormat.Pdf) //pdf thumb is low resolution
                    para.Height = maxImgWidth;
                else
                    para.Width = maxImgWidth;
                para.RelativeHorizontal = RelativeHorizontal.Column;
                para.RelativeVertical = RelativeVertical.Paragraph;
            }
        }
コード例 #21
0
ファイル: PdfAssembler2.cs プロジェクト: gdlprj/duscusys
        private void SourcesTable(Section s, IEnumerable<Source> sources, int tableColor = -1)
        {
            Table t;
            if (tableColor == -1)
                t = s.AddTable().TableDefaults();
            else
                t = s.AddTable().TableDefaults(tableColor);

            var colWidth = ContentWidth();
            var c0 = t.AddColumn(colWidth);

            t.AddRow().Cells[0].AddParagraph().AddBold("Sources");

            int number = 1;
            foreach (var src in sources)
            {
                var row = t.AddRow();
                row.BottomPadding = 5;
                row.TopPadding = 5;

                var para = row.Cells[0].AddParagraph();
                para.AddText(string.Format("{0}. {1}", number, src.Text));

                number++;
            }
        }
コード例 #22
0
ファイル: PdfAssembler2.cs プロジェクト: gdlprj/duscusys
        private void ArgPointNode(Section s, ArgPoint ap)
        {
            //arg.point header table  
            var t = s.AddTable().TableDefaults(ap.Person.Color);

            var c0 = t.AddColumn(0.2*ContentWidth());
            var c1 = t.AddColumn(0.8*ContentWidth());

            var r1 = t.AddRow();
            r1.Format.Font.Bold = true;
            r1.Cells[0].AddParagraph().AddBold("Point #" + ap.OrderNumber);
            r1.Cells[1].AddParagraph(ap.Point);

            //var r0 = t.AddRow();
            //r0.Cells[0].AddParagraph("Author");
            //r0.Cells[1].AddParagraph(ap.Person.Name);

            //description
            var descr = s.AddParagraph(ap.Description.Text);
            descr.Format.Shading.Color = new MigraDoc.DocumentObjectModel.Color((uint) ap.Person.Color);
            descr.AlignWithTable();

            //point's media
            MediaTable(s, ap.Attachment, ap.Person.Color);

            //point's sources
            SourcesTable(s, ap.Description.Source, ap.Person.Color);

            //point's comments
            CommentsTable(s, ap.Comment, ap.Person.Color);
        }
コード例 #23
0
    public static void createTable(Section section ,string tableHeadder, string [] tableHeaders , dynamic tableData, string typeOfTable )
    {
        section.AddPageBreak();
           section.AddParagraph();
           Paragraph headerGroup = section.AddParagraph();
           headerGroup.Style = "Header";
           headerGroup.Format.Alignment = ParagraphAlignment.Center;
           headerGroup.AddText(string.Format(tableHeadder));
           section.AddParagraph();

           Table table = section.AddTable();
           table.Style = EstiloTabla;
           table.Borders.Color = ColorBorderTabla;
           table.Borders.Width = BorderWidth;
           table.Borders.Left.Width = LeftWidth;
           table.Borders.Right.Width = RightWidth;
           table.Rows.LeftIndent = LeftIndent;

          string[] sizes= new []{"16cm"};
          if (tableHeaders.Length == 3)
          {
          sizes = length3;
          }
          if (tableHeaders.Length == 4)
          {
          sizes = length4;
          }
          if (tableHeaders.Length == 6)
          {
          sizes = length6;
          }

          for (int i = 0; i < sizes.Length; i++)
          {
          table.AddColumn(sizes[i]);

          }

          Row row = table.AddRow();
          row.HeadingFormat = true;
          row.Format.Alignment = AlineamientoTableHead;
          row.Format.Font.Bold = true;
          row.Shading.Color = ColorFondoTableHead;

          for (int i = 0; i < tableHeaders.Length; i++)
          {
          row.Cells[i].AddParagraph(tableHeaders[i]);
          }

          row.HeadingFormat = false;

          //Agregar contenido de a la tabla.

          int counter = 0;
          if (tableData != null)
          {
          foreach (var dataObj in tableData)
          {
              row = table.AddRow();
              if (counter % 2 == 0)
                  row.Shading.Color = ColorFondoRow;

              if (typeOfTable.Equals("initial") || typeOfTable.Equals("final"))
              {
                  row.Cells[0].AddParagraph((string)dataObj.Descripcion);
                  row.Cells[1].AddParagraph((string)dataObj.volume);
                  row.Cells[2].AddParagraph((string)dataObj.Precio);
              }
              if (typeOfTable.Equals("cargas") || typeOfTable.Equals("descargas"))
              {
                  row.Cells[0].AddParagraph((string)dataObj.Descripcion);
                  row.Cells[1].AddParagraph((string)dataObj.Cantidad);
                  row.Cells[2].AddParagraph((string)dataObj.volume);
                  row.Cells[3].AddParagraph((string)dataObj.Precio);
              }
              if(typeOfTable.Equals("ralenti")){
                  row.Cells[0].AddParagraph((string)dataObj.Descripcion);
                  row.Cells[1].AddParagraph((string)dataObj.Tiempo);
                  row.Cells[2].AddParagraph((string)dataObj.volume);
                  row.Cells[3].AddParagraph((string)dataObj.Precio);
              }
              if(typeOfTable.Equals("consumido")){
                  row.Cells[0].AddParagraph((string)dataObj.Descripcion);
                  row.Cells[1].AddParagraph((string)dataObj.distance);
                  row.Cells[2].AddParagraph((string)dataObj.volume);
                  row.Cells[3].AddParagraph((string)dataObj.Precio);
              }
              if(typeOfTable.Equals("comportamiento")){
                  row.Cells[0].AddParagraph((string)dataObj.Descripcion);
                  row.Cells[1].AddParagraph((string)dataObj.VMax);
                  row.Cells[2].AddParagraph((string)dataObj.TMov);
                  row.Cells[3].AddParagraph((string)dataObj.TMuerto);
                  row.Cells[4].AddParagraph((string)dataObj.RendBruto);
                  row.Cells[5].AddParagraph((string)dataObj.RendEfectivo);

              }

              counter++;
              section.AddParagraph();
          }
          }
    }
コード例 #24
0
ファイル: PdfAssembler2.cs プロジェクト: gdlprj/duscusys
        private void CommentsTable(Section s, IEnumerable<Comment> comments, int color)
        {
            var t2 = s.AddTable().TableDefaults(color);
            t2.AddColumn(0.2*ContentWidth());
            t2.AddColumn(0.8*ContentWidth());

            var hdrRow = t2.AddRow();
            hdrRow.Cells[0].AddParagraph().AddBold("Author");
            hdrRow.Cells[1].AddParagraph().AddBold("Comment");

            foreach (var comment in comments)
            {
                if (comment.Person == null || comment.Text == DaoUtils.NEW_COMMENT)
                    continue;

                var row = t2.AddRow();
                row.Cells[0].AddParagraph(comment.Person.Name);
                row.Cells[0].Shading.Color = new MigraDoc.DocumentObjectModel.Color((uint) comment.Person.Color);
                row.Cells[1].AddParagraph(comment.Text);
            }
        }
コード例 #25
0
        private static Table AddDivisionTableTo(Section section, string divisionName)
        {
            var divisionTable = section.AddTable();
            divisionTable.Comment = divisionName;

            var id = divisionTable.AddColumn(Unit.FromInch(0.5));
            var name = divisionTable.AddColumn(Unit.FromInch(2.5));
            var description = divisionTable.AddColumn(Unit.FromInch(3));
            var value = divisionTable.AddColumn(Unit.FromInch(1));

            var headerRow = divisionTable.AddRow();
            headerRow.HeadingFormat = true;
            headerRow.Shading.Color = Colors.LightGray;

            headerRow.Cells[0].AddParagraph("Id");
            headerRow.Cells[1].AddParagraph("City");
            headerRow.Cells[2].AddParagraph("Nickname");
            headerRow.Cells[3].AddParagraph("Wins");

            headerRow.Borders.Width = Unit.FromPoint(1);

            return divisionTable;
        }
コード例 #26
0
ファイル: PdfAssembler2.cs プロジェクト: gdlprj/duscusys
        private void ClusterTable(Section s, ClusterReport clustReport, byte[] image)
        {
            var t = s.AddTable().TableDefaults();
            t.AddColumn(ContentWidth());

            var hdrRow = t.AddRow();
            hdrRow.Shading.Color = clustReport.initialOwner.PersonToColor();
            hdrRow.Cells[0].AddParagraph().AddBold("Cluster");

            ClusterTableLine(t, clustReport.clusterTitle, clustReport.clusterId, false, clustReport.initialOwner);

            foreach (var point in clustReport.points)
                ArgPointTableLine(t, point, true);

            AddLinkOrClusterImg(s, image);
        }
コード例 #27
0
ファイル: PDFExport.cs プロジェクト: BesuglovS/UchOtd
        private static void PutScheduleTable(ScheduleRepository repo, Section section,
            Dictionary<int, Dictionary<string, Dictionary<int, Tuple<string, List<Tuple<Lesson, int>>, string>>>> schedule,
            double scheduleFontsize)
        {
            var paragraph = section.AddParagraph();
            paragraph.Format.SpaceBefore = "1.25cm";

            var table = section.AddTable();
            table.Style = "Table";
            table.Borders.Color = new Color(0, 0, 0);
            table.Borders.Width = 0.25;
            table.Borders.Left.Width = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent = 0;

            Column column = table.AddColumn("3.7cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            var timeList = new List<string>();
            foreach (var group in schedule)
            {
                foreach (var time in group.Value.Keys)
                {
                    if (!timeList.Contains(time))
                    {
                        timeList.Add(time);
                    }
                }
            }

            string colWidth = (24.0 / schedule.Count).ToString("F1").Replace(',','.');
            for (int i = 0; i < schedule.Count; i++)
            {
                column = table.AddColumn(colWidth + "cm");
                column.Format.Alignment = ParagraphAlignment.Right;
            }

            int groupColumn = 1;

            var plainGroupsListIds = new Dictionary<int, List<int>>();
            var nGroupsListIds = new Dictionary<int, List<int>>();

            // Create the header of the table
            Row row = table.AddRow();
            row.HeadingFormat = true;
            row.Format.Alignment = ParagraphAlignment.Center;

            row.Cells[0].AddParagraph("Время");

            foreach (var group in schedule)
            {
                var groupName = repo.StudentGroups.GetStudentGroup(group.Key).Name;
                row.Cells[groupColumn].AddParagraph(groupName.Replace(" (+Н)", ""));

                groupColumn++;

                if (groupName.Contains(" (+Н)"))
                {
                    var plainGroupName = groupName.Replace(" (+Н)", "");
                    var nGroupName = groupName.Replace(" (+", "(");

                    var plainGroupId = repo.StudentGroups.FindStudentGroup(plainGroupName).StudentGroupId;
                    var plainStudentIds = repo
                            .StudentsInGroups
                            .GetAllStudentsInGroups()
                            .Where(sig => sig.StudentGroup.StudentGroupId == plainGroupId)
                            .Select(stig => stig.Student.StudentId)
                            .ToList();
                    plainGroupsListIds.Add(group.Key, repo
                            .StudentsInGroups
                            .GetAllStudentsInGroups()
                            .Where(sig => plainStudentIds.Contains(sig.Student.StudentId))
                            .Select(stig => stig.StudentGroup.StudentGroupId)
                            .Distinct()
                            .ToList());

                    var nGroupId = repo.StudentGroups.FindStudentGroup(nGroupName).StudentGroupId;
                    var nStudentIds = repo
                            .StudentsInGroups
                            .GetAllStudentsInGroups()
                            .Where(sig => sig.StudentGroup.StudentGroupId == nGroupId)
                            .Select(stig => stig.Student.StudentId)
                            .ToList();
                    nGroupsListIds.Add(group.Key, repo
                            .StudentsInGroups
                            .GetAllStudentsInGroups()
                            .Where(sig => nStudentIds.Contains(sig.Student.StudentId))
                            .Select(stig => stig.StudentGroup.StudentGroupId)
                            .Distinct()
                            .ToList());
                }
            }

            var timeRowIndexList = new List<int>();

            var timeRowIndex = 2;
            foreach (var time in timeList.OrderBy(t => int.Parse(t.Split(':')[0]) * 60 + int.Parse(t.Split(':')[1])))
            {
                var timeRow = table.AddRow();
                timeRow.VerticalAlignment = VerticalAlignment.Center;

                var hour = int.Parse(time.Substring(0, 2));
                var minute = int.Parse(time.Substring(3, 2));

                minute += 80;

                while (minute >= 60)
                {
                    hour++;
                    minute -= 60;
                }

                timeRowIndexList.Add(timeRowIndex);

                timeRow.Cells[0].Format.Alignment = ParagraphAlignment.Center;
                timeRow.Cells[0].AddParagraph(time + " - " + hour.ToString("D2") + ":" + minute.ToString("D2"));

                var columnGroupIndex = 1;
                foreach (var group in schedule)
                {
                    if (group.Value.ContainsKey(time))
                    {
                        var cellTable = timeRow.Cells[columnGroupIndex].Elements.AddTable();
                        cellTable.AddColumn(table.Columns[columnGroupIndex].Width.Centimeter + "cm");
                        cellTable.Borders.Width = 0;

                        foreach (var tfdData in group.Value[time].OrderBy(tfd => tfd.Value.Item2.Select(l => repo.CommonFunctions.CalculateWeekNumber(l.Item1.Calendar.Date)).Min()))
                        {
                            var cellText = "";
                            cellText += tfdData.Value.Item2[0].Item1.TeacherForDiscipline.Discipline.Name;
                            var groupId = tfdData.Value.Item2[0].Item1.TeacherForDiscipline.Discipline.StudentGroup.StudentGroupId;

                            if (plainGroupsListIds.ContainsKey(group.Key))
                            {
                                if (plainGroupsListIds[group.Key].Contains(groupId) && nGroupsListIds[group.Key].Contains(groupId))
                                {
                                    cellText += " (+Н)";
                                }
                                if (!plainGroupsListIds[group.Key].Contains(groupId) && nGroupsListIds[group.Key].Contains(groupId))
                                {
                                    cellText += " (Н)";
                                }
                            }
                            cellText += Environment.NewLine;
                            cellText += tfdData.Value.Item2[0].Item1.TeacherForDiscipline.Teacher.FIO + Environment.NewLine;
                            cellText += "(" + tfdData.Value.Item1 + ")" + Environment.NewLine;

                            var audWeekList = tfdData.Value.Item2.ToDictionary(l => repo.CommonFunctions.CalculateWeekNumber(l.Item1.Calendar.Date), l => l.Item1.Auditorium.Name);
                            var grouped = audWeekList.GroupBy(a => a.Value);

                            var enumerable = grouped as List<IGrouping<string, KeyValuePair<int, string>>> ?? grouped.ToList();
                            var gcount = enumerable.Count();
                            if (gcount == 1)
                            {
                                cellText += enumerable.ElementAt(0).Key;
                            }
                            else
                            {
                                for (int j = 0; j < gcount; j++)
                                {
                                    var jItem = enumerable.OrderBy(e => e.Select(ag => ag.Key).ToList().Min()).ElementAt(j);
                                    cellText += CommonFunctions.CombineWeeks(jItem.Select(ag => ag.Key).ToList()) + " - " + jItem.Key;

                                    if (j != gcount - 1)
                                    {
                                        cellText += Environment.NewLine;
                                    }
                                }
                            }

                            Row cellTableRow = cellTable.AddRow();

                            cellTableRow.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                            cellTableRow.Cells[0].Format.Font.Size = scheduleFontsize;
                            cellTableRow.Cells[0].AddParagraph(cellText);
                        }
                    }

                    columnGroupIndex++;
                }

                timeRowIndex++;
            }
        }
コード例 #28
0
ファイル: PdfAssembler2.cs プロジェクト: gdlprj/duscusys
        private void LinkTable(Section s, LinkReportResponse link, byte[] image)
        {
            var t = s.AddTable().TableDefaults();
            t.AddColumn(ContentWidth());

            var hdrRow = t.AddRow();
            hdrRow.Cells[0].Shading.Color = link.initOwner.PersonToColor();
            hdrRow.Cells[0].AddParagraph().AddBold("Link");

            if (!string.IsNullOrEmpty(link.Caption))
            {
                var r = t.AddRow();
                r.Cells[0].Shading.Color = link.initOwner.PersonToColor();
                r.Cells[0].AddParagraph(string.Format("Link \"{0}\"", link.Caption));
            }

            if (link.EndpointArgPoint1)
                ArgPointTableLine(t, link.ArgPoint1, true);
            else
                ClusterTableLine(t, link.ClusterCaption1, link.IdOfCluster1, true, null);

            if (link.EndpointArgPoint2)
                ArgPointTableLine(t, link.ArgPoint2, true);
            else
                ClusterTableLine(t, link.ClusterCaption2, link.IdOfCluster2, true, null);

            //AddLinkOrClusterImg(s, pathname);           
        }
コード例 #29
0
ファイル: ExportNodeCommand.cs プロジェクト: hut104/ApsimX
        /// <summary>Creates the table.</summary>
        /// <param name="section">The section.</param>
        /// <param name="tableObj">The table to convert to html.</param>
        /// <param name="workingDirectory">The working directory.</param>
        private void CreateTable(Section section, AutoDocumentation.Table tableObj, string workingDirectory)
        {
            // Create a 2 column, 1 row table. Image in first cell, X/Y data in second cell.
            Table table = section.AddTable();
            table.Style = "Table";
            table.Rows.LeftIndent = "1cm";

            foreach (List<string> column in tableObj.data)
            {
                Column column1 = table.AddColumn();
                column1.Width = "1.4cm";
                column1.Format.Alignment = ParagraphAlignment.Right;
            }

            for (int rowIndex = 0; rowIndex < tableObj.data[0].Count; rowIndex++)
            {
                Row row = table.AddRow();
                for (int columnIndex = 0; columnIndex < tableObj.data.Count; columnIndex++)
                {
                    string cellText = tableObj.data[columnIndex][rowIndex];
                    row.Cells[columnIndex].AddParagraph(cellText);
                }

            }
        }
コード例 #30
0
        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";
        }