//Recupero dati cliente DataTable GetCliItems() { try { con.ConnectionString = "server=localhost;User Id=root;password=*****;database=******"; //con.Open(); //query per la visualizzazione di tutti i clienti string query = "select nome, cognome, indirizzo, telefono, cellulare, referente, note from clienti where rif_agente ='" + comboBox1.Text + "'"; //adapter per eseguire la query adapter = new MySqlDataAdapter(query, con); DataSet DS = new DataSet(); //restituisce il risultato della query nel dataset adapter.Fill(DS); return DS.Tables[0]; } catch (Exception ex) { MessageBox.Show("Errore durante il recupero delle informazioni.\n\n" + ex.Message, "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { con.Close(); } return null; }//this is the table //Costruzione della tabella con i valori riga tramite array di celle PdfPTable tabellaCliente = new PdfPTable(7); tabellaCliente.WidthPercentage = 100;//Retrieve data from dataTable for (int i = 0; i < DTCliAg.Rows.Count; i++) { string nome = DTCliAg.Rows[i]["nome"].ToString(); string cognome = DTCliAg.Rows[i]["cognome"].ToString(); string indirizzo = DTCliAg.Rows[i]["indirizzo"].ToString(); string telefono = DTCliAg.Rows[i]["telefono"].ToString(); string cellulare = DTCliAg.Rows[i]["cellulare"].ToString(); string referente = DTCliAg.Rows[i]["referente"].ToString(); string note = DTCliAg.Rows[i]["note"].ToString(); PdfPCell[] cellsCli = new PdfPCell[] { new PdfPCell(new Phrase(nome,fontStampaTable)), new PdfPCell(new Phrase(cognome,fontStampaTable)), new PdfPCell(new Phrase(indirizzo,fontStampaTable)), new PdfPCell(new Phrase(telefono,fontStampaTable)), new PdfPCell(new Phrase(cellulare,fontStampaTable)), new PdfPCell(new Phrase(referente,fontStampaTable)), new PdfPCell(new Phrase(note,fontStampaTable))}; for (int j = 0; j < 7; j++) { cellsCli[j].HorizontalAlignment = 0; cellsCli[j].PaddingBottom = 3f; cellsCli[j].Border = 0; } PdfPRow rowCli = new PdfPRow(cellsCli); tabellaCliente.Rows.Add(rowCli);
PdfPTable tabellaCliente = new PdfPTable(7);
cellsCli[i]=new PdfPCell[]{....
PdfPTable tabellaCliente = new PdfPTable(7); tabellaCliente.WidthPercentage = 100;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)