TableColumnRowCountPDF.java Source code

Java tutorial

Introduction

Here is the source code for TableColumnRowCountPDF.java

Source

import java.io.FileOutputStream;
import java.io.IOException;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Table;
import com.lowagie.text.pdf.PdfWriter;

public class TableColumnRowCountPDF {
    public static void main(String[] args) {
        Document document = new Document();
        try {
            PdfWriter.getInstance(document, new FileOutputStream("TableColumnRowCountPDF.pdf"));
            document.open();

            Table table = new Table(2, 2); // 2 rows, 2 columns
            table.addCell("0.0");
            table.addCell("0.1");
            table.addCell("1.0");
            table.addCell("1.1");
            document.add(table);
        } catch (Exception e) {
            System.err.println(e.getMessage());
        }
        document.close();
    }
}