Here I am reading the data from database and displaying data into the table.
Here is the code what am I doing:

     Table table = new Table(9);

      table.setWidth(100);
      int headerwidths[] = { 30, 4, 9, 9, 9, 10, 10, 10, 5}; // percentage

      table.setWidths(headerwidths);
      table.setPadding(2);
      //table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);


      table.addCell("A. Course Organization and Planning Think about each
practice as it contributed to your learning in this course");
      table.addCell("Omit");
      table.addCell("   Not    Available");
      table.addCell("   5             Very         Effective");
      table.addCell("   4      Effective");
      table.addCell("   3        Moderative     Effective");
      table.addCell("   2        Somewhat   Effective");
      table.addCell("   1      Ineffective");
      table.addCell("Mean");


    PreparedStatement stmt = con.prepareStatement(SQLSTRCLASSREPORT);
      ResultSet rs = null;

      stmt.setInt(1, 2222);


      rs = stmt.executeQuery();

      int i = 10;
      while(rs.next())
      {
          System.out.println("i=="+i);
              switch(i)
              {

              case 10 : table.addCell("1.The instructor's explanation of
course requirements...");
                        break;
              case 19 : table.addCell("2.The instructor's preparation for
each class period...");
                        break;
              case 28 : table.addCell("3.The instructor's command of the
subject matter...");
                          break;
              case 37 : table.addCell("4.The instructor's use of class
time...");
                        break;
              case 46 : table.addCell("5.The instructor's way of summarizing
or emphasizing important points in class...");
                          break;
              default: table.addCell(" ");
                         break;

              }

              System.out.println("rs.getString(3)=="+rs.getString(3));
              System.out.println("rs.getString(5)=="+rs.getString(5));

              if(rs.getString(3).equals("1") || rs.getString(3).equals("2")
|| rs.getString(3).equals("3") || rs.getString(3).equals("4") ||
rs.getString(3).equals("5"))
              {
                     table.addCell(rs.getString(5).trim());
              }

              i++;
      }

      table.setConvert2pdfptable(true);

Here I am able to set the values in cells but the values are skipping cell
to cell. Please find the attached file format that I am getting.

Could any one can tell where is the problem.

Regards,
Sumanth

Attachment: sir.pdf
Description: Adobe PDF document

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to