Back to Blog

Page Break Strategies for Long Salesforce Reports

Page Break Strategies for Long Salesforce Reports

Learn how to control page breaks in complex Salesforce documents, keeping sections together, forcing breaks between groups, and preventing orphaned headers in long reports.

ZeroExport Team

Page breaks are where most document generation tools reveal their limits.

A short invoice or a two-page contract rarely has page break problems. A 40-page portfolio review, a 60-page loan application package, or a compliance report with variable-length sections; these documents expose every assumption baked into a template.

Uncontrolled page breaks leave section headers stranded at the bottom of a page. Tables split awkwardly mid-row. A four-line disclosure ends up alone on its own page. The document looks unprofessional regardless of the underlying data quality.

This article covers specific page break strategies for long Salesforce documents, with a focus on reports that contain grouped sections, repeating tables, and conditional content.

Why Page Breaks Are Hard in Data-Driven Documents

Static documents are easy to paginate; you control every element manually. Data-driven documents are different. The content of each section depends on live Salesforce data, so you cannot know the exact page count at template design time.

Three things make page break management difficult:

  1. Variable section height - A client with 12 holdings has a much longer section than a client with 2 holdings. The same template produces different page counts for different records.

  2. Conditional sections - When sections appear or disappear based on data, the page flow changes. A section that keeps content together in one scenario may cause a stranded header in another.

  3. Table row splitting - Long tables can split across pages. Whether a row splits mid-content depends on how much space remains on the current page at render time.

Strategy 1: Keep Sections Together

The most common requirement is preventing a section header from appearing at the bottom of a page while its content flows to the next.

In ZeroExport, configure Keep Together on any section block that should not be split across pages. When the remaining space on the current page is insufficient to start the section, the section moves to the next page in its entirety.

Use this for:

  • Group headers and their first few rows
  • Short disclosure blocks (2–5 lines)
  • Summary blocks that follow a table

When not to use it: Do not apply Keep Together to large sections. If a section is taller than one full page, the Keep Together constraint cannot be satisfied and will be ignored anyway. Use it for sections you know will fit within a single page.

Strategy 2: Force Page Breaks Before Group Sections

For reports with multiple large groups - for example, a portfolio statement with Equity, Fixed Income, Alternatives, and Cash sections - each group typically starts on its own page.

In ZeroExport, add a Page Break Before to the repeating group section. This forces a new page at the start of each group, regardless of how much space remains on the previous page.

This gives the document a consistent rhythm: one group per page spread, with predictable section starts.

Use this for:

  • Portfolio sections per asset class
  • Insurance coverage sections per rider type
  • Proposal sections per product line
  • Compliance sections per regulatory domain

Trade-off: If some groups are very short (one or two rows), they will still start on their own page, which may waste space. Consider using page breaks conditionally, only when a group exceeds a minimum row count.

Strategy 3: Prevent Table Row Splitting

By default, a table row that does not fit at the bottom of a page will split; part of the row renders on the current page, the remainder on the next. For most business documents this produces unacceptable output.

Enable Prevent Row Split on tables where this matters. Each row will be kept intact, moving to the next page as a unit if it does not fit in the remaining space.

Use this for:

  • Holdings tables where each row contains multiple sub-lines of information
  • Loan applicant tables with contact and asset details in one row
  • Product configuration tables with nested component rows

Performance note: Preventing row splits on very large tables (200+ rows) increases rendering time because each row height must be calculated before pagination decisions are made. This is typically acceptable for business reports but worth noting for very large data sets.

Strategy 4: Repeating Headers on Multi-Page Tables

When a table spans multiple pages, column headers should repeat at the top of each page. Without repeating headers, a reader on page 4 of a long table has no reference for what each column means.

Configure Repeat Header on any table that is likely to span more than one page. ZeroExport renders the header row at the top of each new page the table flows onto.

This is essential for:

  • Holdings tables in portfolio statements
  • Transaction history tables
  • Line item tables in loan packages
  • Schedule of values in construction documents

Strategy 5: Balance Short Orphaned Sections

When conditional sections make the document shorter in some scenarios, you may end up with a final page that contains very little content. A page with two lines of text followed by a footer looks incomplete.

For short content at the end of a document, use Minimum Page Fill rules to decide whether orphaned content should be pulled back to the previous page or allowed to stand on its own.

In practice, the most effective strategy is to design closing sections (terms and conditions, signature blocks, cover summary) with a fixed height that fills the final page, regardless of the variable content above it.

Strategy 6: Section-Level Page Numbering

For multi-section documents, readers often need to reference a specific section. Total page numbering (Page 12 of 47) is not always sufficient; a section-specific page number (Page 3 of 7 in Equity Holdings) is more useful.

Configure Section Page Numbers to restart the counter at each group boundary. Place the section page number in the footer bound to the current group context.

This produces output like: Equity Holdings - Page 2 of 4 in the footer, with the counter resetting when the Fixed Income section begins.

Putting It Together: Page Break Configuration for a Portfolio Statement

For a typical 30–50 page portfolio statement, combine these strategies:

ElementStrategy
Group section (Asset Class)Page Break Before
Group header + first holdings rowKeep Together
Holdings table rowsPrevent Row Split
Holdings table column headersRepeat Header
Short disclosures at group endKeep Together
Final terms sectionFixed-height fill
FooterSection page numbering

FAQ

What happens if a section is too tall for Keep Together to work?

If a section's height exceeds the page height, the Keep Together constraint cannot be satisfied. ZeroExport falls back to the default page flow for that section. For sections this large, use Page Break Before instead.

Can I use page break strategies with conditional sections?

Yes. Page break configuration applies to sections at render time, after conditional logic has already determined which sections are included. A section that is excluded by a condition does not trigger a page break.

Does Repeat Header work on nested tables inside repeating sections?

Yes. Tables nested inside repeating group sections can independently configure Repeat Header. Each table carries its own header configuration.

Can I suppress a Page Break Before for the first group in a list?

Yes. Configure the Page Break Before to skip the first occurrence of a repeating section. This prevents an unnecessary blank page at the start of the document.

Related Reading

Ready to try ZeroExport?

Start generating documents directly in your Salesforce org. No integrations, no setup overhead, no complexity.