2017-03-17 1 views
2

제목과 마찬가지로 iTextSharp를 사용하여 보고서를 생성합니다. 두 테이블 사이에 공백을 추가하고 싶지만 어떻게해야할지 모르겠다. 당신은 테이블에 SpacingBefore 또는 SpacingAfter을 사용할 수 있습니다iTextSharp의 두 테이블 사이에 공백 추가

var boldFont = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 12); 
PdfPTable table1 = new PdfPTable(2); 
table1.WidthPercentage = 25; 
table1.HorizontalAlignment = Element.ALIGN_LEFT; 
table1.AddCell(new PdfPCell(new Paragraph("Factura No: "))); 
table1.AddCell(new PdfPCell(new Paragraph("#1"))); 
table1.AddCell(new PdfPCell(new Paragraph("Tipo Fact: "))); 
table1.AddCell(new PdfPCell(new Paragraph("Contado"))); 
table1.AddCell(new PdfPCell(new Paragraph("Fecha: "))); 
table1.AddCell(new PdfPCell(new Paragraph("3/17/2017"))); 
table1.AddCell(new PdfPCell(new Paragraph("Cedula: "))); 
table1.AddCell(new PdfPCell(new Paragraph("207080801"))); 
table1.AddCell(new PdfPCell(new Paragraph("Cliente: "))); 
table1.AddCell(new PdfPCell(new Paragraph("Errol"))); 

//add space here   
PdfPTable table2 = new PdfPTable(3); 
table2.HorizontalAlignment = 1; 
table2.WidthPercentage = 70; 
table2.AddCell(new PdfPCell(new Paragraph("Producto", boldFont))); 
table2.AddCell(new PdfPCell(new Paragraph("Cantidad", boldFont))); 
table2.AddCell(new PdfPCell(new Paragraph("Subtotal", boldFont))); 
table2.AddCell(new PdfPCell(new Paragraph("PDN130"))); 
table2.AddCell(new PdfPCell(new Paragraph("2"))); 
table2.AddCell(new PdfPCell(new Paragraph("18000"))); 

답변

1

:

내 코드입니다.
다음과 같이 시도하십시오.

table1.SpacingBefore = 10f; 
table1.SpacingAfter = 12.5f; 
table2.SpacingBefore = 10f; 
table2.SpacingAfter = 12.5f; 
+0

위대한! 이것은 내가 필요로 한 것, 덕분이다 –

+0

그것을 듣기 위해 기쁜! –