View Categories

Text quality

1 min read

The StiText component and its inherited components have a TextQuality property. This property allows you to select / display the quality of the text. This property is set to one of three values:

standard

 Typographic

 Wysiwyg

In Standard mode and Typographic mode, text is displayed using GDI + system library. The difference between these modes is that in Typographic mode, the text is output with antialiasing, which looks good but renders slowly. In Wysiwyg mode, the text is displayed using the GDI system library. In this mode, the text may not look as beautiful as the other two modes.

Why do we need GDI when GDI + exists, is more beautiful and easier to use? To answer this question, let's look at the definition of WYSIWYG.

WYSIWYG (an acronym for What You See Is What You Get) is an abbreviation for "What You See Is What You Get", which is an editing method in which the content being edited is very similar to the final output. In terms of reporting tools, it means that the report looks the same when you edit the template and when you look at the finished report printed on paper. But in reality, it's not that easy. Many methods display text differently on different monitors and may print differently on different printers. This is especially noticeable in large texts. The position of line breaks may differ depending on whether the preview is displayed in a different zoom mode or printed. This phenomenon occurs for a variety of reasons. The GDI + system library has solved most, but not all, of these issues and may still cause inaccurate displays. Full control over the text output is needed to solve the remaining problems. GDI + does not provide such control. So Wysiwyg mode was added. In this mode, the text is output using GDI. The GDI method allows you to control the output of each character in the text. This will solve almost all problems. As you can see, Wysiwyg mode isn't as clean as the other two methods, but it displays the text more accurately.

There is another difference between the two modes, which are different in how the text is displayed, so the line lengths are measured differently. For example, suppose you have three text boxes that contain the text "Test string". Set the Text Quality of the first text box to Standard, the second text box to Typographic, and the third text box to Wysiwyg. Set the AutoWidth property of all text boxes to true. In report design mode:

Visually, you cannot see the difference between these lines. However, after rendering, the width of the textbox is calculated according to the width of the text and you can immediately see the difference between the modes.

In the figure above, it's easy to see that different font types and sizes produce completely different results. This should be taken into account, for example when using the Cross-Tab component. This component allows the width of the table columns to fit according to the text, and in different modes you can change the width of the table.


The figure above clearly shows that different font types and sizes give completely different results. If you are trying to use the component CrossTab, this should be taken into account, for example: the width of this component in the columns of the table to fit the text, and in another mode, the width of the table can vary considerably. I can do it.

Also, as you can see in practice, WYSIWYG in these applications is often not working properly. For example, a report created in edit mode in EXCEL and a report created in print preview may look different. If you start to change the page scale from 50% to 200% in edit mode, you will see even more differences: 100% scale text did not reach the edge of the cell at 50%, and At 200% the last word can be placed in a cell that can be transferred to the next row. Another example is multi-line text. The height of the text in the cell may be different, not always the correct calculated line spacing on different scales. At one level in a cell, you can truncate the text, that is, it does not fit all the text strings. At another level, you can compress the same text, leaving the bottom of the cell blank. But the Excel team said that "automatic row height adjustment" can give unpredictable results, especially in small fonts.

Therefore, it is recommended that you use some of the techniques described below when exporting reports in MS-Office. Recommendations can be divided into two categories: general reporting guidelines and recommendations for each export.

A common recommendation for exporting reports in MS-Office is to design a report template.

If possible, keep the space between the end of the line and the edge of the text box so that the problem shouldn't occur.

From the previous paragraph: The size of the text box in this case is calculated tightly, so do not use the property AutoWidth unnecessarily.

Choosing a text value called TextQuality on the line that receives the longest text will increase the chances that the exported text will be displayed successfully.

Recommendations for report output in MS-Word

When exporting to MS-Word, use the following trick: a sticker that installs a font for each line of text. Font density values are measured in twips units and are stored in the static property StiOptions.Export.Rtf.SpaceBetweenCharacters (StiOptions.Export.Word2007.SpaceBetweenCharacters). By default, this property is set to -2. This amount of text compression isn't noticeable to the eye, but in most cases this is sufficient. You can change this value if you wish. Zero values for this property correspond to regular fonts, positive values correspond to sparse fonts.

Recommendations for outputting reports to MS-Excel

When exporting to MS-Excel, we recommend using the following tricks: set the right / or left border of the textbox in all issues. Excel table cells do not have borders, so borders are only considered when rendering a textbox as a garantiroovanny gap. The border text box sets the margin and is the value specified in 1/100 inch. In most cases, it is sufficient to set the right border to be equal to one hundredth of an inch (written in properties 0, 1, 0, 0).