engine

package
v0.0.0-...-83b8ea0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package engine is part of the go-fastreport library, a pure Go port of FastReport .NET.

Package engine implements the go-fastreport report engine. It drives report execution: initialising data sources, iterating bands, and producing a stream of prepared pages ready for export.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EngineState

type EngineState int

EngineState identifies a lifecycle event emitted by the report engine.

const (
	EngineStateReportStarted     EngineState = iota
	EngineStateReportFinished                // end of the whole report
	EngineStateReportPageStarted             // start of a report page template
	EngineStateReportPageFinished
	EngineStatePageStarted   // start of a physical page
	EngineStatePageFinished  // end of a physical page
	EngineStateColumnStarted // start of a column
	EngineStateColumnFinished
	EngineStateBlockStarted  // start of a data block
	EngineStateBlockFinished // end of a data block
	EngineStateGroupStarted
	EngineStateGroupFinished
)

type EngineStateHandler

type EngineStateHandler func(sender any, state EngineState)

EngineStateHandler is a callback invoked when an EngineState event fires. sender is the engine object that triggered the state change (e.g. a BandBase).

type ReportEngine

type ReportEngine struct {
	// contains filtered or unexported fields
}

ReportEngine drives the execution of a Report. It is the Go equivalent of FastReport.Engine.ReportEngine.

func New

func New(r *reportpkg.Report) *ReportEngine

New creates a ReportEngine for the given report.

func (*ReportEngine) Abort

func (e *ReportEngine) Abort()

Abort signals the engine to stop processing after the current band.

func (*ReportEngine) Aborted

func (e *ReportEngine) Aborted() bool

Aborted returns true if the run has been cancelled.

func (*ReportEngine) AbsRowNo

func (e *ReportEngine) AbsRowNo() int

AbsRowNo returns the absolute data row number across all bands (1-based).

func (*ReportEngine) AddBandToPreparedPages

func (e *ReportEngine) AddBandToPreparedPages(b *band.BandBase) bool

AddBandToPreparedPages adds b to the current PreparedPage. If there is not enough free space and the band cannot break, it starts a new page first. Returns true if the band was added, false if it was skipped.

b may be any *band.BandBase (or an embedding struct cast to *band.BandBase).

func (*ReportEngine) AddBookmark

func (e *ReportEngine) AddBookmark(name string)

AddBookmark adds a named navigation bookmark at the current page and Y position.

func (*ReportEngine) AddDeferredHandler

func (e *ReportEngine) AddDeferredHandler(state EngineState, fn func())

AddDeferredHandler registers a one-shot function to be called when a specific EngineState fires. The handler is removed after it fires once.

func (*ReportEngine) AddMultipleHandler

func (e *ReportEngine) AddMultipleHandler(states []EngineState, fn func())

AddMultipleHandler registers a one-shot handler that fires when any of the supplied states is reached. After the first matching state event fires, the handler is removed (one-shot semantics across all listed states). Mirrors the C# concept of ProcessInfo where a TextObject with ProcessAt set can match multiple engine states before deciding to fire. In Go, this is implemented by registering separate one-shot deferredItems for each state and using a shared fired flag so only the first match triggers the handler. Passing an empty states slice is a no-op.

func (*ReportEngine) AddOutline

func (e *ReportEngine) AddOutline(text string)

AddOutline adds an outline entry at the current outline position with the current page and Y position. After adding, the outline cursor descends into the new entry (use OutlineUp to return to the parent level).

func (*ReportEngine) AddRepeatingDeferredHandler

func (e *ReportEngine) AddRepeatingDeferredHandler(state EngineState, fn func())

AddRepeatingDeferredHandler registers a function that fires on every occurrence of state (e.g. every PageFinished or ColumnFinished). The handler persists in the queue until ClearDeferredHandlers or the report ends. Use this for ProcessAt=PageFinished and ProcessAt=ColumnFinished where the same handler must evaluate on every page/column boundary.

func (*ReportEngine) AddReprint

func (e *ReportEngine) AddReprint(b *band.BandBase)

AddReprint registers a BandBase for reprinting on each new page. DataHeader and GroupHeader bands are treated as "headers" (printed at the top of the new page); everything else is a footer (printed before the page break).

