How to select and modify all caption fields at once in a Word document? - ms-word

I have been trying to change the numbering style of my figure and table captions. All of my headings are in Roman numerical. However, I want Arabic numerical in my caption numbering. Could anyone tell me an easy way to do it at once? Below is an example:
Heading title: "Chapter V". My captions appear as "Figure V-2". However, I want them to appear as "Figure 5-2"
Also, is there any way I can select all figure caption fields at once and edit their field code?

To change in one caption: Press Alt-F9 and remove \* ARABIC .
Ctrl+A, F9 to update fields.
Now to change in all captions: try with a search and replace (Ctrl+H) to replace SEQ Figure \* Arabic \s 1 with SEQ Figure \s 1
To modify all field codes, you could use search & replace or you can modify field codes in VBA this way:
Sub ChangeAllFields()
'does not process headers/footers
Dim oFld As Field
For Each oFld In ActiveDocument.Fields
fld.Code = Replace(fld.Code, "SEQ Figure \* ARABIC \s 1", "SEQ Figure \s 1")
Next oFld
End Sub

When you insert captions from now on, change the numbering in the dialog box that pops up. I think you'll have to change it every time, because Word (correctly) defaults to matching the Roman numerals in your chapter headings to Roman numerals in your captions. If you want to be abnormal, you'll have to change from the default every time you insert a caption, or change them all using one of the methods from Toon Flores.
p.s. I said "abnormal" because every style manual I've ever seen would frown on what you are doing.

Related

Different text style in word fields

I have word document with bookmarks. There are some cross-references to this bookmarks values. All cross-reference are in text and has Arial 10 style.
For example, i have bookmark with "Test text", and cross-ref to this bookmark. But then i update fields word Test is normal Arial 10, but word text become Times New Roman 9 (first word save style of the text, which around my field, but second word become another (maybe standart for field) style).
I think, it's related to my Field Code - { REF BookmarkName \h \* MERGEFORMAT }
How to solve this problem?
Thank you.

Is There a Way to do a Spanish/English MailMerge?

