How to generate pdf if our column less than the declared table column

谁说胖子不能爱 提交于 2019-12-20 07:35:55

问题


I have declared a table with 50 columns and I pass only 40 column data. In this case pdf not generates .Pdf generates, only if I pass 50 column data. how can I solve this issue? I found a function to solve this problem but I forget that function name. Anybody help me...

eg: it works,

 PdfPTable table1 = new PdfPTable(50);
 for (int i = 1; i <=50; i++)
   {
      table1.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
      table1.AddCell(new Phrase(new Phrase("100", font4)));
  }

which is not working is,

PdfPTable table1 = new PdfPTable(50);
for (int i = 1; i <=40; i++)
   {
      table1.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
      table1.AddCell(new Phrase(new Phrase("100", font4)));
   }

回答1:


I solved this problem using table1.CompleteRow(); in the last line. The o/p is,

`

Hope it helps some one...



来源:https://stackoverflow.com/questions/31448592/how-to-generate-pdf-if-our-column-less-than-the-declared-table-column

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!