데이터 소스에서 테이블 렌더링 
Aspose.PDF는 PdfLightTable 클래스를 사용하여 DataSet, Data Table, 배열 및 IEnumerable 객체에서 DataSource로 테이블을 생성할 수 있습니다.
Table 클래스 는 테이블을 처리하는 데 사용됩니다. 이 클래스는 테이블을 생성하고 문서에 배치할 수 있는 기능을 제공합니다. Rows  및 Cells 를 사용하여 테이블을 생성하려면 필요한 수의 행을 추가하고 적절한 수의 셀로 채워야 합니다.
다음 예제는 4x10 테이블을 생성합니다.
  
      .NET Core 3.1 
      // For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET 
private  static  void  AddTable () 
{ 
    // The path to the documents directory 
     var  dataDir  =  RunExamples . GetDataDir_AsposePdf_WorkingDocuments (); 
 
     // Create PDF document 
     using  ( var  document  =  new  Aspose . Pdf . Document ()) 
     { 
         // Add page 
         var  page  =  document . Pages . Add (); 
 
         var  table  =  new  Aspose . Pdf . Table 
         { 
             // Set column auto widths of the table 
             ColumnWidths  =  "25% 25% 25% 25%" , 
 
             // Set cell padding 
             DefaultCellPadding  =  new  Aspose . Pdf . MarginInfo ( 10 ,  5 ,  10 ,  5 ),  // Left Bottom Right Top 
 
             // Set the table border color as Green 
             Border  =  new  Aspose . Pdf . BorderInfo ( Aspose . Pdf . BorderSide . All ,  . 5f ,  Aspose . Pdf . Color . Green ), 
 
             // Set the border for table cells as Black 
             DefaultCellBorder  =  new  Aspose . Pdf . BorderInfo ( Aspose . Pdf . BorderSide . All ,  . 2f ,  Aspose . Pdf . Color . Green ), 
         }; 
 
         for  ( var  rowCount  =  0 ;  rowCount  <  10 ;  rowCount ++) 
         { 
             // Add row to table 
             var  row  =  table . Rows . Add (); 
 
             // Add table cells 
             for  ( int  i  =  0 ;  i  <  4 ;  i ++) 
             { 
                 row . Cells . Add ( $"Cell ({i + 1}, {rowCount + 1})" ); 
             } 
         } 
 
         // Add table object to first page of input document 
         page . Paragraphs . Add ( table ); 
 
         // Save PDF document 
         document . Save ( dataDir  +  "AddTable_out.pdf" ); 
     } 
 } 
.NET 8 
      // For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET 
private  static  void  AddTable () 
{ 
    // The path to the documents directory 
     var  dataDir  =  RunExamples . GetDataDir_AsposePdf_WorkingDocuments (); 
 
     // Create PDF document 
     using  var  document  =  new  Aspose . Pdf . Document (); 
 
     // Add page 
     var  page  =  document . Pages . Add (); 
 
     var  table  =  new  Aspose . Pdf . Table 
     { 
         // Set column auto widths of the table 
         ColumnWidths  =  "25% 25% 25% 25%" , 
 
         // Set cell padding 
         DefaultCellPadding  =  new  Aspose . Pdf . MarginInfo ( 10 ,  5 ,  10 ,  5 ),  // Left Bottom Right Top 
 
         // Set the table border color as Green 
         Border  =  new  Aspose . Pdf . BorderInfo ( Aspose . Pdf . BorderSide . All ,  . 5f ,  Aspose . Pdf . Color . Green ), 
 
         // Set the border for table cells as Black 
         DefaultCellBorder  =  new  Aspose . Pdf . BorderInfo ( Aspose . Pdf . BorderSide . All ,  . 2f ,  Aspose . Pdf . Color . Green ), 
     }; 
 
     for  ( var  rowCount  =  0 ;  rowCount  <  10 ;  rowCount ++) 
     { 
         // Add row to table 
         var  row  =  table . Rows . Add (); 
 
         // Add table cells 
         for  ( int  i  =  0 ;  i  <  4 ;  i ++) 
         { 
             row . Cells . Add ( $"Cell ({i + 1}, {rowCount + 1})" ); 
         } 
     } 
 
     // Add table object to first page of input document 
     page . Paragraphs . Add ( table ); 
 
     // Save PDF document 
     document . Save ( dataDir  +  "AddTable_out.pdf" ); 
 } 
 
 
Table 객체를 초기화할 때 최소한의 피부 설정이 사용되었습니다:
객체 배열에서 데이터 내보내기 
Table 클래스는 ADO.NET 데이터 소스와 상호 작용하기 위한 메서드를 제공합니다 - ImportDataTable  및 ImportDataView . 첫 번째 메서드는 DataTable에서 데이터를 가져오고, 두 번째는 DataView에서 가져옵니다. 이러한 객체가 MVC 템플릿에서 작업하기에 그리 편리하지 않다는 점을 감안하여 간단한 예제로 제한하겠습니다. 이 예제(50행)에서는 ImportDataTable 메서드를 호출하고 DataTable 인스턴스와 헤더 플래그 및 데이터 출력을 위한 초기 위치(행/열)와 같은 추가 설정을 매개변수로 받습니다.
  
      .NET Core 3.1 
      // For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET 
