當前位置: 首頁>>代碼示例>>C#>>正文


C# DocX.InsertTable方法代碼示例

本文整理匯總了C#中Novacode.DocX.InsertTable方法的典型用法代碼示例。如果您正苦於以下問題:C# DocX.InsertTable方法的具體用法?C# DocX.InsertTable怎麽用?C# DocX.InsertTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Novacode.DocX的用法示例。


在下文中一共展示了DocX.InsertTable方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CreateDoc

        private string CreateDoc( ) {
              var fileName = Seged.Seged.CreateFileName( versenyAdatok.VersenysorozatAzonosito, versenyAdatok.Azonosito,
                    dokumentumTipus );

                document = DocX.Create( fileName );
                document.AddHeaders( );
                Seged.Seged.OldalSzamozas( document );

                var header = document.Headers.odd;
                AddHeader( header );
                VersenyAdatokTablazat( header );

                foreach( var ijtipus in ijtipusok._ijtipusok ) {
                    Table table ;
                    foreach( var korosztaly in ijtipus.korosztalyok.korosztalyok ) {
                        if( !korosztaly.eredmenyek.IsEmpty( ) ) {
                            var korosztalyParagraph = document.InsertParagraph();
                            korosztalyParagraph.Append( "Íjtípus: " );
                            korosztalyParagraph.Append( ijtipus.megnevezes ).Bold( );
                            korosztalyParagraph.AppendLine( "    Korosztály: " );
                            korosztalyParagraph.Append( korosztaly.megnevezes ).Bold( );

                            if( !korosztaly.eredmenyek.Nok.Count.Equals( 0 ) ) {
                                var nokParagraph = document.InsertParagraph();
                                nokParagraph.Append( "      Nők: " ).Bold( );

                                int helyezes = 0;
                                foreach( var eredmeny in korosztaly.eredmenyek.Nok ) {
                                    helyezes++;
                                    table = document.AddTable( 1, 7 );
                                    table.Rows[0].Cells[1].Paragraphs[0].Append( ( helyezes ) + "." );
                                    table.Rows[0].Cells[2].Paragraphs[0].Append( eredmeny.Sorszam.ToString( ) );
                                    table.Rows[0].Cells[3].Paragraphs[0].Append( eredmeny.Nev );
                                    table.Rows[0].Cells[4].Paragraphs[0].Append( eredmeny.Egyesulet );
                                    table.Rows[0].Cells[5].Paragraphs[0].Append( eredmeny.OsszPont.ToString( ) + " pont" );
                                    table.Rows[0].Cells[6].Paragraphs[0].Append( eredmeny.Szazalek.ToString( ) + "%" );
                                    TablazatFormazas( table );
                                    document.InsertTable( table );
                                }
                            }
                            if( !korosztaly.eredmenyek.Ferfiak.Count.Equals( 0 ) ) {
                                var nokParagraph = document.InsertParagraph();
                                nokParagraph.Append( "      Férfiak: " ).Bold( );

                                int helyezes = 0;
                                foreach( var eredmeny in korosztaly.eredmenyek.Ferfiak ) {
                                    helyezes++;
                                    table = document.AddTable( 1, 7 );
                                    table.Rows[0].Cells[1].Paragraphs[0].Append( ( helyezes ) + "." );
                                    table.Rows[0].Cells[2].Paragraphs[0].Append( eredmeny.Sorszam.ToString( ) );
                                    table.Rows[0].Cells[3].Paragraphs[0].Append( eredmeny.Nev );
                                    table.Rows[0].Cells[4].Paragraphs[0].Append( eredmeny.Egyesulet );
                                    table.Rows[0].Cells[5].Paragraphs[0].Append( eredmeny.OsszPont.ToString( ) + " pont" );
                                    table.Rows[0].Cells[6].Paragraphs[0].Append( eredmeny.Szazalek.ToString( ) + "%" );
                                    TablazatFormazas( table );
                                    document.InsertTable( table );
                                }
                            }
                            if( !korosztaly.eredmenyek.Egyben.Count.Equals( 0 ) ) {
                                var nokParagraph = document.InsertParagraph();
                                nokParagraph.Append( "      Egyben: " ).Bold( );

                                int helyezes = 0;
                                foreach( var eredmeny in korosztaly.eredmenyek.Egyben ) {
                                    helyezes++;
                                    table = document.AddTable( 1, 7 );
                                    table.Rows[0].Cells[1].Paragraphs[0].Append( ( helyezes ) + "." );
                                    table.Rows[0].Cells[2].Paragraphs[0].Append( eredmeny.Sorszam.ToString( ) );
                                    table.Rows[0].Cells[3].Paragraphs[0].Append( eredmeny.Nev );
                                    table.Rows[0].Cells[4].Paragraphs[0].Append( eredmeny.Egyesulet );
                                    table.Rows[0].Cells[5].Paragraphs[0].Append( eredmeny.OsszPont.ToString( ) + " pont" );
                                    table.Rows[0].Cells[6].Paragraphs[0].Append( eredmeny.Szazalek.ToString( ) + "%" );
                                    TablazatFormazas( table );
                                    document.InsertTable( table );
                                }
                            }
                        }
                    }
                }
                try { document.Save( ); } catch( Exception ) {
                    MessageBox.Show( "A dokumentum meg van nyitva!", "Verseny Teljes Eredménylap", MessageBoxButton.OK, MessageBoxImage.Error );
                }
                return fileName;
            }