Mirrors C# AddReprint: saves current originX (curX) as ReprintOffset.

func (*ReportEngine) AddReprintDataFooter

func (e *ReportEngine) AddReprintDataFooter(b *band.DataFooterBand)

AddReprintDataFooter registers a DataFooterBand for reprinting as a footer. Called when the band has RepeatOnEveryPage=true.

func (*ReportEngine) AddReprintDataHeader

func (e *ReportEngine) AddReprintDataHeader(b *band.DataHeaderBand)

AddReprintDataHeader registers a DataHeaderBand for reprinting as a header. Called when the band has RepeatOnEveryPage=true.

func (*ReportEngine) AddReprintGroupFooter

func (e *ReportEngine) AddReprintGroupFooter(b *band.GroupFooterBand)

AddReprintGroupFooter registers a GroupFooterBand for reprinting as a footer. Called when the band has RepeatOnEveryPage=true.

func (*ReportEngine) AddReprintGroupHeader

func (e *ReportEngine) AddReprintGroupHeader(b *band.GroupHeaderBand)

AddReprintGroupHeader registers a GroupHeaderBand for reprinting as a header. Called when the band has RepeatOnEveryPage=true.

func (*ReportEngine) AddSenderDeferredHandler

func (e *ReportEngine) AddSenderDeferredHandler(state EngineState, senderPred func(any) bool, fn func())

AddSenderDeferredHandler registers a one-shot deferred handler that only fires when the state matches AND senderPred returns true for the event's sender. Used for ProcessAtDataFinished and ProcessAtGroupFinished to match the specific DataBand or GroupHeaderBand that triggered the state transition. Mirrors C# ProcessInfo.Process(object sender, EngineState state) lines 110-154.

func (*ReportEngine) AddStateHandler

func (e *ReportEngine) AddStateHandler(h EngineStateHandler)

AddStateHandler registers a persistent callback invoked on every state change. Unlike AddDeferredHandler, it is not removed after firing.

func (*ReportEngine) AdvanceY

func (e *ReportEngine) AdvanceY(delta float32)

AdvanceY moves the vertical position down by delta pixels. Also decrements the freeSpace field to keep it in sync with curY.

func (*ReportEngine) BandHasHardPageBreaks

func (e *ReportEngine) BandHasHardPageBreaks(b *band.BandBase) bool

BandHasHardPageBreaks returns true when any object in b has PageBreak=true.

func (*ReportEngine) BreakBand

func (e *ReportEngine) BreakBand(b *band.BandBase)

BreakBand handles a soft page break for b. It renders as much of the band as fits in FreeSpace on the current page, then starts a new page and renders the remainder.

When CanBreak=true the band's objects are partitioned at the break line:

  • Objects entirely above the line stay on the current page.
  • Objects that cross the line are clipped (top fragment stays, bottom moves).
  • Objects entirely below the line move to the new page with adjusted tops.

When CanBreak=false or the band fits, the whole band moves to the next page.

func (*ReportEngine) CalcBandHeight

func (e *ReportEngine) CalcBandHeight(b report.Base) float32

CalcBandHeight returns the rendered height of a band in pixels. If the band has CanGrow or CanShrink set, child TextObjects are measured and the height is adjusted to fit their content.

func (*ReportEngine) CanPrint

func (e *ReportEngine) CanPrint(obj *report.ReportComponentBase, pageIndex, totalPages int) bool

CanPrint returns true if obj should be rendered on the current page. It evaluates the PrintOn bitmask against the current page position. pageIndex is the zero-based index of the current page in PreparedPages. totalPages is the total number of prepared pages.

Each bit in PrintOn is treated as an independent "allow" condition; the component prints if ANY enabled condition matches the current page. PrintOnAllPages (0) always prints.

func (*ReportEngine) CheckKeepFooter

func (e *ReportEngine) CheckKeepFooter(dataBand *band.DataBand)

CheckKeepFooter checks if there is enough space for footer bands.

func (*ReportEngine) CheckKeepTogether

func (e *ReportEngine) CheckKeepTogether()

