pdf dosyasına tablo oluştur — Csharp

pdf dosyasına tablo oluştur — Csharp

Not: Pdf yi C anadizini içine gorsel.pdf olarak oluşturuyor.

pdf_tablo

[code lang=”csharp”]

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;//www.gorselprogramlama.com
using System.Windows.Forms;
using iTextSharp.text.pdf;
using iTextSharp.text;
using System.IO;
using System.Data.OleDb;
using System.Drawing.Text;
namespace pdf_aktar
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void btnTablo_Click(object sender, EventArgs e)
{
iTextSharp.text.Document document = new iTextSharp.text.Document();
PdfWriter.GetInstance(document, new FileStream(@"C:\gorsel.pdf", FileMode.Create));
PdfPTable table = new PdfPTable(3);
PdfPCell cell = new PdfPCell(new Phrase(" —– Tablo ——"));
cell.Colspan = 3;
cell.HorizontalAlignment = 1; //0=Sola, 1=Orta, 2=sağ
table.AddCell(cell);
table.AddCell("Kolon 1 Satır 1");
table.AddCell("Kolon 2 Satır 1");
table.AddCell("Kolon 3 Satır 1");
table.AddCell("Kolon 1 Satır 2");
table.AddCell("Kolon 2 Satır 2");
table.AddCell("Kolon 3 Satır 2");
document.Open();
document.Add(table);
document.Close();
}

}//www.gorselprogramlama.com
}

[/code]

pdf_tablo2

pdf_tablo3

Projeyi İNDİR

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir