2010-03-03 8 views
1

작동하지 않습니다itextsharp : ROWSPAN 내가 ROWSPAN 몇 가지 문제가

var doc1 = new Document(); 
     doc1.SetPageSize(PageSize.A4.Rotate()); 
     string path = Server.MapPath("PDFs"); 
     PdfWriter.GetInstance(doc1, new FileStream(path + "/Doc1.pdf", FileMode.Create)); 
     doc1.Open(); 
     PdfPTable table = new PdfPTable(17); 
     PdfPCell cell = new PdfPCell(new Phrase("Missioni aggregato per macro causali")); 
     cell.Colspan = 17; 
     cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right 
     table.AddCell(cell); 
     cell = new PdfPCell(new Phrase("Matricola")); 
     cell.Rowspan = 2; 
     cell.Rotation = 90; 
     table.AddCell(cell); 

     cell = new PdfPCell(new Phrase("Nominativo")); 
     cell.Rowspan = 2; 
     table.AddCell(cell); 

     cell = new PdfPCell(new Phrase("Assegnazione"));    
     cell.Colspan = 2; 
     table.AddCell(cell);    

     cell = new PdfPCell(new Phrase("Riepilogo missioni valori dal ")); 
     cell.Colspan = 13; 
     cell.Rowspan = 2; 
     table.AddCell(cell); 

     cell = new PdfPCell(new Phrase("Struttura"));    
     table.AddCell(cell); 

     cell = new PdfPCell(new Phrase("Ufficio")); 
     table.AddCell(cell); 

셀 "Riepilogo missioni의 valori의 DAL은"동일한 "struttura"셀의 행과 셀은 "UFFICIO" 이유는 무엇입니까?

어떻게하면됩니까?

감사

+0

나는 iTextSharp 7에서 테스트하고 그것을 작동 – JosefMadrid

답변

3

휴대 "Riepilogo의 missioni의 valori의 DAL"은 13 컬럼에 걸쳐있다. PdfPTable은 17 열의 다음 행으로 이동하기 전에 현재 행의 끝에있는 나머지 열 (4)을 채워야합니다.

행 끝을 채우려면 4 개의 빈 셀을 추가하거나 CompleteRow 메서드를 사용합니다.

table.AddCell("") 
table.AddCell("") 
table.AddCell("") 
table.AddCell("") 

또는

table.CompleteRow() 
관련 문제