I have an SSRS report that has Spanish and English text boxes. If the dataset row is a Spanish speaking person, an expression in each Spanish textbox shows that and hides the English textbox. These textboxes are exactly placed over each other.
My boss wants me to use SSRS to generate an Excel spreadsheet from the dataset(this is not hard) and use Word template for a mail merge. However, I am having trouble trying to figure out if I can hide all English when row is a Spanish row and vice versa. These are health clients of Spanish and English nationality.
I can do mail merges attached to a Recordset, I can do one in English, one in Spanish. I am trying to avoid this and have it all in one Mail Merge.
Areas marked in red will change to Spanish translation and/or date format. The dates are a no-brainer I can use a conditional IIF, however the formatted body I have no solution for, based on value in Field "CL_Language" which is either "Spanish" or "English".
====================================
The merge fields for dates and greeting are easy. There is no merge field for the text. And yes, only option might be for 2 separate reports with different Recordsets.
It's not clear what the actual issue is but...
Instead of hiding textboxes, which could cause problems when exporting etc., why not set a single textbox to the correct language text using an expression?
Something along the lines of
=IIF(Fields!Language.Value = "English", Fields!MyEnglishText.Value, FieldsMySpanishText.Value)
I found a solution. But it could be very difficult for the client to create. It involves hitting Ctrl + F9 which will create curly brackets {}.
Inside those curly brackets an IF statement is placed and I just pasted the whole Spanish formatted body in the true area, and the whole English body in the false area.
{IF "CL_Language" = "Spanish" "spanish body text here" "english body text here"}
Very strange syntax and you need to right click on the area to see choices like "Toggle Field Codes" (IF statement get's hidden), "Edit Field", and "Update Field". With Edit Field and Update Field you get a popup with the fields in your recordset.
If you saw the examples in my question, you can see that is some big clunky text AND . . .inside of it is a merge field that works! The Excel recordset comes already with the month name in correct language for each row.
Since it is not smart to include links that might expire, I am including the Google text I used to find this solution. Then I took a chance on a huge formatted chunk of text with a merge field inside of it.
Google this: "If Merge Field then"
Now is this a viable solution for the client versus just having a Word template for each language?
I think this is too difficult and I even duck when running it. Also, once it's working, if I look at the toggled code, the Conditional field no longer says the field name, but the value in the field, go figure.
{IF "Spanish" = "Spanish" or {IF "English" = "Spanish" instead of {IF "CL_Language" = "Spanish" or {IF "CL_Language" = "English"
Here is how to access the fields using right click. (remember, your curly brackets HAVE to be created with Control + F9).

How can i tell word to abbreviate "Figure" as "Fig."?

i want to use automatic numeration of Figures by word. When i insert a caption, I can choose what kind of caption this is, and since i have a different language than english, i made a new Type "Figure". The problem is with referencing: When i insert a cross reference onto that figure, it inserts it as "Figure" and makes it bold, since i embolden the "Figure" part of the caption, to make it more visible.
How can i change this in the text to be abbreviated with "fig."? Its annoying that the capitalisation is wrong and that the whole word "Figure" is inserted, instead of just the abbreviation. How can i accomplish that?
In Word 2007 you can in the "Insert Caption" dialog check whether to include or exclude the label from the caption. So inserting a reference will make you show only the number, without "Figure" word, so you can type "Fig." manually.
(Picture taken from http://word.tips.net/T000890_Adding_Captions.html)
As far as I know it is not possible (this way) until Office 2007.

How to do search and replace involving fields in Microsoft Word?

I have a Word document with fields of the reference variety, which occur in the form "[field].[field]"--in other words, there's a period between the two fields. I want to globally replace this with a space.
Word offers the ^d special character to search for fields, but for some reason the query "^d.^d" does not find anything. However, ".^d" does. Now comes the problem, however--what do I specify as the replacement text in order to retain the field code? If using regular expressions, I could use a "Find What Expression" such as \1, but with regexp ("wild card") mode the ^d is not permitted.
I guess I could write a macro...
I would like to add to Bibadia's solution.
An example of an index entry field; we want to change a name we misspelled.
Make sure hidden formatting is displayed (toggle with SHIFT+CTRL+F8).
Make sure wildcards option is not selected. To search for fields, use the opening and closing field braces code (optionally use ^w for spaces, as Bibadia suggested):^19 XE "Deo, John" ^21
Replace won't recognize field braces character, but will allow to insert the clipboard's content. ;). To do that, insert in text the correct entry. CTRL+F9 to insert field and type:XE "Doe, John"
Select the field above and copy
Use ^c in the replace box
Hit Replace All
Ta-da!
It's usually better to go the macro route when finding fields because, as you say, the find algorithm that Word uses doesn't work the way you might hope with fields.
But if you know exactly what the fields contain, you can specify a search pattern that will probably work (however not in wildcard mode).
For example, if you want to look for figure number field pairs such as
{ STYLEREF 1 \s }.{ SEQ Figure \* ARABIC \s 1 }
(which would typically be the same set of fields everywhere in the document)
If you only really need to look for the following:
{ STYLEREF 1 \s }.<any field>
you could ensure that field codes are displayed and search for
^d STYLEREF 1 \s ^21.^d
or
^19 STYLEREF 1 \s ^21.^19
If you need to be more precise, you can spell out the second field as well.
"^d" only works for finding the field beginning, not the field end.
It's a shame that ^w wants to find at least 1 whitespace character because otherwise it would be more robust to look for
^19^wSTYLEREF^w1^w\s^w^21.^19
Perhaps someone else knows how to work around that without using wildcards?
Torzaburo,
I suggest that you do this using a macro. You can start by recording the macro, and later refining your processing steps within the macro.
First turn on the hidden characters by navigating to Home > Paragraph > toggle the show/hide Paragraph symbol. Also, select all and toggle the field codes on (right-click and select "Toggle Field Codes".
Open a new blank Word doc in addition to the one you have open. You will use this later. Start the macro recording and find the field using the "^d" (field code) as you said.
When the field is found, copy only the field text within the brackets, and not the full field reference. While the macro is still recording, ALT + TAB to the new blank document and paste the field code in as plain text.
At this point, do the necessary find & replace processing to the field codes. Highlight the processed field codes, copy, ALT + TAB back to the original document, and paste back between the { } brackets.
Stop the macro recording. Add any further custom processing to the macro VBA.
Select-All and re-toggle the field codes. Update the field codes.
You don't need a macro. Just toggle all field codes on by using Alt+F9. Then do a find and replace for what you want to change. Once the replacement is complete, use Alt+F9 again to toggle the field codes back off.
Disclaimer: I didn't originate this solution, but it's clean and elegant and I thought it should be included here:
(Adapted from Search & Replace Field Codes in Word):
Create or find a single instance of the field you want to convert text to
Toggle Field Codes visible (AltF9)
Copy the code for the field you want to use to the Clipboard (highlight and CtrlC)
Open the Replace dialog box (CtrlH), insert the text you want to replace in the Find What box and then enter ^c in the Replace With box.
This will replace your text with the contents of the Clipboard, turning it into the field code you copied in step 3. It also copies formatting information (font, color, etc.), to control how the field will appear when hidden. (Caveat: I've tested this with Word 2003 under Windows 7 only.)
Coming in late on this, probably way too late for Beth (sorry Beth). And this may not be quite what Beth was looking for. But for anyone interested ...
It sounds like Beth may have created captions throughout the document using INSERT CAPTION (hence the presence of field codes). This means these captions will have been (automatically) created in CAPTION style.
To globally replace the separator "." with " " (space) in such captions, take two steps:
[1] Go to REFERENCES | INSERT CAPTION, then click on NUMBERING and replace the SEPARATOR "." with "EM-DASH". This will replace all separators in captions for the selected label in the CAPTION Window. If you have other labels in use in the document (e.g. FIGURE), select the other labels one by one and repeat this process.
[2] Do a find/replace searching for special character "em-dash" (^+) in style CAPTION, replacing with " ". Click REPLACE ALL.
Voila!
NOTE: This presumes that em-dash does not appear in the caption text anywhere. If it does, then you'll need to do a pre- and post- "fiddle" to ensure these em-dashes are not touched by the global replace above.
The "pre-fiddle" is to do a global find/replace across captions, replacing the em-dash ("^+") with some other string (e.g. "EM-DASH") that doesn't ever occur in any caption's text. Then you do the separator change as described above. Finally, the "post-fiddle" is to restore the em-dashes that were in the captions, by doing a global replace of the string "EM-DASH" with the actual em-dash character "^+".

Why words are shuffled when I insert English words in any Arabic/Urdu/Persian text on Notepad or MS Word?

I can write Arabic/Urdu/Persian on MS Word or Notepad just fine, but whenever I insert any English word or number, the sequence is just disturbed and seems like the all the words have been shuffled in the sentence.
Look at the example below:
یہ ایک مثال ہے اردو کی ...
Now I inserted an English word and it became:
یہ ایک مثال ہےword اردو کی ...
So you can see almost all of the words have been jumbled ... what is the solution for that ?
For example:
باللغة العربية “keyboard” انا أريد أن أعرف الكلمة
Finish typing the Arabic word and add a space after it (this space separates the embedded text from the Arabic text to its right).
Insert special character U+200F (to render the preceding space an Arabic character). The character name is "Right to Left Mark".
Insert special character U+202A (to begin the left-to-right embedding). The character name is "Left to Right Embedding".
Insert another space (to separate the embedded text from the Arabic text that will continue to its left).
Change the keyboard to e.g. English and type the left-to-right word.
Insert special character U+202C (to restore the bidrectional state to what it was before the left-to-right embedding). The Character name is "Pop directional formatting".
Change the keyboard back and continue writing in Arabic.
If you're working in Microsoft Office or Open Office, the "special characters" can be found under "insert" [Insert -> symbols -> other symbols -> special characters in MS 2013]. Scroll through until you find the character with the appropriate Unicode number, and if the Unicode number does not appear in your version of MS Word, select it by its name [as indicated above].
You can also add the character by writing it's unicode and then selecting it and pressing Alt+X - but that can be confusing because it needs constant change between Arabic and English.
All of the special characters involved in this little manoeuvre are invisible characters (their job is simply to change the direction of the text) so don't be surprised if it looks like you're not inserting anything.
Pay attention to select the RTL option from the ribbon when the majority of your paragraph is RTL and keep it selected [as shown in the picture in this answer https://stackoverflow.com/a/46050171/8558867 ].
Before you start typing in Arabic/Persian make sure you have chosen "Right-to-Left-Direction" button. This button can be found on Paragraph tab just left side of AZ sorting button. Also select "Align Text Right" button which can be found in Paragraph tab left side of Justify button.
Start typing your language
Before putting an English word put an space then select left ALT + SHIFT and type your English word
Once finished your English words select right ALT + SHIFT and then put a space and keep typing your language again
Hope this helps
This is OK; they're not shuffled: you're seeing them in LTR rendering mode.
You just need to make them right-to-left. In Notepad or Word, press right Ctrl+Shift to make their direction right-to-left and it will be okay. (It's like having <p dir="rtl">...</p> in HTML).
The control characters LRE and RLE (0x202A and 0x202B) and also LRM and RLM (0x200E and 0x200F) need to be applied to the whole paragraph, i.e they should come at the beginning of the sequence. Some text display widgets of some platforms may discard these control characters though, particularly older (pre-2000) platforms or those who do not support Unicode bidirectional algorithm correctly. Newer OS'es and programs should be fine; try with Windows Notepad for example.
I personally recommend using the platform's means to make the text RTL, and avoid special control characters because they're invisible and may cause surprising results if they go out of control. So you'd better use Word's API to make the text RTL, or if your output is HTML put them in <div dir="rtl">...</div> tags. For plain text file, user has to manually press the Ctrl+Shift keys himself.
Edit: this was written as a clarification answer to the first answer here, I later edited the first answer and added the important notes I wrote here [the edit still needs approval though].
I was able to fix my text by following the steps in the first answer here.
In case anyone faces troubles while following the steps, let me clarify some things:
If you are entering an English word in an Arabic text, make sure that RTL option in the ribbon is selected [circled in red in the following figure]:
Keep it selected throughout the paragraph irrespective of the language you are using [as long as the majority of the paragraph is written in an RTL language like Arabic or Hebrew].
Where to find the special characters and how to insert them:
You can write the unicode of the character and then select it and press "Alt + X". However, this can be a bit confusing because of the need to change back and forth between English and Arabic to write the codes, so the best thing to do is enter them 'manually' by inserting their names.
You can do that by going to Insert -> Symbol -> More Symbols -> Special characters [scroll down]. Then select the name of the characters you need to use instead of its unicode.
The names of the characters you'll need to use [as specified in the first answer here] are:
"Right to Left Mark" : U+200F.
"Left to Right Embedding": U+202A.
"Pop Directional Formatting": U+202C.
As the first answer says, nothing will appear on the screen because it's a non-printing character, so it's normal if you felt like nothing happened when you insert.
If you need to do it the other way around, that is, insert a Hebrew or Arabic word in an English text, just reverse the use of unicodes -- Or follow the steps in the following link: https://superuser.com/a/1247476/767967
If you want to know more about what the special characters do and what it means to make your paragraph LTR or RTL, visit the following link: http://dotancohen.com/howto/rtl_right_to_left.html#Directionality
Select the paragraph (e.g. using triple click) and use the button for right-to-left direction (¶◀) in the Paragraph section of the Start pane.
As Hossein’s answer explains, the issue is the directionality in the paragraph. It changes to left to right when you insert a Latin letter, and you need to fix this manually.
You need to add an invisible RLE Unicode Character at the start of the line [^].
It's : 0x202B hex = 8235 decimal or RIGHT-TO-LEFT EMBEDDING (RLE).
It's necessary for Notepad but MS-Word is able to handle it. you need to right align your text correctly.
How to enter RLE: http://www.fileformat.info/tip/microsoft/enter_unicode.htm
In word processing, you have a main text direction which is either left-to-right or right-to-left (or top to bottom, but let's ignore that :-), and you have a text direction for individual characters, which will also be left to right or right to left.
The word processor splits the text into chunks of strings with the same character ordering, then displays these chunks according to the main text ordering.
It seems that your main text ordering was left to right. As long as all your text is arabic, there is just one chunk with arabic text. You see already it is displayed left aligned and not right aligned because the text ordering is left to right. The characters are displayed right to left because that is how arabic is displayed.
When you inserted latin text, you had three chunks: Arabic, latin, arabic. These three chunks are displayed left to right because that is the main text ordering. That would be fine for text that is mostly latin (like "The arabic words for dog and cow are ... and ..."). For text that is mostly arabic with the occasional latin word, you need to change the main text ordering to "right to left".
Just follow this:
Copy and paste the arabic text into from word or text document to ADOBE Illustrator.
Save the illustrator document as in .EPS format.
Open indesign and place the .EPS document into the place you want.
Since indesign can't handle arabic text issue by it self, this method will help many designers.