lun. 02 février 2015, 16h32
eddymaue
atoutfox.public.association
Re: Correcteur word ou autre
Je ne suis pas sur d'avoir bien saisi
bref un p'tit bout d'exemple pour faire Recheche/Remplacement
en bleu ce que tu as à modifier
Bonne chance
***********SEARCH AND REPLACE***************
set step on
Public g oWord
g oWord = CREATEOBJECT("word.application")
g oWord.documents.Open("TonDocument.docx")
g oWord.visible = .t.
MESSAGEBOX("I will wait here while you create some text and such in the new word document." ;
+ CHR(13) + "Click OK when you are ready to proceed with the
Search and Replace.", ;
64, "READY TO PROCEED?")
SearchReplaceInDoc(g oWord.activedocument)
*************************
PROCEDURE SearchReplaceInDoc(tcDoc)
*************************
#DEFINE wdEvenPagesHeaderStory 6
#DEFINE wdPrimaryHeaderStory 7
#DEFINE wdEvenPagesFooterStory 8
#DEFINE wdPrimaryFooterStory 9
#DEFINE wdFirstPageHeaderStory 10
#DEFINE wdFirstPageFooterStory 11
LOCAL loRange, loSection, loHeaderFooter, llCheck, lcOld, lcNew
lcOld = "Retirer"
lcNew = "Essais"
FOR EACH loRange IN tcDoc.StoryRanges
IF !INLIST(loRange.StoryType, wdEvenPagesHeaderStory, wdPrimaryHeaderStory, ;
wdEvenPagesFooterStory, wdPrimaryFooterStory, wdFirstPageHeaderStory, ;
wdFirstPageFooterStory)
SearchReplaceInRange(loRange, lcOld, lcNew)
DO WHILE !ISNULL(loRange.NextStoryRange)
loRange = loRange.NextStoryRange
SearchReplaceInRange(loRange, lcOld, lcNew)
ENDDO
ENDIF
NEXT
FOR EACH loSection IN tcDoc.Sections
FOR EACH loHeaderFooter IN loSection.Headers
llCheck = loHeaderFooter.LinkToPrevious
IF NOT llCheck
SearchReplaceInRange(loHeaderFooter.RANGE, lcOld, lcNew)
ENDIF
NEXT
FOR EACH loHeaderFooter IN loSection.Footers
llCheck = loHeaderFooter.LinkToPrevious
IF !llCheck
SearchReplaceInRange(loHeaderFooter.RANGE, lcOld, lcNew)
ENDIF
NEXT
NEXT
ENDPROC
*************************
PROCEDURE SearchReplaceInRange(tcRange, tcOld, tcNew)
*************************
tcRange.FIND.Execute(tcOld,.F.,.T.,.F.,.F.,.F.,.T.,0,.T.,tcNew,2)
ENDPROC
Guy BONEMME a formulé ce lundi :
> Bonjour,
>
> Je cherche une solution pour résoudre le problème suivant.
> D'un texte en Word, j'extrais les mots et le n0 de page correspondant
> dans une table (délimiteur espace) soit +/- 80000 lignes/par document et 160
> documents a traiter..
> Le but est de récupérer les noms propres des personnes.
> Comme il s'agit d'écrits relativement anciens, j'ai constitué une table
> de mots spécifiques généralement non inclus dans les dico. Il sont éliminés
> par une boucle DELETE et un pack.
>
> Pour les ponctuations, articles, verbes et mot courant, j'aimerai utiliser un
> correcteur mot à mot pour effacer par une boucle le maximum des
> enregistrements non désirés. L'idéal serait une table ou un fichier pouvant
> être incorporé dans une table.
> Celà existe-t'il? ou une méthode pour utiliser word
> Une idée?
--
Merci de partager avec moi votre immense savoir que je me ferai plaisir
d'absorber...
il va de soi que je vais vous en laisser un peu
Politesse et savoir vivre oblige ;0)
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000015908