コード例 #1
0
ファイル: PDFHelper.cs プロジェクト: pdsoft/ImageReport
        //--------------------------------------------------------------
        private static Table AddTable4Summary(MigraDoc.DocumentObjectModel.Section section)
        {
            Table tbl = section.AddTable();

            //tbl.Style = "Table";
            //tbl.Borders.Color = Colors.Black;
            //tbl.Borders.Width = 0.25;
            //tbl.Borders.Left.Width = 0.5;
            //tbl.Borders.Right.Width = 0.5;
            //tbl.Rows.LeftIndent = 0;

            //string Col1Width = "10.25cm";
            //string Col2Width = "10.25cm";

            //if (ImgRowType == ImageRowType.ImageText)
            //{
            //    Col1Width = "11cm";
            //    Col2Width = "9.5cm";
            //}

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

            return tbl;
        }
コード例 #2
0
ファイル: AbstractPDFCreator.cs プロジェクト: HedinRakot/KVS
        /// <summary>
        /// Erstellt das Dokumentenlayout als eine Micra Doc Tabelle
        /// </summary>
        /// <param name="hf">HeaderFooter</param>
        /// <returns>Tabelle</returns>
        internal virtual Table Write(MigraDoc.DocumentObjectModel.HeaderFooter hf)
        {
            var table = hf.AddTable();

            if (this.Blocks.Count > 0)
                {
                    table.Borders.Top.Width = "0.5";
                    var tableWidth = hf.Document.LastSection.PageSetup.PageWidth.Millimeter - hf.Document.LastSection.PageSetup.LeftMargin.Millimeter - hf.Document.LastSection.PageSetup.RightMargin.Millimeter;

                    var columnWidth = tableWidth / this.Blocks.Count;
                    foreach (var block in this.Blocks)
                    {

                        var myColumn = table.AddColumn(new Unit(columnWidth, UnitType.Millimeter));
                    }

                    var row = table.AddRow();

                    var cellIndex = 0;

                    foreach (var block in this.Blocks)
                    {

                        var par = row.Cells[cellIndex].AddParagraph();
                        par.Format.Font.Size = this.FontSize;
                        row.Cells[cellIndex].VerticalAlignment = VerticalAlignment.Top;

                        foreach (var line in block)
                        {
                            par.AddText(line);
                            par.AddLineBreak();
                        }
                        cellIndex++;
                    }
                }
                else
                {
                    table.AddColumn();
                    table.AddRow();
                }

                if (!string.IsNullOrEmpty(this.LogoFilePath))
                {
                    var image = hf.AddImage(this.LogoFilePath);
                    image.WrapFormat.Style = MigraDoc.DocumentObjectModel.Shapes.WrapStyle.Through;
                    image.RelativeHorizontal = RelativeHorizontal.Margin;
                    image.RelativeVertical = RelativeVertical.Page;
                    image.Top = hf.Document.LastSection.PageSetup.TopMargin - this.LogoHeight;
                    image.Left = ShapePosition.Right;
                    image.LockAspectRatio = true;
                    image.Height = this.LogoHeight;
                }

            return table;
        }
コード例 #3
0
ファイル: PDFHelper.cs プロジェクト: pdsoft/ImageReport
        //-------------------------------------
        private static Table AddTable4Image(MigraDoc.DocumentObjectModel.Section section, ImageRowType ImgRowType)
        {
            Table tbl = section.AddTable();

            tbl.Style = "Table";
            tbl.Borders.Color = Colors.Black;
            tbl.Borders.Width = 0.25;
            tbl.Borders.Left.Width = 0.5;
            tbl.Borders.Right.Width = 0.5;
            tbl.Rows.LeftIndent = 0;

            string Col1Width = "10.25cm";
            string Col2Width = "10.25cm";

            if (ImgRowType == ImageRowType.ImageText)
            {
            Col1Width = "11cm";
            Col2Width = "9.5cm";
            }

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

            column = tbl.AddColumn(Col2Width);
            column.Format.Alignment = ParagraphAlignment.Right;

            return tbl;
        }