Radiobutton with RightToLeft and number leading Text moves number to end - vb.net

I've got radiobuttons with .RightToLeft set to Yes. The .Text values of these start with a digit, followed by a space and more text. For some reason, either VS or .net or whatever is moving that leading digit to the end of the string.
Anyone know why and/or how to fix?
(edit) Just tried to put quotes around the .Text string, just in case. Results were unexpected:

You appear to be misusing the RightToLeft property, which is to support right-to-left languages like Arabic. To place the check mark to the right of English text, set CheckAlign to MiddleRight.

Related

Finding and redacting text highlighted with a specific color, but while keeping the spaces and line breaks (to maintain doc layout)

I'm trying to use the VBA code from a similar question in this forum to redact text highlighted in a specific color, but I would like to keep the document layout, which means only replacing the words, but not the spaces and paragraph breaks in the document. Alternatively, I would be happy if we could identify the line breaks and put a space there.
At the end the document would not have large sections of unbroken text where words and spaces were replaced by XXXXXXXX and highlighted black. It the text would look more like XX X XXXX XXX X but all of it should be highlighted in black.
In other words, the text "Mary had a little lamb." would be redacted to "XXXX XXX X XXXXXX XXXXX" rather than XXXXXXXXXXXXXXXXXXXXXXXX.
I've tried changing the "If flag then" section to include unicode 32 (space) instead of the carriage return (unicode 13), but that doesn't seem to work.
Many thanks.
If flag Then
If Selection.Range.HighlightColorIndex = wdTurquoise Then
' Create replacement string
' If last character is a carriage return (unicode 13), then keep that carriage return
OldText = Selection.Text
OldLastChar = Right(OldText, 1)
NewLastChar = ReplaceChar
If OldLastChar Like String(1, 13) Then NewLastChar = String(1, 13)
NewText = String(Len(OldText) - 1, ReplaceChar) & NewLastChar
' Replace text, black block
Selection.Text = NewText
Selection.Font.ColorIndex = wdBlack
Selection.Font.Underline = False
Selection.Range.HighlightColorIndex = wdBlack
Selection.Collapse wdCollapseEnd
End If
End If
#freeflow has given you an answer in his comment on your post, but if you do that you should also include in the wildcard search, all potential punctuation characters excluding blank spaces.
However, with that said, I recommend you not try and eliminate punctuation characters and do not eliminate spaces between words. I’m recommending that because the purpose of redaction is to eliminate the possibility of someone comprehending what the redacted portion of the document originally contained. If you provide them clues, such as how many words in the sentence ... they can guess and sometimes be quite accurate because of the surrounding non-redacted script.
Oh course, that’s just my opinion.
To maintain document formatting, I suggest that you not use as replacement characters letters such as “X” because it is a wide character. I’ve found it better to use a symbol and I recommend a Wingdings character 127. It’s an average width and does a good job of balancing out sentence length ... but for added assurance I also recommend that you include in your replacement a Font.Spacing of -1, which will tighten up each redacted sentence even more.
In redacting, just be aware that maintaining the document formatting, no matter what your replacement character strategy might be, is very difficult. I’ve spent a lot of time experimenting with this and I’ve now shared what I do in my own redaction add-in. I don’t redact paragraph marks, I redact the entire highlighted string, including spaces and punctuation and I use a Wingding font character 127, set the Font.Spacing to -1, at the font color is the same as whatever color I’m using to highlight the redaction.
If you you are interested in seeing my add-in, do a Web search on AuthorTec Redactor.

Update [Style] to Match Selection option on Character Style via macro

