title: How to define Colspan and Rowspan when using iText 7 for .NET
body: <p>I have WPF app and I want to implement colspan and rowspan in my code. I used iText version 7 for exporting the data into PDF. However I don't know how to define colspan or rowspan for <code>Cell</code> objects. Is there any way to solve this?</p>
  
  <p>My goal is actually to create main header along with subheader in my table.</p>
  
  <p>My Output:</p>
  
  <p><img src="https://i.stack.imgur.com/JQDP3.jpg" alt="enter image description here"></p>
  
  <p>Goal Output:</p>
  
  <p><img src="https://i.stack.imgur.com/OsvWp.jpg" alt="enter image description here"></p>
  
  <p>My code below:</p>
  
  <pre><code>using iText.IO.Font.Constants;
  using iText.Kernel.Font;
  using iText.Kernel.Geom;
  using iText.Kernel.Pdf;
  using iText.Layout;
  using iText.Layout.Element;
  using Microsoft.Win32;
  using System.Diagnostics;
  using System.Windows;
  
  namespace ITextPdf.UI
  {
     public partial class MainWindow : Window
     {
        public MainWindow()
        {
           InitializeComponent();
        }
  
        private void Export_Btn(object sender, RoutedEventArgs e)
        {
           SaveFileDialog dlg = new SaveFileDialog
           {
              DefaultExt = ".pdf",
              Filter = "Adobe PDF Files(*.pdf)|*.pdf",
              FilterIndex = 1
           };
  
           string fileName = string.Empty;
  
           if (dlg.ShowDialog() == true)
           {
              fileName = dlg.FileName;
  
              PdfWriter writer = new PdfWriter(fileName);
              PdfDocument pdf = new PdfDocument(writer);
  
              PdfFont font = PdfFontFactory.CreateFont(StandardFonts.HELVETICA);
              PdfFont bold = PdfFontFactory.CreateFont(StandardFonts.HELVETICA_BOLD);
  
              Document document = new Document(pdf, PageSize.LETTER);
              document.SetMargins(20, 20, 20, 20);
              document.Add(new Paragraph("General Ledger")
                 .SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER)
                 .SetFontSize(18)
                 .SetFont(bold)
                 .SetMarginBottom(-8));
              document.Add(new Paragraph("Naawan, Misamis Oriental")
                 .SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER)
                 .SetFontSize(14)
                 .SetFont(font)
                 .SetMarginBottom(20));
  
              var table = new Table(new float[] { 80, 120, 80, 80, 80 });
              table.SetMinWidth(100)
                 .SetHorizontalAlignment(iText.Layout.Properties.HorizontalAlignment.CENTER)
                 .SetFontSize(10);
              table.AddHeaderCell("Date");
              table.AddHeaderCell("Particulars");
              table.AddHeaderCell("Debit");
              table.AddHeaderCell("Credit");
              table.AddHeaderCell("Total Amount");
              table.AddCell("1/1/17");
              table.AddCell("Beginning Balance");
              table.AddCell("100.00");
              table.AddCell("");
              table.AddCell("100.00");
              table.AddCell("");
              table.AddCell("");
              table.AddCell("");
              table.AddCell("300.00");
              table.AddCell("200.00");
  
              document.Add(table);
              document.Close();
              Process.Start(fileName);
           }
        }
     }
  }
  </code></pre>