CheckKeepTogether is called when a page break is triggered while keeping is active. It cuts the kept bands from the current page and re-pastes them on the new page (which the caller is expected to have already started).

func (*ReportEngine) ClearDeferredHandlers

func (e *ReportEngine) ClearDeferredHandlers()

ClearDeferredHandlers removes all pending deferred handlers.

func (*ReportEngine) ColumnFooterHeight

func (e *ReportEngine) ColumnFooterHeight() float32

ColumnFooterHeight returns the height of the column footer band including its child bands, mirroring the C# ColumnFooterHeight property.

func (*ReportEngine) CurColumn

func (e *ReportEngine) CurColumn() int

CurColumn returns the zero-based index of the current print column.

func (*ReportEngine) CurPageIndex

func (e *ReportEngine) CurPageIndex() int

CurPageIndex returns the zero-based index of the current prepared page.

func (*ReportEngine) CurX

func (e *ReportEngine) CurX() float32

CurX returns the current horizontal print position in pixels.

func (*ReportEngine) CurY

func (e *ReportEngine) CurY() float32

CurY returns the current vertical print position in pixels.

func (*ReportEngine) DataSources

func (e *ReportEngine) DataSources() []*data.BaseDataSource

DataSources returns the registered data sources.

func (*ReportEngine) Date

func (e *ReportEngine) Date() time.Time

Date returns the date/time snapshot captured at the start of the run.

func (*ReportEngine) EndKeep

func (e *ReportEngine) EndKeep()

EndKeep ends the keep-together mechanism without moving bands.

C# ref: ReportEngine.Keep.cs EndKeep() lines 95-103.

func (*ReportEngine) FinalPass

func (e *ReportEngine) FinalPass() bool

FinalPass returns true when the engine is in the second (double) pass.

func (*ReportEngine) FinishKeepTogether

func (e *ReportEngine) FinishKeepTogether()

FinishKeepTogether is called after a new page has been started (from CheckKeepTogether) to paste the kept bands at the new position.

func (*ReportEngine) FirstPass

func (e *ReportEngine) FirstPass() bool

FirstPass returns true when the engine is in the first (or only) pass. In single-pass mode this is always true.

func (*ReportEngine) FreeSpace

func (e *ReportEngine) FreeSpace() float32

FreeSpace returns the remaining vertical space on the current page in pixels. This mirrors the C# FreeSpace property:

PageHeight - PageFooterHeight - ColumnFooterHeight - GetFootersHeight() - CurY

It computes dynamically from the current state rather than relying on a decremented field.

func (*ReportEngine) GetBandHeightWithChildren

func (e *ReportEngine) GetBandHeightWithChildren(b *band.BandBase) float32

GetBandHeightWithChildren returns the total height of band plus all its child bands, mirroring the C# ReportEngine.GetBandHeightWithChildren method. It walks the chain: band -> band.Child -> child.Child -> ... and sums heights. The walk stops if a child has FillUnusedSpace or CompleteToNRows != 0.

C# special case (ReportEngine.cs GetBandHeightWithChildren lines 376-393): When a band's VisibleExpression references "TotalPages" and we are in the FinalPass (second pass of a double-pass report), the band's height is still included in the calculation even if it is currently not visible. This ensures correct footer-area reservation when band visibility depends on total pages.

func (*ReportEngine) GetBookmarkPage

func (e *ReportEngine) GetBookmarkPage(name string) int

GetBookmarkPage returns the 1-based page number of the named bookmark, or 0 if no bookmark with that name has been registered.

func (*ReportEngine) GetFootersHeight

func (e *ReportEngine) GetFootersHeight(dataBand *band.DataBand) float32

GetFootersHeight returns the total height of footer bands that need to be kept with the last data row.

func (*ReportEngine) GetLogicalPageNumber

func (e *ReportEngine) GetLogicalPageNumber() int

GetLogicalPageNumber returns the logical page number for the current page, adjusted by the report's InitialPageNumber setting. This mirrors C# ReportEngine.PageNo which calls GetLogicalPageNumber().

func (*ReportEngine) GetLogicalTotalPages

func (e *ReportEngine) GetLogicalTotalPages() int

