Jump to content

[Resolvido] como personalizar e custumizar um PDF quando gerado pelo c# utilizando o itextsharp


Pipo01
 Share

Recommended Posts

boas 馃檪

gostava de saber se alguem me podia dar ajudas e ideias e exemplos de codigo para personlizar o meu pdf sff

aqui esta um foto de como esta ele agora

http://www.4shared.com/photo/CSpspVXQba/1__6_.html

aqui esta o codigo que desenvolvi

 FileStream tix = new FileStream(@".\\Relat贸rio.pdf", FileMode.Create);
Document documento = new Document(PageSize.A4, 25, 25, 30, 30);
PdfWriter escrever = PdfWriter.GetInstance(documento, tix);
documento.Open();
PdfPTable tabela = new PdfPTable(dataGridView1.Columns.Count);
//adiciona cabe莽alhos do datagridview para a tabela
for (int j = 0; j < dataGridView1.Columns.Count; j++)
{
tabela.AddCell(new Phrase(dataGridView1.Columns[j].HeaderText));
}

//define a primeira linha como cabe莽alho
tabela.HeaderRows = 1;

//adiciona as linhas atuais do datagridview para a tabela
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
for (int k = 0; k < dataGridView1.Columns.Count; k++)
{
if (dataGridView1[k, i].Value != null)
{
tabela.AddCell(new Phrase(dataGridView1[k, i].Value.ToString()));
}
}
}

documento.Add(tabela);

System.Diagnostics.Process.Start(@".\\Relat贸rio.pdf");


documento.Close();
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.