how to keep up white spaces between words in iText5 - itext

In my case, I read strings from a data base and then i want to make a PDF with itext5.
The string could be like this: I like oranges and potatoes
If you can see between the words like and oranges there are 3 white spaces.
When i create a paragraph with this text in the resulting PDF i have the next text: I like oranges and potatoes.
The white spaces between like and oranges are lost.
Is it possible to keep up the White spaces?
Thanks!!

If your white space is in left (" hello") , the generated pdf will take that whitespace automatically.
for right side ("hello ") replace white space with "\u00a0" .
String string="hello ";
string=string.replace(" ","\u00a0");

Related

How can I balance text lines in flutter?

I am trying to achieve something similar to this in flutter.
Take the following text for example;
Some long text that should be displayed in
two lines.
I want it to be displayed like this;
Some long text that should
be displayed in two lines.
I can't simply do this by putting a 'new line character' \n to the string manually because it will be a dynamic string.
You can use RichText, or try to add "\n" operator. So it should look like "Some long text that should\nbe displayed in two lines."

Is there a way to select everything right of first string in line

So I got a body of space separated text and I'm trying to mine names. These names are the first :
Tsuru Stork greeting for a long last life. Unisex
Yama Mountain; Restrainer; Unisex
Yuka A bright Star Unisex
Yumi A beautiful archery bow Unisex
Yuna The archer Unisex
How can I select everything right of the first string in each row?
I figured out how to select the names themselves with this:
(\n+)[A-Z]{1}\w+
But there doesn't seem to be an easy way in word to highlight, copy then paste the selection.
In summary, how do I select elements after the first string in a new line?
If this is done in Microsoft Word then try the following:
*^13
This stands for:
- A space character.
* - Match any sequence of characters.
^13 - Match a newline character (ASCII 13).
If I understood your question correctly, this will highlight all text to the right of the first word in each line. See the below screenshot (don't mind the Dutch pls.):
If you actually need to make sure you select everything after the first multiple space seperation, then maybe use {3,4}*^13:
Again, don't mind the Dutch along with the locale parameter delimiter (semi-colon) in the occurence indicator. This will be a comma if your locale is English.
You can use regex like : (^\w+)
^ start of line
\w+ matches world char one or many times
Demo

How to display and write all distinct white space and control characters in VS Code (or other text editor)

I would like to be able to see all whitespace and control character explicitly in my text editor. Example Hi world! This is a new line! (pretend the new line is actually on a new line) as something like Hi\sworld!\nThis\sis\sa\snew\sline!.
Or another example: Some people like spaces while others... like tabs (pretend there is a tab after the three periods) would render as \s\sSome\speople\slike\sspaces\swhile\sothers...\tlike\tabs How can I go about doing this? Also is there a way I can explicitly enter control characters, perhaps using their Unicode value?
I'm sure some of you will want to know why I care to do this. Hacker types would find inherent appeal but, beyond the joy of knowing, an esoteric programing language like Whitespace would be much easier to write for in VS Code if this kind of explicit control were allowed.
So. Can it be done? Are the worlds great text editors powerful and flexible enough to allow for this kind of functionality?
In CudaText (free, cross platform) I can config this. I have tweaked few options (in user.json) with names unprinted_*, here is user.json for new app install:
{
"unprinted_show": true,
"unprinted_content": "sed",
"unprinted_tab_len": 0,
"unprinted_space_dot_scale": 40,
"unprinted_tab_ptr_scale": 40,
}
This makes space-chars - big dots (40%) and tab-chars - big arrows (40% pointer size). Here's screenshot
I tested CudaText with all white space chars from Wikipedia list https://en.wikipedia.org/wiki/Whitespace_character#Unicode . Most are shown by one way or another, high unicode chars (0x2000+) not shown:
line ends 0x0A or 0x0D: shown as marker "un" or "mac" or "win" at line ends
tab char 0x09: shown as arrow with pale color
space char 0x20: shown as dot with pale color
char 0x0B, 0x0C: shown as "x0B", "x0C" with pale color
char 0x85: shown as font glyph
char 0xA0: shown as pale dot, like space
char 0x1680: shown as font glyph
chars 0x2000...0x200A: shown in hex form like "x200A"

Extract link and word from word file

I have Word file contains 10000+ lines among them 4503 words are blue & red colored. I want to extract all those blue and red colored word with its links.
As I have shown in image the link are on various number. And word are written before it.
Replace/ Format/ Font/ Font color: Automatic (or black)/ OK
Replace with ^p
Replace all.

Multi-line button labels

Is there an easy way to have two lines of button.text where you specify each line individually? Also, there seem to be large margins on the buttons so the text font needs to be quite small to fit. Is there a way to allow the text to use more of the button area?
The way I would do a two-line text implementation is:
Dim t1,t2 As String
t1="This is line one"
t2="This is line two"
...
MyButton.Text = t1 & CRLF & t2
The CRLF performs a Carriage Return and Line feed thus splitting the text up
I can't help with the padding issue though. Have you tried changing the font size?
MyButton.TextSize=9