GetLogicalTotalPages returns the total number of logical pages for the current page's group, adjusted by InitialPageNumber. This mirrors C# ReportEngine.TotalPages which calls GetLogicalTotalPages().

func (*ReportEngine) HierarchyLevel

func (e *ReportEngine) HierarchyLevel() int

HierarchyLevel returns the nesting depth in hierarchical reports (0-based).

func (*ReportEngine) HierarchyRowNo

func (e *ReportEngine) HierarchyRowNo() string

HierarchyRowNo returns the dot-separated hierarchy row identifier (e.g. "1.2.3").

func (*ReportEngine) IncLogicalPageNumber

func (e *ReportEngine) IncLogicalPageNumber()

IncLogicalPageNumber advances the logical page counter and records an entry for the current physical page.

C# behaviour: during the first pass (or single pass) a new entry is always appended. During the second pass of a double-pass report, existing entries are reused unless the second pass produces more pages than the first (which happens when content grows). In the latter case a new entry is appended.

func (*ReportEngine) IsKeeping

func (e *ReportEngine) IsKeeping() bool

IsKeeping returns true when the keep-together mechanism is active.

func (*ReportEngine) KeepCurY

func (e *ReportEngine) KeepCurY() float32

KeepCurY returns the Y position at which the current keep block started.

func (*ReportEngine) LogicalPageCount

func (e *ReportEngine) LogicalPageCount() int

LogicalPageCount returns the total number of logical page entries recorded.

func (*ReportEngine) LogicalPageNo

func (e *ReportEngine) LogicalPageNo() int

LogicalPageNo returns the current logical page number (1-based).

func (*ReportEngine) NeedKeepFirstRow

func (e *ReportEngine) NeedKeepFirstRow(dataBand *band.DataBand) bool

NeedKeepFirstRow returns true if the first data row of the DataBand must be kept together with its header (DataHeaderBand.KeepWithData=true).

func (*ReportEngine) NeedKeepFirstRowGroup

func (e *ReportEngine) NeedKeepFirstRowGroup(groupBand *band.GroupHeaderBand) bool

NeedKeepFirstRowGroup returns true if the first data row of a group must be kept with the group header (GroupHeaderBand.KeepWithData=true).

func (*ReportEngine) NeedKeepLastRow

func (e *ReportEngine) NeedKeepLastRow(dataBand *band.DataBand) bool

NeedKeepLastRow returns true if the last data row must be kept with footer bands that have KeepWithData=true.

func (*ReportEngine) NewPage

func (e *ReportEngine) NewPage()

NewPage resets the vertical position for a new page and increments counters. It also updates the logical page numbering to keep TotalPages() correct.

func (*ReportEngine) OnStateChanged

func (e *ReportEngine) OnStateChanged(sender any, state EngineState)

OnStateChanged fires all registered deferred handlers that match state. It is called internally at lifecycle boundaries. Repeating handlers (repeat=true) remain in the queue after firing; one-shot handlers (repeat=false) are removed.

func (*ReportEngine) OutlineRoot

func (e *ReportEngine) OutlineRoot()

OutlineRoot resets the outline cursor to the root level.

func (*ReportEngine) OutlineUp

func (e *ReportEngine) OutlineUp()

OutlineUp moves the outline cursor one level up toward the root.

func (*ReportEngine) PageFooterHeight

func (e *ReportEngine) PageFooterHeight() float32

PageFooterHeight returns the height of the page footer band including its child bands, mirroring the C# PageFooterHeight property.

func (*ReportEngine) PageHeight

func (e *ReportEngine) PageHeight() float32

PageHeight returns the usable page height (paper height minus top+bottom margins) in pixels.

func (*ReportEngine) PageNo

func (e *ReportEngine) PageNo() int

PageNo returns the current logical page number (1-based). In C#, this calls GetLogicalPageNumber() which reads from the pageNumbers array and applies InitialPageNumber. The Go version delegates to the same helper, falling back to the raw pageNo when the array is empty.

func (*ReportEngine) PageWidth

func (e *ReportEngine) PageWidth() float32

PageWidth returns the usable page width (paper width minus left+right margins) in pixels.

func (*ReportEngine) PreparedPages

