TX Sheet Control

Page Layout and Print Settings

Topic

Before a worksheet becomes pages, its print settings decide the paper, orientation, margins, print area, scaling and headers and footers. Screen zoom, frozen panes and the size of the browser host do not replace those settings.

You set them in code or on the Page Layout tab of the ribbon, add page fields to headers and footers and check the result in Page Layout view before you export.

Edit Page Setup in the Dialog

Open the Page Setup launcher on the Page Layout ribbon tab. The dialog shares the fixed frame, exclusive accordion sections and persistent actions of the other settings dialogs. Its right Live Preview shows the draft paper and margin boundary while you edit:

SectionSettings
PagePaper size, custom dimensions, orientation, scale and fit-to-pages options
MarginsTop, bottom, left and right margins in millimeters
Header & FooterHeader and footer margins, first-page and odd/even variations, scaling and alignment
SheetPrint area, page order, gridlines and row and column headings

Page Setup with the Sheet section open, print area and page-order fields and a right paper-and-margins preview

Opening a section closes the previous section without changing the dialog's size. Use Apply Page Setup to save the draft or Cancel to discard it. Edit header and footer text through Header & Footer in Page Layout view; the paper preview does not replace a review of the paginated worksheet.

Configure the Print Settings

The following code prepares the first worksheet as a landscape A4 report. editor is the Spreadsheet of the browser editor:

const sheet = editor.workbook.sheets.at(0);
sheet.print.configure({
    page: { size: 'A4', orientation: 'landscape' },
    margins: { unit: 'mm', left: 12, right: 12, top: 12, bottom: 12 },
    area: 'A1:H60', gridlines: false,
    fitToPage: true, fitToWidth: 1, fitToHeight: 0,
    footer: { center: 'Page &P of &N' }
});

The code works as follows:

  • Worksheet.print returns the print settings of the worksheet, a SheetPrint. SheetPrint.configure applies the page size, margins, print area and header and footer settings.
  • page selects the paper size A4 in landscape orientation.
  • margins sets all four margins to 12 in the unit mm.
  • area sets the print area to A1:H60, and gridlines: false prints no gridlines.
  • fitToPage with fitToWidth: 1 and fitToHeight: 0 fits the print area to one page wide, with an automatic height.
  • footer puts the text Page &P of &N, the page number and the page count, into the center section of the footer.

Use explicit measurement units. Print geometry can be configured with physical units, while drawing anchors use CSS pixels. Fit-to-width with automatic height is different from forcing an entire long table onto one page.

In .NET, the counterpart is sheet.Print.ConfigureAsync(...): Worksheet.Print returns the SheetPrint of a worksheet, and SheetPrint.ConfigureAsync applies the settings. The PDF save settings provide output-specific context.

Automatic Print Area

When no explicit print area is set, TX Sheet Control calculates the printable extent from worksheet content, distinct cell fills and patterns, borders, merged cells and document objects. The Normal style's background and backgrounds covering entire rows or columns remain visible without extending the output through otherwise unused cells. This keeps imported template backgrounds from creating extra PDF pages.

An explicit Print Area remains authoritative, including intentionally empty regions. Existing paper size, margins, scale and fit-to-page settings still determine where the content continues onto the next page. Use Fit to Width with automatic height to retain readable text across multiple pages, or set both dimensions when the report should fit on one page.

Inspect the Page Before Export

Switch to Page Layout view to see the relationship between the worksheet content and its printed page:

Sales report in Page Layout view with its paper boundary and worksheet content, the eight-column sales table below the Page Layout tab of the ribbon

In this example, a landscape page and a defined print area keep the eight-column sales table together. Check that totals and objects are inside the intended page area before you export.

Add Headers, Footers and Page Fields

Headers and footers take field codes. The supported field codes include:

Field codeInserts
&PThe page number
&NThe page count
&DThe date
&TThe time
&AThe sheet
&FThe file name
&ZThe path
&&A literal ampersand

&L, &C and &R select sections. HeaderFooterSettings lists these codes.

Configure a PrintContext for the file-related fields and fixed locale, time zone and date values when reproducibility matters. Odd, even and first-page variations have dedicated settings where supported, such as differentOddEven and differentFirst.

Review the Pagination Before Delivery

Page Layout view helps you review the pagination. Before delivery, verify:

  • the full print area,
  • the page breaks,
  • repeated and continued content,
  • chart dimensions,
  • font-dependent wrapping.

A blank-looking extra page may result from an oversized print area or from an object outside the intended region.

Next Steps