如果如何生成PDF我们的专栏小于申报表列 [英] How to generate pdf if our column less than the declared table column

查看:82
本文介绍了如果如何生成PDF我们的专栏小于申报表列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经声明了50列的表,我通过只有40列数据。在这种情况下不PDF生成.PDF产生,只有当我通过50列数据。我怎样才能解决这个问题呢?我发现了一个函数来解决这个问题,但我忘了函数名。有人帮我...



例如:它的工作原理,

  PdfPTable表1 =新PdfPTable(50); 
的for(int i = 1; I< = 50;我++)
{
table1.DefaultCell.Horizo​​ntalAlignment = Element.ALIGN_CENTER;
table1.AddCell(新乐句(新词(100,font4)));
}



这是不工作的,

  PdfPTable表1 =新PdfPTable(50); 
的for(int i = 1; I< = 40;我++)
{
table1.DefaultCell.Horizo​​ntalAlignment = Element.ALIGN_CENTER;
table1.AddCell(新乐句(新词(100,font4)));
}


解决方案

我解决了使用这个问题 table1.CompleteRow(); 中的最后一行。在O / P是,



`



希望它可以帮助一些一...


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)));
   }

解决方案

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

`

Hope it helps some one...

这篇关于如果如何生成PDF我们的专栏小于申报表列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