public void IngresarCampos(string concepto, string descripcion) { string html = "<html>" + " <head>" + "</head>" + "<body>" + "<table border=\"1\" width=100% bordercolor=#0859C2>" + "<tr>" + "<td >" + "<p style=\"text-align: left; font-size: 9; font-family: Arial, Helvetica, sans-serif; font-weight:bold;\"> " + concepto + "</p>" + "</td>" + "<td colspan=3 width=100% align=justify >" + "<p style=\"font-size: 8; font-family: Arial, Helvetica, sans-serif;\">" + descripcion + "</p>" + "</td>" + "</tr>" + "</table>" + "</body>" + "</html>"; foreach (IElement E in HTMLWorker.ParseToList(new StringReader(html), new StyleSheet())) { Documento.Add(E); } }
public void IngresarCampos(string concepto, List <string> abreviaciones, List <string> descripciones) { string tabla = "<table border=\"0\" width=100%>"; for (int x = 0; x < abreviaciones.Count; x++) { float aux = x % 2; if (aux == 0) { tabla += "<tr bgcolor= #FFFFCC>"; } else { tabla += "<tr bgcolor= #F3F3F3>"; } tabla += "<td>" + "<p style=\"text-align: left; font-size: 8; font-family: Arial, Helvetica, sans-serif; font-weight:bold;\">" + abreviaciones[x] + "</p>" + "</td>" + "<td colspan=4>" + "<p style=\"font-size: 8; font-family: Arial, Helvetica, sans-serif;\">" + descripciones[x] + "</p>" + "</td>" + "</tr>"; } tabla += "</table>"; string html = "<html>" + " <head>" + "</head>" + "<body>" + "<table border=\"1\" width=100%>" + "<tr>" + "<td>" + "<p style=\"text-align: left; font-size: 9; font-family: Arial, Helvetica, sans-serif; font-weight:bold;\">" + concepto + "</p>" + "</td>" + "<td colspan=3>" + tabla + "</td>" + "</tr>" + "</table>" + "</body>" + "</html>"; foreach (IElement E in HTMLWorker.ParseToList(new StringReader(html), new StyleSheet())) { Documento.Add(E); } }
public void TituloTabla(string texto, string colorEncabezado, string colorFuente) { string html = "<html>" + " <head>" + "</head>" + "<body>" + "<table border=\"1\" bgcolor= " + colorEncabezado + " width=100% bordercolor=blue>" + "<tr>" + "<td>" + "<p style=\"text-align: center; color: " + colorFuente + " ; font-family: Arial, Helvetica, sans-serif; font-size: medium; font-weight:bold;\">" + texto + "</p>" + "</td>" + "</tr>" + "</table>" + "</body>" + "</html>"; foreach (IElement E in HTMLWorker.ParseToList(new StringReader(html), new StyleSheet())) { Documento.Add(E); } }
public void EmitaRelatorio(IList <Item> listaDeItens) { Inicializa(); var tabela = new PdfPTable(new float[] { 50, 50, 50 }); tabela.DefaultCell.HasBorder(1); var celulaTitulo = new PdfPCell { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_CENTER }; celulaTitulo.AddElement(new Paragraph("LISTA DE COMPRAS")); celulaTitulo.Colspan = 3; celulaTitulo.BackgroundColor = new BaseColor(Color.LightGray); tabela.HorizontalAlignment = Element.ALIGN_CENTER; tabela.AddCell(celulaTitulo); tabela.AddCell(new Phrase("DESCRIÇÃO")); tabela.AddCell(new Phrase("QUANTIDADE")); tabela.AddCell(new Phrase("PREÇO")); foreach (var item in listaDeItens) { tabela.AddCell(item.Descricao); tabela.AddCell(item.QuantidadeMinimaPorItem.ToString()); tabela.AddCell($"R$ {item.ObtenhaPrecoFormatado()}"); } var total = listaDeItens.Sum(c => c.Preco * c.QuantidadeMinimaPorItem); tabela.AddCell("TOTAL"); tabela.DefaultCell.Colspan = 2; tabela.DefaultCell.VerticalAlignment = Element.ALIGN_LEFT; tabela.AddCell(total.ToString("R$###,##")); Documento.Add(tabela); Construa(); }