Change the distance between the bullet and the text | Api JavaScript for Word - list

I need a space after the number in the list. Tell me please, how to do this using Api JavaScript for Word.
In the properties of the List object, I can only set the spacing of the paragraph and the indentation of the first line of the paragraph (setLevelIndents).

The distance between the symbol and the text is the difference between the first and the second properties in the dialog box in the image. The first of these sets the indent of the symbol from the text margin; the second the indent of the text from the text margin. Increase the latter or decrease the former in order to increase the space between symbol and text.
In the Office JS API (API Set Word 1.3) the corresponding method is set​Level​Indents. The method signature
set​Level​Indents(level, text​Indent, bullet​Number​Picture​Indent)
The second parameter (textIndent) corresponds to the second control in the dialog box shown in the question. The third parameter (bullet​Number​Picture​Indent) corresponds to the first control in that dialog box.

Related

Insert blank value

I'm trying to insert blank into my replace function however, the tool I am using does not allow me to leave the box empty, states I must enter a value - see image.
My find function is removing everything from a hyphen symbol onwards. Is there a value I could enter into the replace box that inserts nothing?
For some reason this box will not let me leave it empty.
Thank you in advance.

Tiny error in the ChartJs book

If you link to a ChartJs topic and happen to append space %20 after the url it is included in the web display and indents the table of information.
Link to ChartJs pointhitradius
Why is that?
It's matching on the space between the words (you can go to http://www.chartjs.org/docs/latest/charts/line.html?h=pointhitradius%20Number as well to match across words), and inserting a mark element when it finds a match (in this case, to the space). Inserting an element between table cells results in this kind of behavior, but the highlighting library is built for more generic uses.
The particular library they're using for highlighting looks to be https://markjs.io.

Proper code indentation for tabs in LibreOffice/OpenOffice and Ms Word

I have some text documents (.doc and .odf) with portions of colored code appearing inside.
This code was copied as RTF from Notepad++, that's how it got colored.
However, in Notepad++ (and in many IDEs as well), the line wrap function works makes the indented code look better when in does not fit and goes to the next line.
In LibreOffice/OpenOffice and Ms Word it's possible to achieve a similar line wrap with the "increase indent" button.
So, what I'd like to do, is to automatically replace the tabs (or 4 spaces, if you like) with proper indents. Or make the tabs behave like I expect them to. Is it possible? Thanks.
Here's a visualization of the problem
I achieved what I want through some (not that many) manual steps.
find out what is the maximum number of tabs (or sets of 4 spaces), say it's 3
open the search and replace window, input 3 tabs (or 12 spaces), and click "Find All"
now all groups of 3 tabs are selected, and you are working on all the lines with maximum indentation
park or close the search and replace window, click 3 times on the "Increase indent" button (or set the left indentation in the paragraph style menu)
delete the selected groups of 3 tabs
open the search and replace window, input 2 tabs (or 8 spaces), and click "Find All"
park or close the search and replace window, click 2 times on the "Increase indent" button
delete the selected groups of 2 tabs
open the search and replace window, input 1 tabs (or 4 spaces), and click "Find All"
park or close the search and replace window, click 1 time on the "Increase indent" button
delete the selected single tabs
Now you have a nice code indentation.
If you are using Microsoft Word, then there's no "find all", but there is a way to apply paragraph styles directly from the search and replace menu. But the steps are a little different.
First decide how wide a single indentation should be (e.g. 0.5 cm)
open the find and replace window, input 3 tabs (or 12 spaces) in the Find bar
leave the Replace bar empty, but click on it
if you don't see the Search options group, click More
click on Format
click on Paragraph
set a left indentation of 3 * the indentation width you want (e.g. 1.5 cm)
click Replace All, the paragraph style will be applied but the tabs/spaces will NOT be removed
click on the empty Replace bar (again)
click No Formatting
click on Replace All (again)
now the tabs/spaces will be deleted
Rinse and repeat until you get a nice indentation.
If you are using Python (or if you want to keep your white spaces) then instead of deleting the tabs (or spaces), you can replace them with a placeholder character you don't use in the rest of the code, say £ and replace them back in one pass when you are done. However, you'll get a skewed indentation.
I guess there's a way to do this with macros, but this was good enough for me.

Move insertion point to the beginning of the blank line between paragraphs MS Word

I often need to translate a document in MS Word and I do it paragraph by paragraph, the translation text follows each individual paragraph of the original text. What I need is a keyboard shortcut to move the insertion point to the blank space after the following paragraph I need to translate, i.e to move the cursor from the end of the red colored text in the picture to the blank space after the following paragraph ending with "..and call it a day"
Ctrl+Down Arrow shortcut in Word places the insertion point at the beginning of every following paragraph, while I need it placed at the beginning of the blank line above it so I can immediately start typing.
I am looking for a Word shortcut key, regex expression or an autohotkey script that could perform this task, it would come handy to me in doing translation in MS Word.
Thank you for the help!
On MCL's suggestion I've created a simple Autohotkey script to solve the problem, combining Word keyboard shortcuts into one. I also added a code from another script which sets dark red color of the text which is being typed into the original document to make the contrast with the default text color of the original. This is a convenient option for translators which also allows saving only the translated text by using Find function in Word, and removes the need for any further editing of the translated document. Here's the script:
#IfWinActive ahk_class OpusApp
^2::
Send ^{Down}
Send ^{Down}
Send ^{Left}
Send {Enter}
{
oWord := ComObjActive("Word.Application") ; MS Word object
wdColorDarkRed = 128
oWord.Selection.Font.Color := wdColorDarkRed
}
return

CRichEditCtrl OnUpdate(): how to know the start and end positions when a paste is received?

I'm using a CRichEditCtrl to edit a computer language, and on every change to it I'm calling SetSelectionCharFormat on the current line of text (as reported by LineFromChar(-1)) to highlight the syntax. (EG: comments in green, section headings in a bigger font, compilation errors in red, etc.) Note this language doesn't have multi-line features such as a C comment where typing /* on one line makes following lines part of a comment too; for any given character change I only need to change the color of the current line.
It all looks like its working fine.
However there are some weird issues. One is, when multiple lines of text is selected from somewhere else, and pasted. My OnUpdate() is called but is naively assuming that the only line that potentially needs re-formatting is the one returned by LineFromChar(). That suffices when the user is typing character by character, but it means that after receiving a multi-line paste, the program only reformats the last line of the pasted text. How can it know where the start of the insert was?
OnUpdate is called inside the Paste operation.
It should be possible to subclass the RTF control and to intercept the WM_PASTE message. If WM_PASTE is not used internally it might be possible to use EM_PASTESPECIAL. If even tis message isn't sent, you have to interecept the Ctrl+V that causes the paste Operation.
Than you can determine the starting position of the paste operation.
Spy++ might be helpful to determine the message flow in the RTF control.