ADVANCED TECHNIQUES, PART ONE
RETURN TO THE TOP
GOTO THE PREVIOUS SECTION
GO TO THE NEXT SECTION
Here we begin to capture some of the techniques discussed in various places about how to do certain things. Rather than get too much into the history, let us focus on doing. (I will, of course, try to give proper attribution for these techniques.)
USING ESCAPE SEQUENCES AND/OR ISO CODES IN TEXT:
An
escape sequence is a combination of characters representing a character code that is normally not printable, or executes a control function. An example that springs to mind immediately is:
\n - This represents a
newline (aka CRLF or Carriage Return/Line Feed).
From what I can see, the escape sequences used here on RPoL appear similar to those supported by ANSI C, but I can't yet definitely prove it. That aside, \n was first suggested by jase as a way to inject a line break into text in a cell.
Here's an example: We start with a variation of our basic table previously used:
Column A | Column B | Column C | Column D |
---|
Cell 1 | Cell 3 | Cell 4 |
---|
Cell 2-3 | Cell 2-4 |
Cell 3-1 | Cell 3-2 | Cell 3-3 | Cell 3-4 |
We'll replace the text in Cell 1 with something rather long...
|!! Column A | Column B | Column C | Column D |60%
|=2.2^ This text is definitely\ntoo long to fit on one line...| Cell 3 | Cell 4 |
| Cell 2-3 | Cell 2-4 |
| Cell 3-1 | Cell 3-2 | Cell 3-3 | Cell 3-4 |
Column A | Column B | Column C | Column D |
---|
This text is definitely too long to fit on one line... | Cell 3 | Cell 4 |
---|
Cell 2-3 | Cell 2-4 |
Cell 3-1 | Cell 3-2 | Cell 3-3 | Cell 3-4 |
Here's a slight twist on this to illustrate a possibly related point:
|!! Column A | Column B | Column C | Column D |60%
|=2.2^ This text is definitely \n too long to fit on one line...| Cell 3 | Cell 4 |
| Cell 2-3 | Cell 2-4 |
| Cell 3-1 | Cell 3-2 | Cell 3-3 | Cell 3-4 |
Column A | Column B | Column C | Column D |
---|
This text is definitely too long to fit on one line... | Cell 3 | Cell 4 |
---|
Cell 2-3 | Cell 2-4 |
Cell 3-1 | Cell 3-2 | Cell 3-3 | Cell 3-4 |
Note how spaces included to set off the \n did not affect the formatting of the text. From this, we can conclude that adding a space either side to make clearer where this sequence occurs would be good coding style.
A final example on this topic, just to prove it can be done, will start with a variant of a much earlier example's table:
Column A | Column B | Column C | Column D |
---|
Cell 1 | Cell 2 | Cell 3 | Cell 4 |
---|
Cell 2-2 | Cell 2-3 | Cell 2-4 |
Cell 3-2 | Cell 3-3 | Cell 3-4 |
Here we insert longer text into Cell 1 using
two \n sequences to get two line breaks:
|!! Column A | Column B | Column C | Column D |60%
|=1.3 123456789ABCDEF \n ABCDEFGHIJKLMNOP \n qrstuvwxyzabcde| Cell 2 | Cell 3 | Cell 4 |
| Cell 2-2 | Cell 2-3 | Cell 2-4 |
| Cell 3-2 | Cell 3-3 | Cell 3-4 |
Column A | Column B | Column C | Column D |
---|
123456789ABCDEF ABCDEFGHIJKLMNOP qrstuvwxyzabcde | Cell 2 | Cell 3 | Cell 4 |
---|
Cell 2-2 | Cell 2-3 | Cell 2-4 |
Cell 3-2 | Cell 3-3 | Cell 3-4 |
So... as general rules:
- Use one less \n than one has rows of cell space to fill with text. There is one known exception to this, which we will cover below.
- Gauge carefully how much text to permit in a line (see below...)
NOTE: In the above example, using much more data than would fit resulted in some odd padding of the cell's width. This, in turn, robbed space from other columns. This unintended effect should be accounted for in any Easy Table design.
In each individual case, some experimentation may be needful to gain full control over a table's intended layout. Frequent use of the
Preview/delay post feature of the editor will make this easier. Work with the longest line of text first, and be mindful that CAPITALS will take more room than lower case letters.
The \n sequence can also be used to "top justify" or "bottom justify" a single line in a row-spanned cell, depending on where one places them. Center justify is the default vertical alignment, so no use of \n is needed to accomplish that.
Examples:
Bottom Aligned Text:
|!! Column A | Column B | Column C | Column D |60%
|=2.2^ \nCell 1 | Cell 3 | Cell 4 |
| Cell 2-3 | Cell 2-4 |
| Cell 3-1 | Cell 3-2 | Cell 3-3 | Cell 3-4 |
yields the "centered bottom aligned" text in the spanned Cell 1:
Column A | Column B | Column C | Column D |
---|
Cell 1 | Cell 3 | Cell 4 |
---|
Cell 2-3 | Cell 2-4 |
Cell 3-1 | Cell 3-2 | Cell 3-3 | Cell 3-4 |
Top Aligned Text:
|!! Column A | Column B | Column C | Column D |60%
|=2.2^ Cell 1 \n \n | Cell 3 | Cell 4 | <-- NOTE: two \n are used!
| Cell 2-3 | Cell 2-4 |
| Cell 3-1 | Cell 3-2 | Cell 3-3 | Cell 3-4 |
yields the "centered top aligned" text in the spanned Cell 1:
Column A | Column B | Column C | Column D |
---|
Cell 1
| Cell 3 | Cell 4 |
---|
Cell 2-3 | Cell 2-4 |
Cell 3-1 | Cell 3-2 | Cell 3-3 | Cell 3-4 |
This seems to break the "one less rule" stated above.
NOTE: While further experimentation with other control and escape sequences may turn up other useful methods, those have yet to come to my notice.
Our next section deals with using the ISO character code  .
RETURN TO THE TOP
GOTO THE PREVIOUS SECTION
GO TO THE NEXT SECTION
This message was last edited by the user at 19:57, Fri 16 Aug 2019.