private  static  void  AddTable () 
{ 
    // Create PDF document 
     using  ( var  document  =  new  Aspose . Pdf . Document 
     { 
         PageInfo  =  new  Aspose . Pdf . PageInfo  {  Margin  =  new  Aspose . Pdf . MarginInfo ( 28 ,  28 ,  28 ,  42 )  } 
     }) 
     { 
         var  table  =  new  Aspose . Pdf . Table 
         { 
             // Set column widths of the table 
             ColumnWidths  =  "25% 25% 25% 25%" , 
             // Set cell padding 
             DefaultCellPadding  =  new  Aspose . Pdf . MarginInfo ( 10 ,  5 ,  10 ,  5 ),  // Left Bottom Right Top 
             // Set the table border color as Green 
             Border  =  new  Aspose . Pdf . BorderInfo ( Aspose . Pdf . BorderSide . All ,  . 5f ,  Aspose . Pdf . Color . Green ), 
             // Set the border for table cells as Black 
             DefaultCellBorder  =  new  Aspose . Pdf . BorderInfo ( Aspose . Pdf . BorderSide . All ,  . 2f ,  Aspose . Pdf . Color . Green ), 
         }; 
 
         var  configuration  =  new  ConfigurationBuilder () 
             . SetBasePath ( Directory . GetCurrentDirectory ()) 
             . AddJsonFile ( "config.json" ,  false ) 
             . Build (); 
 
         var  connectionString  =  configuration . GetSection ( "connectionString" ). Value ; 
 
         if  ( string . IsNullOrEmpty ( connectionString )) 
         { 
             throw  new  ArgumentException ( "No connection string in config.json" ); 
         } 
 
         var  resultTable  =  new  DataTable (); 
 
         using  ( var  conn  =  new  SqlConnection ( connectionString )) 
         { 
             const  string  sql  =  "SELECT * FROM Tennats" ; 
             using  ( var  cmd  =  new  SqlCommand ( sql ,  conn )) 
             { 
                 using  ( var  adapter  =  new  SqlDataAdapter ( cmd )) 
                 { 
                     adapter . Fill ( resultTable ); 
                 } 
             } 
         } 
 
         table . ImportDataTable ( resultTable ,  true ,  1 ,  1 ); 
 
         // Add table object to first page of input document 
         document . Pages [ 1 ]. Paragraphs . Add ( table ); 
 
         using  ( var  streamOut  =  new  MemoryStream ()) 
         { 
             // Save PDF document 
             document . Save ( streamOut ); 
 
             return  new  FileContentResult ( streamOut . ToArray (),  "application/pdf" ) 
             { 
                 FileDownloadName  =  "demotable2.pdf" 
             }; 
         } 
     } 
 } 
.NET 8 
      // For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET 
private  static  void  AddTable () 
{ 
    // Create PDF document 
     using  var  document  =  new  Aspose . Pdf . Document 
     { 
         PageInfo  =  new  Aspose . Pdf . PageInfo  {  Margin  =  new  Aspose . Pdf . MarginInfo ( 28 ,  28 ,  28 ,  42 )  } 
     }; 
 
     var  table  =  new  Aspose . Pdf . Table 
     { 
         // Set column widths of the table 
         ColumnWidths  =  "25% 25% 25% 25%" , 
         // Set cell padding 
         DefaultCellPadding  =  new  Aspose . Pdf . MarginInfo ( 10 ,  5 ,  10 ,  5 ),  // Left Bottom Right Top 
         // Set the table border color as Green 
         Border  =  new  Aspose . Pdf . BorderInfo ( Aspose . Pdf . BorderSide . All ,  . 5f ,  Aspose . Pdf . Color . Green ), 
         // Set the border for table cells as Black 
         DefaultCellBorder  =  new  Aspose . Pdf . BorderInfo ( Aspose . Pdf . BorderSide . All ,  . 2f ,  Aspose . Pdf . Color . Green ), 
     }; 
 
     var  configuration  =  new  ConfigurationBuilder () 
         . SetBasePath ( Directory . GetCurrentDirectory ()) 
         . AddJsonFile ( "config.json" ,  false ) 
         . Build (); 
 
     var  connectionString  =  configuration . GetSection ( "connectionString" ). Value ; 
 
     if  ( string . IsNullOrEmpty ( connectionString )) 
     { 
         throw  new  ArgumentException ( "No connection string in config.json" ); 
     } 
 
     var  resultTable  =  new  DataTable (); 
 
     using  var  conn  =  new  SqlConnection ( connectionString ); 
 
     const  string  sql  =  "SELECT * FROM Tennats" ; 
 
     using  var  cmd  =  new  SqlCommand ( sql ,  conn ); 
 
     using  var  adapter  =  new  SqlDataAdapter ( cmd ); 
     
     adapter . Fill ( resultTable ); 
 
     table . ImportDataTable ( resultTable ,  true ,  1 ,  1 ); 
 
     // Add table object to first page of input document 
     document . Pages [ 1 ]. Paragraphs . Add ( table ); 
 
     using  var  streamOut  =  new  MemoryStream (); 
     
     // Save PDF document 
     document . Save ( streamOut ); 
 
     return  new  FileContentResult ( streamOut . ToArray (),  "application/pdf" ) 
     { 
         PageInfo  =  new  Aspose . Pdf . PageInfo  {  Margin  =  new  Aspose . Pdf . MarginInfo ( 28 ,  28 ,  28 ,  42 )  } 
     }; 
 }