Replace contents between headings - ms-word

So what I am trying to do is I want to fetch Heading wise data from word via docx4j and want to replace the data that is in those Headings, I do not want to change the heading text just want to remove all the things in that Heading and replace it with another. I searched everywhere for 4 days but not able to find a successful way of doing it, I can do it by fetching text line by line manually but that won't be efficient so is there any way I can directly get Heading wise data and thn can remove every child in that Heading and append another child in that same heading?
Below I have attached an image of the word document, so thing is I want to remove everything in the Heading1 i.e. "2. Functional Requirements" but I do not want to change the heading or it's heirarchy, I just want to remove everything i.e. 2.1.1 and it's subdata, 2.1, BR_1,etc and want to append data same way here as child of "2. Functional Requirements" Style - Heading1.
Below is the image of the word document:
Please Help me, any help is highly appreciated.
Thank you, have a great day.

Related

Visual Studio Code select same position above and below not the whole line before and after (see image)

I'm using visual studio code and run into a weird problem. I'm not sure how I got here - I could have accidently pressed a shortcut unknowingly.
I'm trying to select a phrase, link or anything that crosses multiple lines (whether the lines are true lines or due to word wrap). When I select multiple lines, it doesn't automatically select the text at the start and end between the two points. Rather, it just selects the length of text for that line and repeats it in the subsequent lines. See the image below to understand.
Image of issue
As you can see, I am trying to select the words from "the" to the end of "sub". Instead of selecting all the words between the two, it selects the text "the instru" and selects every line with the same amount of characters/length.
In order to show what I am expecting, I have pasted the text into Notepad and done the same thing.
What I am expecting
As you can see, all the words between "the" and "sub" are selected.
If anyone has any idea about how to fix this, I would be greatly appreciative.
Below is a copy of the text if the images don't display.
Follow the instructions below for a click guide to retire and/or add 'School'.
Best practice if there is a change in 'School' structure would be to 'retire' any existing school setup that is no longer required and add the new sub school information. The reason why we don't just edit existing school names (typically) is due to leaving historical data intact.
Try using ctrl+shift+P and typing "Toggle Column Selection Mode"

When changing path in a ms word field to reference a new file, how can I get it to automatically update/refresh?

I have a document with over 1000 images (set a), each of which are sitting on separate folder and I am loading them into my word document by entering the path in a "field". The images get uploaded to the word document and displayed.
I have another 1000 images (set b), all of which are named in the exact same way, except that they all end a different letter (b instead of a). I have tried to take my pre-existing and working word document that displayed the first 1000 images (set a), and edit the path in the field so that they all reference the set b images. This change is easy to make as I just need to find and replace everywhere that the text image_a.pngappears with image_b.png.
However, when I do this, the images don't actually refresh and are instead still displaying all of the images from set a. I have played around with a lot of stuff like saving the document as and opening it again, and for a separate issue I had to enter and exit print preview for my number sequence to update, and I tried that for this issue, but that still doesn't help. The only thing that I have found that works is if I go to each field individually, right click on it and select "edit field" and then select ok, and then the correct image will be displayed. However this is not a practical solution because I would have to do this over 1000 times. Does anyone know what is going on here and does anyone know a way to refresh/update all of the 1000 images at once?
Thanks!
Try Ctrl+A followed by the F9 key. You may need to press an Fn key with the F9.
If you need something more nuanced, I can provide a macro. For that, I would need the name of the field being used.
You may want to look at Paul Edstein's tutorial on relative paths in fields.

Monogdb undefined error.. one doc is inserted and another doc is not inserted

I am trying to insert two documents in to a collection called hi.
Hear one document is inserted and other one is not inserting..
for understanding i keep the values as blue and red for pp field.
when i am inserting blue its inserted.
and when i insert red its not inserted
db.hi.insert({city:"ny",pp:"blue"})
this doc is inserted
if in this place and in this doc if i changed pp field to red or any thing its inserted
db.hi.insert({city:"ny",pp:"red"})
this doc is not inserted
but in this place if i changed it to blue or any thing also it wont insert
may be some thing like place holder s some thing i don't know what is this.. that's why i make a video for this ..
very STRANGE..
i made a video(recorded).. please watch in mute and in HD
and i know if you tried in you system it will work but for me its not worked .. that's why i make a video
Hear is the link i uploaded.
There is an invisible character in the code, right after the semicolon. It's the Unicode U+200B Zero-width space character. Instead of pressing "up" on your keyboard, try writing the insert statement again from scratch.
See also: No visible cause for "Unexpected token ILLEGAL"

Length of current selection in Eclipse

Do you know any easy way to find out what is the length of the current selection in Eclipse?
i.e. I select a line fragment and would like to know how many characters are there?
Usually, I count them manually, but that's stupid. When being desperate, I move to the start, check the column number, move to the end, check the column number, subtract, think a minute if I should add 1 or not... and my selection is lost.
On Windows, Notepad++ is a good solution. Open a new tab, copy and paste in there and the length of the document listed at the bottom of the window is the number of characters you have.
Easy way? Copy the text and paste it to a counting script, like this site:
http://charcount.com/
(Warning: the site's background may hurt your eyes.)
Eclipse does support a Selection object, if you're into its API:
http://www.eclipse.org/articles/Article-WorkbenchSelections/article.html#example

How to find and replace programmatically in ENTIRE Word document

I have a Word document with text in tables and text outside tables. I want to find and replace in all the text, not just the text outside the tables. The content property of the document is just the "main story" and not the tables. I don't want to iterate through all the table objects. I just want to find and replace in all the text, just like when I do it manually using the Word gui.
Please save me from the mental hell I am burning in.
[The stench of burning flesh is starting to worry me. Almost as much as the excruciating pain in my extremities.]
[My legs and arms have been devoured by the flames. I write this with my nose, which is sticky with melted plastic from the keys.]
Use the Find property, it is the same as the UI. Search help topic for "Find Property" to get you started.
With ActiveDocument.Range.Find
.Text = "hi"
.Replacement.Text = "hello"
.Execute Replace:=wdReplaceAll, Forward:=True, Wrap:=wdFindContinue
End With