private List <RolesInforme> llenarRolesInforme() { List <RolesInforme> rolesInforme = new List <RolesInforme>(); RolesInforme objRolesInforme = new RolesInforme(); if (!string.IsNullOrEmpty(txtNombre1.Text) || !string.IsNullOrEmpty(txtCargo1.Text)) { objRolesInforme.NombreParticipante = txtNombre1.Text; objRolesInforme.Rol = txtCargo1.Text; objRolesInforme.Fecha = txtCalendar1.Text.ToString(); rolesInforme.Add(objRolesInforme); } if (!string.IsNullOrEmpty(txtNombre2.Text) || !string.IsNullOrEmpty(txtCargo2.Text)) { objRolesInforme = new RolesInforme(); objRolesInforme.NombreParticipante = txtNombre2.Text; objRolesInforme.Rol = txtCargo2.Text; objRolesInforme.Fecha = txtCalendar2.Text.ToString(); rolesInforme.Add(objRolesInforme); } if (!string.IsNullOrEmpty(txtNombre3.Text) || !string.IsNullOrEmpty(txtCargo3.Text)) { objRolesInforme = new RolesInforme(); objRolesInforme.NombreParticipante = txtNombre3.Text; objRolesInforme.Rol = txtCargo3.Text; objRolesInforme.Fecha = txtCalendar3.Text.ToString(); rolesInforme.Add(objRolesInforme); } if (!string.IsNullOrEmpty(txtNombre4.Text) || !string.IsNullOrEmpty(txtCargo4.Text)) { objRolesInforme = new RolesInforme(); objRolesInforme.NombreParticipante = txtNombre4.Text; objRolesInforme.Rol = txtCargo4.Text; objRolesInforme.Fecha = txtCalendar4.Text.ToString(); rolesInforme.Add(objRolesInforme); } if (!string.IsNullOrEmpty(txtNombre5.Text) || !string.IsNullOrEmpty(txtCargo5.Text)) { objRolesInforme = new RolesInforme(); objRolesInforme.NombreParticipante = txtNombre5.Text; objRolesInforme.Rol = txtCargo5.Text; objRolesInforme.Fecha = txtCalendar5.Text.ToString(); rolesInforme.Add(objRolesInforme); } return(rolesInforme); }
private void ingresarEquipoTrabajo(DocX doc, List <RolesInforme> rolesInforme) { // Titulo Equipo de Trabajo: doc.InsertParagraph(); doc.InsertParagraph(); doc.InsertParagraph(); var equipoTrabajoFormat = new Novacode.Formatting(); equipoTrabajoFormat.FontFamily = new System.Drawing.FontFamily("Calibri"); equipoTrabajoFormat.Size = 12D; equipoTrabajoFormat.Bold = true; Paragraph pTit = doc.InsertParagraph("Equipo de Trabajo", false, equipoTrabajoFormat); pTit.Alignment = Alignment.center; doc.InsertParagraph(); doc.InsertParagraph(); doc.InsertParagraph(); Table tab = doc.AddTable(rolesInforme.Count + 1, 3); tab.AutoFit = AutoFit.Window; tab.Alignment = Alignment.center; tab.Design = TableDesign.ColorfulGridAccent1; tab.Rows[0].Cells[0].Paragraphs.First().Append("Nombre"); tab.Rows[0].Cells[0].Paragraphs.First().Alignment = Alignment.center; tab.Rows[0].Cells[0].Paragraphs.First().Bold(); tab.Rows[0].Cells[1].Paragraphs.First().Append("Cargo/Rol"); tab.Rows[0].Cells[1].Paragraphs.First().Alignment = Alignment.center; tab.Rows[0].Cells[1].Paragraphs.First().Bold(); tab.Rows[0].Cells[2].Paragraphs.First().Append("Fecha"); tab.Rows[0].Cells[2].Paragraphs.First().Alignment = Alignment.center; tab.Rows[0].Cells[2].Paragraphs.First().Bold(); for (int i = 0; i < rolesInforme.Count; i++) { RolesInforme rolInforme = rolesInforme[i]; tab.Rows[i + 1].Cells[0].Paragraphs.First().Append(rolInforme.NombreParticipante); tab.Rows[i + 1].Cells[1].Paragraphs.First().Append(rolInforme.Rol); tab.Rows[i + 1].Cells[2].Paragraphs.First().Append(rolInforme.Fecha); } doc.InsertTable(tab); }