func (e *ReportEngine) PreparedPages() *preview.PreparedPages

PreparedPages returns the engine's prepared-pages collection.

func (*ReportEngine) ProcessObject

func (e *ReportEngine) ProcessObject(txt *object.TextObject)

ProcessObject manually triggers deferred evaluation for a TextObject with ProcessAt == Custom. This is the Go equivalent of C# ReportEngine.ProcessObject (ProcessAt.cs lines 216-228). After processing, the object is removed from the custom queue so it is not processed again.

func (*ReportEngine) RegisterCustomObject

func (e *ReportEngine) RegisterCustomObject(txt *object.TextObject, fn func())

RegisterCustomObject registers a TextObject with ProcessAtCustom for later manual processing via ProcessObject. The fn closure evaluates the object's text expression and updates the corresponding PreparedObject. Called from populateBandObjects2 when ProcessAt == ProcessAtCustom. Mirrors C# AddObjectToProcess (ProcessAt.cs line 199-205).

func (*ReportEngine) RegisterDataSource

func (e *ReportEngine) RegisterDataSource(ds *data.BaseDataSource)

RegisterDataSource adds a data source to be initialised during Phase 1.

func (*ReportEngine) RemoveReprint

func (e *ReportEngine) RemoveReprint(b *band.BandBase)

RemoveReprint unregisters a band from both header and footer reprint lists.

func (*ReportEngine) RenderInnerSubreport

func (e *ReportEngine) RenderInnerSubreport(parentBand *band.BandBase, sr *object.SubreportObject)

RenderInnerSubreport renders a subreport inside the coordinate space of parentBand. When a PreparedBand for the parent exists on the current page, subreport objects are merged directly into it at the SubreportObject's Left/Top offset (PrintOnParent semantics). CurX, CurY, and outputBand are always saved and restored.

func (*ReportEngine) RenderInnerSubreports

func (e *ReportEngine) RenderInnerSubreports(parentBand *band.BandBase)

RenderInnerSubreports finds all inner SubreportObjects in parentBand's object collection and renders each one in turn. Mirrors C# ReportEngine.Subreports.cs RenderInnerSubreports (lines 38-54): VisibleExpression is evaluated before checking Visible, then PrintOnParent.

func (*ReportEngine) RenderOuterSubreports

func (e *ReportEngine) RenderOuterSubreports(parentBand *band.BandBase)

RenderOuterSubreports finds all outer SubreportObjects in parentBand's object collection and renders each in its own column-like area, then advances CurY to the maximum Y reached by any subreport. Mirrors C# ReportEngine.Subreports.cs RenderOuterSubreports (lines 56-114):

float saveCurY = CurY;
float saveOriginX = originX;
// For each outer subreport:
//   CurY = saveCurY - subreport.Height;  (line 83)
//   originX = saveOriginX + subreport.Left;

func (*ReportEngine) ReprintFooterCount

func (e *ReportEngine) ReprintFooterCount() int

ReprintFooterCount returns the number of reprint footer entries (for testing).

func (*ReportEngine) ReprintHeaderCount

func (e *ReportEngine) ReprintHeaderCount() int

ReprintHeaderCount returns the number of reprint header entries (for testing).

func (*ReportEngine) ResetLogicalPageNumber

func (e *ReportEngine) ResetLogicalPageNumber()

ResetLogicalPageNumber resets the logical page counter (e.g. at a new group that has ResetPageNumber=true, or at the end of a report page with ResetPageNumber). It also back-fills the totalPages field for all entries since the last reset so that "[TotalPages]" resolves correctly.

C# behaviour: this only runs during the first pass. During the second pass the pageNumbers list already has correct totalPages values from the first pass, so re-running the back-fill would be incorrect.

func (*ReportEngine) RowNo

func (e *ReportEngine) RowNo() int

RowNo returns the current data row number within the current data band (1-based).

func (*ReportEngine) Run

func (e *ReportEngine) Run(opts RunOptions) error

Run executes the report with the provided options. It runs Phase 1 (data initialisation), Phase 2 (page generation), and Phase 3 (finish events and page limiting). Returns an error if any phase fails.

func (*ReportEngine) RunDataBandFull

