How to modify the width of a tab in RichObject

2021-09-05

Some users prefer to create tables by adjusting the tab width, or they want to create a table in a format that does not support them.

In previous versions of FastReport .NET, RichObject offered the function to modify the width of a tab in a line, but all their sizes after the first tab were the same. This has been fixed in the current version and now you can set the size for each tab character.

New property for TextObject TabPositions allows you to set the width of a tab. It is used when converting RichObject. Now you can control the width of tab characters in two ways:

– to set from the code the width of individual tab characters for each line of the TextObject;
– by uploading the finished document into RichObject.

The function to edit this property in the designer is temporarily unavailable. If there are more tab characters than widths, the tab size will be normal, and if there will be more values than tabs, the excess values of width will not be applied.

An example of a text with different tab widths

Original RTF document:

Adjusting the tab width in Word

How it looked in the previous version:

Different tab widths in the previous preview window

In the current version:

Different tab widths in the preview window of this version

Customizing tab width from the code:

 //create instance of class Report
 Report report = new Report();
 //create report page
 ReportPage pageBase = new ReportPage();
 //create data band
 DataBand dataBand = new DataBand();
 //create text object
 TextObject textObject = new TextObject();
 //set the text value
 textObject.Text = "1\t2\t3\t4";
 //set width for every symbol tab in centimeters
 textObject.TabPositions = new FloatCollection() { Units.Centimeters * 2.5f, Units.Centimeters * 3.5f, Units.Centimeters * 5 };
 //add the text object to data band
 textObject.Parent = dataBand;
 //set generated name
 textObject.CreateUniqueName();
 //set the text object bounds
 textObject.Bounds = new RectangleF(0, 0, Units.Centimeters * 15, Units.Centimeters * 0.5F);
 //create one more text object
 TextObject textObject2 = new TextObject();
 textObject2.Text = "5\t6\t7\t8";
 textObject2.TabPositions = new FloatCollection() { Units.Centimeters * 2.5f, Units.Centimeters * 3.5f, Units.Centimeters * 5 };
 textObject2.Parent = dataBand;
 textObject2.CreateUniqueName();
 textObject2.Bounds = new RectangleF(0, Units.Centimeters * 1, Units.Centimeters * 15, Units.Centimeters * 0.5F);
 //create one more text object
 TextObject textObject3 = new TextObject();
 textObject3.Text = "9\t10\t11\t12";
 textObject3.TabPositions = new FloatCollection() { Units.Centimeters * 2.5f, Units.Centimeters * 3.5f, Units.Centimeters * 5 };
 textObject3.Parent = dataBand;
 textObject3.CreateUniqueName();
 textObject3.Bounds = new RectangleF(0, Units.Centimeters * 2, Units.Centimeters * 15, Units.Centimeters * 0.5F);
 //add the band to band collection
 pageBase.Bands.Add(dataBand);
 //add created page to report page collection
 report.Pages.Add(pageBase);
 //show report
 report.Show();

Thus, you can turn RichObject and TextObject into an alternative to the Table object with the help of new improvements.

.NET .NET FastReport FastReport RTF RTF
October 13, 2025

How to Use Excel Formulas in a Report When Exporting to MS Excel

Starting with version FastReport .NET 2026.1, it is now possible to export formulas to Microsoft Excel. It is important to set up formula exports correctly and follow the syntax.
October 13, 2025

New Features for Exporting Images to Microsoft Word in FastReport .NET

In the latest version of FastReport .NET we have added new image export features. Now you can independently adjust the balance between the quality and size of the final document.
September 30, 2025

How to Install the FastReport .NET Report Designer with Pre-installed Plugins

Read the article as from version 2025.2.5 for FastReport .NET WinForms and FastReport .NET WEB allows you to install a report designer with all plugins without building dll files.

© 1998-2025 Fast Reports Inc.