| |

VerySource

 Forgot password?
 Register
Search
Author: hakulee

How to control excel pagination?

[Copy link]

0

Threads

7

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-4-6 17:00:01
| Show all posts
Program control, if the count exceeds 40, it will change the page
Reply

Use magic Report

1

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-4-6 21:00:02
| Show all posts
〉petwolf007
Program control, change the page if the count exceeds 40,
I just want to know how to realize the page change?
Reply

Use magic Report

1

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-4-7 06:45:01
| Show all posts
For example, each paper can display 50 records, I only want to display 40 records, how to control,
If the count exceeds a multiple of 40, the page is changed. In theory, this is the case. How is the key achieved?
Reply

Use magic Report

0

Threads

63

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-4-9 06:15:01
| Show all posts
HSSFWorkbook workbook = new HSSFWorkbook ();
    HSSFSheet sheet = workbook.createSheet ();
    sheet.setAutobreaks (false);
    for (int i = 0; i <300; i ++) {
      HSSFRow row = sheet.createRow (i);
      row.createCell ((short) 0) .setCellValue (i);
      if (i% 40 == 0) {
        sheet.setRowBreak (i);
      }
    }
    
    workbook.write (new FileOutputStream ("D: /test.xls"));

But if it can't be displayed (such as setting a page change every 200 lines), excel will still automatically change the page (the blue dotted line is automatic during preview, the solid line is manual)
Reply

Use magic Report

0

Threads

63

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-4-9 10:30:01
| Show all posts
If you have other printing needs, please refer to HSSFPrintSetup
sheet.getPrintSetup ()
Reply

Use magic Report

1

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-4-10 13:30:01
| Show all posts
Okay, thank you. Is it sheet.setRowBreak (i) that implements page changes? ?
I give it a try!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 09:00:01
| Show all posts
Following...
Encountered the same problem.
Has the host solved it?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-4 10:45:01
| Show all posts
It’s not easy. I struggled for three days before I found the real paging method.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list