func (e *ReportEngine) RunDataBandFull(db *band.DataBand) error

RunDataBandFull runs a DataBand with a data source. It calls ds.First(), iterates all rows (up to db.MaxRows()), shows header/ data/footer bands, and leaves the data source positioned before the last row.

This is the primary entry point used by RunBands when a DataBand has a DataSource.

func (*ReportEngine) RunDataBandRows

func (e *ReportEngine) RunDataBandRows(db *band.DataBand, rows int)

RunDataBandRows iterates over rows for a data band with default keep settings. Called from showGroupTree for leaf group nodes.

func (*ReportEngine) RunDataBandRowsKeep

func (e *ReportEngine) RunDataBandRowsKeep(db *band.DataBand, rows int, keepFirstRow, keepLastRow bool)

RunDataBandRowsKeep is the inner iteration loop that mirrors C# RunDataBand(dataBand, rowCount, keepFirstRow, keepLastRow).

func (*ReportEngine) RunGroup

func (e *ReportEngine) RunGroup(groupBand *band.GroupHeaderBand)

RunGroup is the top-level method called by the band runner when it encounters a GroupHeaderBand. It mirrors C# RunGroup:

  1. Resolve DataSource
  2. Apply group sort
  3. ShowGroupTree(MakeGroupTree(groupBand))

KeepTogether/KeepWithData are handled per-group-instance in showGroupHeader/showGroupFooter (not at the RunGroup level), matching the C# behaviour.

func (*ReportEngine) RunReportPage

func (e *ReportEngine) RunReportPage(pg *reportpkg.ReportPage) error

RunReportPage processes a single ReportPage: sets up the page, runs all bands, and tears down the page.

Matches C# RunReportPage flow:

  1. Set current page, initReprint
  2. StartFirstPage (startPage with isFirst=true) — or PrintOnPreviousPage path
  3. Fire ReportPageStarted + PageStarted events
  4. Find deepest DataBand and set KeepSummary=true
  5. Run bands (manual build or automatic)
  6. Fire PageFinished + ReportPageFinished events
  7. EndLastPage (endPage with isLast=true)

func (*ReportEngine) SetCurPageIndex

func (e *ReportEngine) SetCurPageIndex(v int)

SetCurPageIndex sets the current prepared page index (used by subreports/tables).

func (*ReportEngine) SetCurX

func (e *ReportEngine) SetCurX(v float32)

SetCurX sets the current horizontal print position.

func (*ReportEngine) SetCurY

func (e *ReportEngine) SetCurY(v float32)

SetCurY sets the current vertical print position.

func (*ReportEngine) SetUnlimitedHeightValue

func (e *ReportEngine) SetUnlimitedHeightValue(v float32)

SetUnlimitedHeightValue sets the current rendered height of the unlimited-height page. Mirrors C# ReportEngine.UnlimitedHeightValue setter (ReportEngine.cs line 138).

func (*ReportEngine) SetUnlimitedWidthValue

func (e *ReportEngine) SetUnlimitedWidthValue(v float32)

SetUnlimitedWidthValue sets the current rendered width of the unlimited-width page. Mirrors C# ReportEngine.UnlimitedWidthValue setter (ReportEngine.cs line 147).

func (*ReportEngine) ShiftLastPage

func (e *ReportEngine) ShiftLastPage()

ShiftLastPage is called when the number of pages increased during the second pass of a DoublePass report (compared to the first pass). It appends a new entry and recalculates totalPages for all entries.

C# equivalent: ReportEngine.ShiftLastPage()

func (*ReportEngine) ShowBandWithPageBreaks

func (e *ReportEngine) ShowBandWithPageBreaks(b *band.BandBase)

ShowBandWithPageBreaks renders band b, handling any hard page breaks. This wraps showBand (in pages.go) to intercept bands that contain objects with PageBreak=true.

