Delete columns : Table Column « PDF « Java Tutorial






import java.awt.Point;
import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Table;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;

public class MainClass {
  public static void main(String[] args) throws Exception {
    Document document = new Document();
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();

    Table table = new Table(2, 2);
    table.setAlignment(Element.ALIGN_LEFT);
    table.setAutoFillEmptyCells(true);
    table.addCell("0.0");
    table.addColumns(2);
    float[] f = { 2f, 1f, 1f, 1f };
    table.setWidths(f);
    table.addCell("2.2", new Point(2, 2));
    table.deleteColumn(2);
    table.setConvert2pdfptable(true);
    document.add(table);
    document.close();
  }
}








29.56.Table Column
29.56.1.Set Column span
29.56.2.Table Column Widths
29.56.3.Table with Absolute Columns Width
29.56.4.Table header with column span
29.56.5.Delete columns
29.56.6.Create Table and set total width