Novacode.DocX.InsertTable C# (CSharp) Method

InsertTable() public method

Insert a Table into this document. The Table's source can be a completely different document.
public InsertTable ( Table t ) : Table
t Table The Table to insert.
return Table
        public new Table InsertTable(Table t)
        {
            t = base.InsertTable(t);
            t.mainPart = mainPart;
            return t;
        }

Same methods

DocX::InsertTable ( int index, Table t ) : Table
DocX::InsertTable ( int rowCount, int columnCount ) : Table
DocX::InsertTable ( int index, int rowCount, int columnCount ) : Table

Usage Example

コード例 #1
0
ファイル: VersenyEredmenyLap.cs プロジェクト: belinyak/Ijasz2
        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;
            }
All Usage Examples Of Novacode.DocX::InsertTable