SplitHardPageBreaks mutates object Top values in-place (Go lacks Activator.CreateInstance to clone arbitrary objects like C# does). We save the originals here and restore them after rendering so the source band is not permanently modified. Mirrors C# ReportEngine.Break.cs SplitHardPageBreaks cloneObj.Top = c.Top - offsetY.

func (*ReportEngine) ShowDataBandRow

func (e *ReportEngine) ShowDataBandRow(db *band.DataBand, rowNo, absRowNo int)

ShowDataBandRow shows a data band for a single data row, handling StartNewPage, row tracking, and child bands.

func (*ReportEngine) ShowFullBand

func (e *ReportEngine) ShowFullBand(b *band.BandBase)

ShowFullBand shows band b, repeating it RepeatBandNTimes times. It fires BeforeLayout/AfterLayout events and recursively shows any ChildBand.

func (*ReportEngine) ShowReprintFooters

func (e *ReportEngine) ShowReprintFooters()

ShowReprintFooters renders the registered footer bands (in reverse order) before a page break. Mirrors C# ShowReprintFooters() which calls ShowReprintFooters(true).

func (*ReportEngine) ShowReprintHeaders

func (e *ReportEngine) ShowReprintHeaders()

ShowReprintHeaders renders the registered header bands at the top of the new page. Mirrors C# ShowReprintHeaders: saves/restores originX, sets Repeated=true on each band, restores originX from band.ReprintOffset, shows the band, then resets Repeated=false.

func (*ReportEngine) SplitHardPageBreaks

func (e *ReportEngine) SplitHardPageBreaks(b *band.BandBase) []*band.BandBase

SplitHardPageBreaks splits b at the positions of objects with PageBreak=true and returns the resulting band parts.

The algorithm mirrors C# ReportEngine.SplitHardPageBreaks exactly: iterate objects in order; when a PageBreak object is encountered, finish the current part (if any) and start a new one with StartNewPage=true and FirstRowStartsNewPage=true. Every object (including the PageBreak one) is added to the current part with its Top adjusted relative to the part offset.

If there are no hard breaks, a single-element slice containing the original band is returned.

func (*ReportEngine) StartKeep

func (e *ReportEngine) StartKeep()

StartKeep starts the keep-together mechanism. Bands printed between StartKeep and EndKeep will be moved to a new page together if they don't fit on the current page.

func (*ReportEngine) TotalPages

func (e *ReportEngine) TotalPages() int

TotalPages returns the total number of logical pages prepared so far. In C#, this calls GetLogicalTotalPages() which reads from the pageNumbers array. The Go version delegates to the same helper, falling back to the raw totalPages when the array is empty.

func (*ReportEngine) UnlimitedHeight

func (e *ReportEngine) UnlimitedHeight() bool

UnlimitedHeight returns whether the current page has unlimited (dynamic) height. Mirrors C# ReportEngine.UnlimitedHeight property (ReportEngine.cs line 119-122):

public bool UnlimitedHeight { get { return page.UnlimitedHeight; } }

func (*ReportEngine) UnlimitedHeightValue

func (e *ReportEngine) UnlimitedHeightValue() float32

UnlimitedHeightValue returns the current rendered height of the unlimited-height page. Mirrors C# ReportEngine.UnlimitedHeightValue getter (ReportEngine.cs line 135-138).

func (*ReportEngine) UnlimitedWidth

func (e *ReportEngine) UnlimitedWidth() bool

UnlimitedWidth returns whether the current page has unlimited (dynamic) width. Mirrors C# ReportEngine.UnlimitedWidth property (ReportEngine.cs line 127-130).

func (*ReportEngine) UnlimitedWidthValue

func (e *ReportEngine) UnlimitedWidthValue() float32

UnlimitedWidthValue returns the current rendered width of the unlimited-width page. Mirrors C# ReportEngine.UnlimitedWidthValue getter (ReportEngine.cs line 144-147).

type RunOptions

type RunOptions struct {
	// Append appends output to existing prepared pages instead of replacing them.
	Append bool
	// ResetDataState re-initialises data sources before running.
	ResetDataState bool
	// MaxPages limits the number of output pages (0 = unlimited).
	MaxPages int
	// Context is an optional context for cancellation and deadline support.
	// When the context is cancelled the engine stops after the current band.
	Context context.Context
}

RunOptions controls optional aspects of a report run.

func DefaultRunOptions

func DefaultRunOptions() RunOptions

DefaultRunOptions returns RunOptions with the most common defaults.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL