Good afternoon I have not been able to find a solution for days, and I would like your help, I am putting together an MVC report with ItextSharp and I am not able to do a layout of a receipt if someone can help me in HTML I thank you.
Myviewlookslikethis:
WhatIwasabletodowasinitextSharp:
Thereport'scodeis:
float[]colsW={50,10,20,10};table.SetWidths(colsW);table.HeaderRows=1;table.WidthPercentage=100f;table.DefaultCell.Border=PdfPCell.BOTTOM_BORDER;table.DefaultCell.BorderColor=preto;table.DefaultCell.BorderColorBottom=newBaseColor(255,255,255);table.DefaultCell.Padding=10;doc.Add(newParagraph(" ", titulo2));
//PdfPCell cell = new PdfPCell(new Phrase("Itens do Orçamento", titulo2));
//cell.Colspan = 5;
//cell.HorizontalAlignment = 0;
//cell.Border = 0;
doc.Add(new Paragraph(" ", titulo));
table.AddCell(getNewCell("Descrição dos produtos / serviços ", titulo, Element.ALIGN_CENTER, 5, PdfPCell.BOTTOM_BORDER, preto, fundo));
table.AddCell(getNewCell("Quantidade", titulo, Element.ALIGN_CENTER, 5, PdfPCell.BOTTOM_BORDER, preto, fundo));
table.AddCell(getNewCell("Valor Unitário.", titulo, Element.ALIGN_CENTER, 5, PdfPCell.BOTTOM_BORDER, preto, fundo));
table.AddCell(getNewCell("Valor Total", titulo, Element.ALIGN_CENTER, 5, PdfPCell.BOTTOM_BORDER, preto, fundo));
#endregion
table.AddCell(getNewCell(dadosContrato.Contrato.DadosDoServico, font, Element.ALIGN_LEFT, 5, PdfPCell.BOTTOM_BORDER));
table.AddCell(getNewCell(dadosContrato.Contrato.Quantidade, font, Element.ALIGN_CENTER, 3, PdfPCell.BOTTOM_BORDER));
table.AddCell(getNewCell(dadosContrato.Contrato.ValorUnitario, font, Element.ALIGN_CENTER, 3, PdfPCell.BOTTOM_BORDER));
table.AddCell(getNewCell(dadosContrato.Contrato.ValorTotal, font, Element.ALIGN_CENTER, 3, PdfPCell.BOTTOM_BORDER));
doc.Add(table);
Paragraph pi3 = new Paragraph("Total Geral: R$ " + dadosContrato.Contrato.ValorTotal, titulo2);
pi3.Alignment = Element.ALIGN_RIGHT;
doc.Add(pi3);
My Rule:
protected PdfPCell getNewCell(string Texto, Font Fonte, int Alinhamento, float Espacamento, int Borda, BaseColor CorBorda)
{
return getNewCell(Texto, Fonte, Alinhamento, Espacamento, Borda, CorBorda, new BaseColor(255, 255, 255));
}
protected PdfPCell getNewCell(string Texto, Font Fonte, int Alinhamento = 0, float Espacamento = 5, int Borda = 0)
{
return getNewCell(Texto, Fonte, Alinhamento, Espacamento, Borda, new BaseColor(0, 0, 0), new BaseColor(255, 255, 255));
}
}
If you can help me, I can thank you!