I'm having an issue with some character style that doesn't reflect the style change when applied (this doesn't happen always):
Example: I have a character style for italics, and when I apply the character style, the word still appears as normal (but the char style is applied, and checking the properties, the style has the check ok for italics).
In order to fix this, I select the word with the issue, right click on the style and use the option "Update [StyleName] to match selection", and it displays the italics correctly.
The problem here is that when I try to replicate this behavior with a VBA Macro (via recording macro), the macro that Word writes has this error:
Run-time error '5900': The property is not allowed for character styles. This is the line with error:
ActiveDocument.Styles("StyleItalic").AutomaticallyUpdate = False
Looking at the code created via Macro, seems that it is not possible for a character style to be automatically updated.
The character style is also created via macro, and I can't see anything wrong in the style:
Private Sub Creo(style As String, fontName As String, fontSize As Integer, hasItalic As Boolean)
On Error Resume Next
Selection.ClearFormatting
ActiveDocument.Find.style = ActiveDocument.Styles(style)
ActiveDocument.Find.Execute
If ActiveDocument.Find.Found = False Then
ActiveDocument.Styles.Add name:=style, Type:=wdStyleTypeCharacter
ActiveDocument.Styles(style).QuickStyle = True
ActiveDocument.Styles(style).font.Size = fontSize
ActiveDocument.Styles(style).font.name = fontName
ActiveDocument.Styles(style).font.Italic = hasItalic
End If
End Sub
Is there a way to fix this? Hope I explain myself. I am working with 1000+ pages Word Document, so this becomes a bit too tedious for manual editing. Also, sometimes the style in other word works ok, but other doesn't. (All the words have both paragraph style and character style)
Thanks!
Your question describes two unrelated issues.
Applying a character style with the same property as the underlying
paragraph style will cause that property to be turned off in the
text. Updating the character style to match the selection will have
the opposite effect to what you want.
To demonstrate: in a new document type a paragraph of text and apply
a style that is defined as italic, e.g. Quote or Intense Quote.
Select the whole paragraph and press Ctrl+I to turn off italics. Now
select just part of the text and apply the character style named
Emphasis. You will see that it has no apparent effect on the text.
This is because both the paragraph style and the character style are
italic, cancelling each other out and having the same effect as
turning italics off manually.
Now right click on Emphasis and select Update to Match Selection.
The selected text will now be italic but, as the text preview in the
Quick Styles gallery will show you, Emphasis is no longer italic.
Only paragraph and linked styles have the Automatically Update
property, which is why you get an error when attempting to set it on a character style.

PDFBOX - WordUtils.wrap - need to display bold and non-bolded text on same line

I am a newbie to pdfbox AND java - trying to replicate a pdf letter with logos formatting etc. I need to use mixed font (bold) within a sentence. Presently appending paragraph string, using WordUtils.wrap, then begin.Text , etc. to parse and display (drawString has strikethrough cannot select this - I did find info for multi font using it). As field values will vary in text and length, I cannot simply search on, split and change font to display. Unable to use tags to do this (OMG I've tried everything I can think of!), but hoping there is a way to use a single char identifier for beginning of bold and another for end of bold??? One issue is that no guarantee the identifiers would end up on the same line of the paragraph. UGH. Everything else is perfect, EXCEPT the text I need to bold. Does anyone have any suggestions?? I am required to use pdfbox to accomplish this - cannot use Itext. Help please! Thank you!!
SOLVED - I figured it out. Thank you for your suggestions!
I did not want to use positioning, needing to keep it as simple as possible. We'll eventually need to implement hundreds of letters. I Am using Utils.wrap strictly as a line parser, not formatting, so that is cool.
Using 2 identifiers - 3 checks -
1) both on the same line,
2) beginning bold on one line, and
3) end bold on another line.
Using split string by " " and checks equal to identifiers. Formatting is perfect. Going forward may need to modify, if for some crazy reason identifiers are contained in letter text.
It works for the 1st roll-out. Thanks again - your help is much appreciated!!!

Char & behaviour on controls

Currerently I face strange behaviour on my controls when text is present either on advlistbox items or buttonx and probably rest as well. This happens when i use & charackter within string. For instance when i use double && it shows single one. Another example when i put e.g &&&something then it shows &something with s - underscored. Is there anyone whom knows what is going on and how can i avoid that situation?
A double ampersand is used to escape the default behavior of an ampersand relative to controls. When an ampersand precedes control text it underlines the following character, usually to denote that controls hotkey. In the case of your triple ampersand situation you are using the right most ampersand as the underline and the remaining 2 as an escape so that a literal ampersand is displayed in your controls text.
If your goal is to literally display 2 ampersands then you must supply your control text with a total of 4 consecutive ampersands. (&&&&)

How to display an underline _ in a field text of a dynpro?

As the title says, I would like to display an underline character _ in a dynpro field text. Is it possible? I have tried every possible option in the field text attributes.
PS: I know P_BUKRS is not the best name, it's just to show the issue.
Instead of text fields use an input field and set it to output only. Then you can set the text during PBO which will show underscores.
DATA: lbl_bukrs(7).
MODULE init.
lbl_bukrs = 'P_BUKRS'.
ENDMODULE.
Here is a quotation from SAP Help.
If the text consists of several words, they are joined together automatically by underscores, which are replaced by spaces at runtime.
Based on that the answer would be no, it is not possible for a text field to display underscores because they will be replaced by spaces at runtime anyway.