開發者ID:belinyak,項目名稱:Ijasz2,代碼行數:84,代碼來源:VersenyEredmenyLap.cs

示例2: CreateResultsTable

        //add items later
        private void CreateResultsTable(DocX document2, string tableTitle, IEnumerable<ProtocolResult> data)
        {
            var titleStyle = new Formatting();
            titleStyle.Size = 12;
            titleStyle.Bold = true;
            titleStyle.FontFamily = new System.Drawing.FontFamily("Times New Roman");

            var title = document2.InsertParagraph(tableTitle, false, titleStyle);
            title.IndentationBefore = 2;
            title.InsertText(Environment.NewLine);

            var table = document2.InsertTable(1, 9);
            table.AutoFit = AutoFit.Window;

            InsertTableHeader(table);
            InsertTableNumerationRow(table);

            PopulateTable(table, data);

            PrepareCells(table);
        }
開發者ID:astian92,項目名稱:rvselectronicdiary,代碼行數:22,代碼來源:ProtocolReport.cs

示例3: CreateTable

        private static void CreateTable(DocX doc)
        {
            const int TABLE_WIDTH = 3;
            const int TABLE_HEIGHT = 4;
            var table = doc.AddTable(TABLE_HEIGHT, TABLE_WIDTH);
            table.Alignment = Alignment.center;
            for (int row = 0; row < table.RowCount; row++)
            {
                for (int col = 0; col < table.ColumnCount; col++)
                {
                    table.Rows[row].Cells[col].Paragraphs[0].Alignment = Alignment.center;
                    if (row == 0)
                    {
                        table.Rows[row].Cells[col].FillColor = System.Drawing.Color.MediumBlue;
                        switch (col)
                        {
                            case 0:
                                table.Rows[row].Cells[col].Paragraphs[0].Append("Team");
                                break;
                            case 1:
                                table.Rows[row].Cells[col].Paragraphs[0].Append("Game");
                                break;
                            case 2:
                                table.Rows[row].Cells[col].Paragraphs[0].Append("Points");
                                break;
                        }
                    }
                    else
                    {
                        table.Rows[row].Cells[col].Paragraphs[0].Append("-");
                    }
                }
            }

            doc.InsertTable(table);
        }
開發者ID:nok32,項目名稱:SoftUny-HW,代碼行數:36,代碼來源:Generator.cs

示例4: PrintRevision

        private void PrintRevision(IEnumerable<BarRevisionMyClass> revision, DocX doc)
        {
            BarRevisionController.BarRevisionControllerInstance().InsertOrUpdateAllItemsInBar();
            for (int i = 0; i < 5; i++)
            {
                doc.InsertParagraph();
            }
            doc.InsertParagraph("Ревизия:");
            var barRevisionMyClasses = revision as IList<BarRevisionMyClass> ?? revision.ToList();
            doc.InsertTable(barRevisionMyClasses.Count()+2, 2);
            doc.PageLayout.Orientation = Orientation.Landscape;
            Table revisionTable = doc.Tables[2];
            revisionTable.AutoFit = AutoFit.Contents;
            revisionTable.Design = TableDesign.TableGrid;

            revisionTable.Rows[0].Cells[0].Paragraphs[0].InsertText("Наименование");
            revisionTable.Rows[0].Cells[1].Paragraphs[0].InsertText("Продано");
            for (int i = 0; i < barRevisionMyClasses.Count(); i++)
            {
                revisionTable.Rows[i + 1].Cells[0].Paragraphs[0].InsertText(barRevisionMyClasses[i].Наименование);
                revisionTable.Rows[i + 1].Cells[1].Paragraphs[0].InsertText(barRevisionMyClasses[i].Продано.ToString(CultureInfo.InvariantCulture));
            }
            foreach (var si in barRevisionMyClasses)
            {

            }
        }
開發者ID:kimslava93,項目名稱:Boom,代碼行數:27,代碼來源:ShiftsManagerController.cs


注:本文中的Novacode.DocX.InsertTable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。