cancel
Showing results for 
Search instead for 
Did you mean: 

pagebreak while printing

Former Member
0 Kudos

Hi Experts,

I am using print fuctionatily in my application.I have totally 17 records in my table and i am printing the 13 records in

page1 and remaining 4 reocrds in page2 thorugh this below code.

int 1= wdcontext.nodetable.size();

if(i==13)

{

Pagebreak;

}

In development i have maximum 17 records and i dont know how many reocrds are there in production .Now i need to change my code to for every 13 records i want pagebreak.For ex if table have 60records than every 13 record and 26 record and 43 record i need page break.

Could any one help me out..

Regards,

Suresh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI Suresh,

Use this code.Hope it sholud work..

if(i>=13)

{

if(i%13==0)

{

htmlString = htmlString +"</table><hr>";

pagebreak;

}

}

else

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi suresh,

Use this code, this will solve ur problem.

int j = 0;

for(int i=0;i<wdContext.node().size();i++)

{

j++;

if(j==13)

{

pagebreak;

j=0;

}

}

Regards,

Sunaina Reddy T

Former Member
0 Kudos

hi

check this blog to print the table records

/people/ritushree.saha/blog/2009/07/02/webdynpro-java-printing-using-nw-2004-2004s

make the reference with the code present inthe blog and make the changes in the code with your requirement.

Thanks

Former Member
0 Kudos

Hi suresh,

This code will solve your problem,

int j = 0;

for(int i=0;i<wdContext.node().size();i++)

{

j++;

if(j==13)

{

pagebreak;

j=0;

}

}

Regards,

Sunaina Reddy T

Former Member
0 Kudos

for(int i=0;i<wdContext.node().size();i++) {
  if ( (i%13)==0) {
      pagebreak;
  }
}
Former Member
0 Kudos

Hi,

It seems you can print only 13 lines in a page. so what you can do is break the page after every 13th record like below

int j = 0;

for(int i=0;i<wdContext.node().size();i++)

{

if(i==j+13) //here j value is 0, so for first time page breaks when i=13

{

pagebreak;

j = i ; // here when j is made 13, so second pagebreaks at i = 13+13

}

}

Regards

Raghu

Former Member
0 Kudos

HI Raghu,

Thanks for reply.

I have used your code but i am not getting output prefectly.first 13 records are displaying in page1 but the remaining 3 records are displaying in separate pages like 14th reocrd in page2 and 15th record in page3 like that.

Regards,

Suresh

Former Member
0 Kudos

Hi,

It should work, can u pls post the code which you have implemented.

Regards

Raghu

Former Member
0 Kudos

Hi Raghu,

This is the code i have used but its not working

if(i>13)

{

int j=0;

for(int n=0;n<i;n++)

{

if(n==j+13)

{

htmlString = htmlString +"</table><hr>"

pagebreak;

j=n;

} //If condition

} //loop

}//

else

{

"page";;

}

Regards,

Suresh

Edited by: suresh111 on Jul 22, 2009 12:14 PM

Edited by: suresh111 on Jul 22, 2009 12:15 PM

former_member197348
Active Contributor
0 Kudos

Hi Suresh,

Try this code.

if(i>13)
{
int j=13;
for(int n=0;n<i;n++)
{
if(n==j)
{
htmlString = htmlString +"</table><hr>"
pagebreak;
j=j+13;
} //If condition
} //loop

}//
else
{
"page";;
}

Regards,

Siva