MS Word + Perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting MS Word + Perl
# 1  
Old 07-02-2012
MS Word + Perl

The below snippet will find and replace string in a word document (.doc)..but the string which is replaced is highlighted how to remove the highlighted part..for eg
the string what i want to replace is "Apple" and it is highlighted in yellow color when i replace it with "Grapes" the same color is repeated here also where as i dont want it to be highlighted..the snippet im using is

Code:
 
my $find=$content->Find;
$find->ClearFormatting;
$find->{Text}="Apple";
$find->Replacement->ClearFormatting;
$find->Replacement->{Text}="Grapes";
$find->Execute({Replace=>$wd->{wdReplaceAll},Forward=>$wd->{True}});

# 2  
Old 07-02-2012
And "$content" is an object of?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Word replacement in Perl

I have the following string : Cat dog fox catepillar bear foxy I need to replace "cat" and "fox" words from this sentence to word "animal" I do the following: $Str1="cat"; $Str2="fox"; $NewStr="animal"; open(F1, "<$inputFile") or die "Error: $!"; open(F2, ">$outputFile") or... (1 Reply)
Discussion started by: AIX_30
1 Replies

2. Shell Programming and Scripting

perl lwp find word and print next word :)

hi all, I'm new there, I'm just playing with perl and lwp and I just successfully created a script for log in to a web site with post. I have a response but I would like to have something like this: I have in my response lines like: <div class="sender">mimi020</div> <some html code.....>... (3 Replies)
Discussion started by: vogueestylee
3 Replies

3. UNIX for Dummies Questions & Answers

Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL. I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies

4. Shell Programming and Scripting

extract whole thing in word, leaving behind last word. - perl

Hi, i've a string /u/user/DTE/T_LOGS/20110622_011532_TEST_11_HD_120/HD/TESi T_11_HD_120/hd-12 i need to get string, like /u/user/DTE/T_LOGS/20110622_011532_TEST_11_HD_120/HD the words from HD should get deleted, i need only a string till HD, i dont want to use any built in... (4 Replies)
Discussion started by: asak
4 Replies

5. Shell Programming and Scripting

Perl Cutting character(s) from a word

Hello, How to cut a char(s) for a word using perl?? I want to cut the number(s) from these sample words: Port-channel24 Po78 Po99 Port-channel34 $word = "Port-channel24"; I want to put only the number in a varible. Appreaciate using simple way in order to use it... (3 Replies)
Discussion started by: ahmed_zaher
3 Replies

6. Shell Programming and Scripting

Getting the first word using sed,awk or perl

Input: root:x:0: daemon:x:1: bin:x:2: sys:x:3: adm:x:4: tty:x:5: disk:x:6: lp:x:7: mail:x:8: Output: root daemon bin sys adm tty (8 Replies)
Discussion started by: cola
8 Replies

7. Shell Programming and Scripting

perl (word by word check if a hash key)

Hi, Now i work in a code that 1-get data stored in the database in the form of hash table with a key field which is the " Name" 2-in the same time i open a txt file and loop through it word by word 3- which i have a problem in is that : I need to loop word by word and check if it is a... (0 Replies)
Discussion started by: eng_shimaa
0 Replies

8. Shell Programming and Scripting

Uppercase word in PERL

how do i print uppercase words in a string in PERL For example $str=" welcome to UNIX programming" should print UNIX $str="WELCOME to unix programming" should print WELCOME i itried the following /\s+\w+\b/ $str Can u help me in to get a uppercase word in PERL (3 Replies)
Discussion started by: vkca
3 Replies

9. Shell Programming and Scripting

How to find a particular word in perl

Hi I need the out put for how many times a particular word in a line . How to do it in a perl programme. Please reply ASAP... Regards Harikrishna (2 Replies)
Discussion started by: Harikrishna
2 Replies
Login or Register to Ask a Question