Forcing Movement to Next Item within Data Band

Contents
[ ]

You can instruct the engine to force movement to the next item within a data band using a next tag. This feature is useful in label‑print‑like scenarios when you need to output data about a fixed number of items in a single table row like in the following example. Given that Clients is a DataTable instance having a field named “Name”, you can use the following template to output three client names per table row while outputting names of all clients in a single table.

<<foreach [c in Clients]>><<[c.Name]>> <<next>><<[c.Name]>> <<next>><<[c.Name]>> <</foreach>>

In this case, the engine produces a report as follows.

A Company B Ltd. C & D
E Corp. F & Partners G & Co.
H Group I & Sons J Ent.

FAQ

  1. Q: How does the next tag affect the position of data within a data band?
    A: The next tag tells the reporting engine to move the cursor to the next cell (or column) of the current data band without starting a new row. It is typically used inside a foreach loop to place consecutive items side‑by‑side in the same row.

  2. Q: Can the next tag be combined with other tags such as if or else?
    A: Yes. The next tag can be placed after any content block, including conditional blocks. The engine will still advance to the next cell after processing the conditional content.

  3. Q: What happens if the data source contains fewer items than the number of next positions defined in the template?
    A: The engine stops iterating when the data source is exhausted, leaving any remaining cells in the row empty. No error is thrown; the output simply contains blank cells for the missing items.

  4. Q: Is the next tag available in other language APIs (e.g., .NET, C++)?
    A: The next tag is part of the Aspose.Words Reporting Engine syntax and works the same across all supported languages, including Java, .NET, and C++. The only difference is the surrounding code used to load the template and data.

  5. Q: Can I change the number of items per row dynamically (e.g., based on a configuration value)?
    A: Yes. You can generate the template programmatically or use conditional logic to insert the appropriate number of next tags based on a variable that holds the desired column count. The engine will respect the generated template at runtime.