Ocenite etot tekst:



---------------------------------------------------------------
     Maksim Bychkov (bmn(a)lib.ru)
     Date: 24 Oct 2003
---------------------------------------------------------------



     Predpolozhim, chto vami ovladela zhazhda sdelat'  chto-nibud'  po-nastoyashchemu
velikoe. Predpolozhim, chto dlya etoj celi  u  vas  imeetsya  tol'ko  komp'yuter,
skaner,  programma  raspoznavaniya  teksta,  neskol'ko  knig   i   nepomernoe
samomnenie, a vojti v istoriyu i tam pobarahtat'sya sil'no hochetsya. Togda  vse
chto  vam  ostaetsya  sdelat',  eto  vzyat'  lyubimuyu  (zhelatel'no   horoshuyu   i
interesnuyu, no mozhno i prosto nuzhnuyu narodu ili  redkuyu)  knigu,  proverit',
net li ee teksta v elektronnom vide gde-nibud' v Internete  i  pristupit'  k
rabote.




     Ustanovka skanera po yarkosti.
     Esli material  predstavlen  v  vide  kachestvennoj  (vysokoj,  ofsetnoj)
pechati shriftom 10 i bolee punktov, to cherno-beloe skanirovanie v  razreshenii
300 tochek s ruchnoj ustanovkoj yarkosti daet bolee chem priemlemye  rezul'taty.
Kolichestvo oshibok na list A4 stremitsya k nulyu  i  kolebletsya  v  rajone  1-5
nepravil'no raspoznannyh znakov. Ustanovku yarkosti mozhno  podobrat'  opytnym
putem, svodya k minimumu pomehi v vide rassypannoj  po  listu  "sypi",  no  v
osnovnom,  yarkost'  na   urovne   45-55%   obespechivaet   horoshee   kachestvo
raspoznavaniya.
     V nekotoryh sluchayah rezonno uvelichit' razreshenie  skanirovaniya  do  400
tochek na dyujm (slozhnye ili nestandartnye shrifty, nechetkaya pechat').
     K skanirovaniyu s razresheniem 600 tochek na dyujm stoit pribegat' tol'ko v
sluchayah esli original napechatan shriftom 9 i menee punktov.




     Ustanoviv v FineReader'e 6.0 (dalee  FR)  opciyu  Tools  ->  Options  ->
Scan/Open Image  ->  Use  TWAIN-Source  interface  vy  poluchite  vozmozhnost'
neposredstvenno upravlyat' processom skanirovaniya cherez klientskuyu  programmu
svoego skanera. To est' vam ne nado budet lihoradochno perelistyvat'  knizhku,
vo vremya obratnogo hoda lampy, i  skanirovaniya  sleduyushchego  razvorota  budet
nachinat'sya tol'ko posle togo, kak vy otdadite komandu putem  tykan'ya  knopki
"Scan" (ili analogichnoj) v programme skanirovaniya.
     Mozhno ustanovit' opciyu "Razrezat' na stranicy"  (Tools  ->  Options  ->
Scan/Open  Image  ->  Split  dual  pages),  kotoraya  oblegchit  kontrol'   za
propushchennymi pri skanirovaniyu stranicami i posleduyushchuyu rabotu s  poluchennymi
izobrazheniyami, a takzhe, veroyatno, uluchshit kachestvo raspoznavaniya, tak kak FR
sam pytaetsya "dovernut'" polovinku stranicy do pravil'nogo, po  ego  mneniyu,
polozheniya. Kartinku razvorota zhe, esli stranicy  "razvalivayutsya"  v  storony
ili skosheny vnutr' ispravit' takim putem nevozmozhno. Odnako u etoj poleznoj,
v sushchnosti, opcii est' i oborotnye  storony.  Pri  skanirovanii  poeticheskih
proizvedenij, stroki  kotoryh  sil'no  razbrosany  po  vertikali,  sluchayutsya
nepriyatnye kazusy v vide razrezaniya otskanirovannogo razvorota ne po  temnoj
polose sgiba, a gorizontal'no, po promezhutku mezhdu strokami.




     Esli  otskanirovannaya  knizhka  byla  oformlena  bez   osobyh   izyskov,
naprimer, eto byl obychnyj prozaicheskij  tekst,  razlityj  po  stranicam  bez
vitievatostej i v odnu kolonku, to mozhno smelo otdavat' komandu  "raspoznat'
vse", posle chego FR s uspehom opravdaet svoe nazvanie. (Ne fakt - bmn)
     Ezheli zhe vy byli original'ny i otskanirovali  knizhku  stihov  ili  pushche
togo, kakuyu-nibud' p'esu, to nastoyatel'no rekomenduyu snachala "vydelit' bloki
na  vseh  stanicah"  (ctrl+shift+E),  potom  posledovatel'no  probezhat'sya  i
prosmotret' vse li pravil'no.
     Osobenno  dostaetsya  p'esam. Bednyj FR staraetsya kak mozhet, no raskryt'
kovarnye zamysly verstal'shchika vkupe s avtorom on ne vsegda v silah. (On i ne
pytaetsya,  a  prosto  fantaziruet,  a  fantaziya  u  nego  oj kakaya bogataya i
neobuzdannaya. - bmn.)
     Esli etot etap uspeshno projden i nazhatie na "Raspoznat' vse" privodit k
"V pakete net neraspoznannyh stranic", mozhno perehodit' k sleduyushchemu etapu.




     Otmetim,  chto  eshche  na  stadii  raspoznavaniya,  nado pomnit' sleduyushchee:
stranicy  na  kotoryh  preobladaet  prozaicheskij  tekst  stoit  raspoznavat'
vklyuchiv opciyu Tools -> Options -> Recognition -> Autodetect i otklyuchiv Tools
->  Options -> Formatting -> Formats Settings -> TXT vse galochki, a stranicy
na  kotoryh  preobladaet  tekst poeticheskij, gde vazhny rasstavlennye avtorom
okonchaniya  strok  (abzacy) neobhodimo raspoznavat' vklyuchiv galochku Keep line
breaks  i  vklyuchiv  opciyu  Tools  ->  Options  ->  Recognition -> Plain text
formatted   with   spaces.  (Ne  soglasen,  dazhe  dlya  prozy  luchshe  derzhat'
vklyuchennymi  galochki  v  opciyah  sohraneniya  "Sohranyat' delenie na stroki" i
"Razdelyat'  abzacy  pustymi strokami". I obyazatel'no postavit' pervyj servis
pak, togda FR budet luchshe opredelyat' konec abzaca. - bmn)

     Bolee  togo,  pri  okonchatel'nom  sohranenii  teksta  v  fajle,   stoit
sohranyat' fajly s prozaicheskim i poeticheskim formatirovaniem  otdel'no,  dlya
posleduyushchej zhe razdel'noj s kazhdym raboty. Okonchatel'noe  ob®edinenie  stoit
proizvodit' tol'ko na zaklyuchitel'nom etape komponovki gotovogo i vychitannogo
fajla. Isklyuchenie sostavlyayut tol'ko ochen' sil'no raznoplanovye teksty, togda
reshenie stoit prinimat' oceniv preobladayushchij tip, pomnya, odnako, chto ubirat'
lishnie razdeliteli abzacev v proze slozhnee. (Ne, ya srazu vse delayu, oshibok
men'she budet pri raznyh "vyrezat'-vkleit'". - bmn)




     Posle sohraneniya poluchaem tekst, gde abzacy rasstavleny  priblizitel'no
tak, kak oni dolzhny stoyat'. Lishnie abzacy stoyat, estestvenno, v nachale novoj
stranicy, a poteri abzacev sluchayutsya chashche vsego  v  dialogah.  |to  pridetsya
otslezhivat' glazkami pri vychitke.
     Sohranyaem poluchennyj tekst kak "Tol'ko tekst".


     Otkryvaem poluchennyj tekst v lyubimom narodom  tekstovom  redaktore  (MS
Word (97 i vyshe)).
     Zamenyaem  "^p"  na "^p " (vozvrat karetki zamenit' na vozvrat karetki i
pyat'  probelov).  (Pri  soglasii  s moimi rekomendaciyami "^p^p" na "^p " dva
vozvrata  karetki  zamenit'  na vozvrat karetki i pyat' probelov. Sub®ektivno
mne  kazhetsya, chto v etom sluchae tochnee opredelyayutsya abzacy, dazhe v dialogah.
- bmn)
     Sohranyaem  fajl  kak  "tekst  DOS"  (s  drugimi  kodirovkami  tekstform
rabotat' ne umeet.
     Progonyaem ego cherez textform (sm. nizhe).
     Otkryvaem snova.


     Rekomenduetsya  sohranyat'  rabotu ne kak "tekst DOS", a kak "tekst DOS s
razbieniem  na  stroki",  tak kak posle raboty nekotoryh vordovskih makrosov
v  tekste  inogda  poyavlyayutsya  lishnie  perevody  strok (ne vozvraty karetki)
kotorye  pri  sohranenii  kak  "tekst DOS" prevrashchayutsya v vozvraty karetki i
portyat kartinku.


     Vot tut-to i nachinaetsya sobstvenno process pravki.

     Nasha cel' - poluchit' tekstovyj fajl maksimal'no svobodnyj ot  oshibok  i
sootvetstvuyushchij trebovaniyam: abzacnyj  otstup  v  5  probelov,  vyravnivanie
probelami po shirine v 76 simvolov, DOS kodirovka.
     Dlya dostizheniya etoj celi my dolzhny sformirovat' fajlik  s,  po  krajnej
mere, vyrovnennoj levoj granicej i ustanovlennymi abzacami.
     V vyravnivanii pravoj granicy nam pomozhet programmka textform,  kotoruyu
mozhno vzyat' vot tut: http://lib.ru/COMPULIB/ocr_bychkov_textfmt.rar
     Prognat'  fajlik  cherez tekstform nastoyatel'no rekomenduetsya kak pered,
tak  i  posle  pravki.  Progon  fajlika pered pravkoj polezen tem, chto takim
obrazom  vse  harakternye  oshibki tekstforma, vrode poter' defisov stoyashchih v
konce  strok,  budut  zamecheny i ispravleny (Esli do togo kak prognat' cherez
textform sdelat' zamenu ".-" na ". - ", ",-" na ", - ", "!-" na "! - ", "?-"
na  "?  -  ",  "s®edennyh"  pravil'nyh  tire budet namnogo men'she, poskol'ku
textform  uzhe  ne  budet  rassmatrivat' takie sluchai kak perenosy. Provereno
opytnym putem. - bmn)
     |to  delo  rabotaet  tol'ko  v  komandnoj  stroke i tol'ko s tekstovymi
fajlikami  v  formate  DOS. Nedostatkom textform'a yavlyaetsya to, chto on rezhet
defisy   okazavshiesya  pered  znakom  vozvrata  karetki,  v  rezul'tate  chego
prihodit'sya  otlavlivat'  konstrukcii vrode "chegonibud'", "ktoto" (Opyat' zhe,
ot  etogo  spasaet posleduyushchaya global'naya zamena, mozhno dazhe makros napisat'
neslozhnyj. - bmn).
     Itogovyj  fajl  sohranyaem  obyazatel'no  kak "tekst DOS c razdeleniem na
stroki",   tak   kak   inache   mogut  propast'  nekotorye  perevody  stroki,
razmechennye  Vordom  ne  kak  "vozvrat  karetki", a kak "razryv stroki", chto
sluchaetsya sravnitel'no chasto posle ispol'zovaniya makrosov.




     Pered pervoj strokoj abzaca stavyatsya pyat' probelov.
     Posle vseh znakov prepinaniya stavyatsya probely. Pered znakom  prepinaniya
probel stavitsya tol'ko pered tire.
     Snoski vnizu stranicy oformlyayutsya tak: {Tekst snoski} i  vstavlyayutsya  v
mesto snoski v osnovnom tekste.
     Ssylki  na  primechaniya  v  konce teksta oformlyayutsya tak [Cifra]. (Ne, ya
ispol'zuyu te zhe figurnye skobki. - bmn)
     Pered zagolovkom glavy ili chasti teksta stavyatsya dva vozvrata karetki.
     Poeticheskij tekst dlya udobstva chteniya oformlyaetsya takzhe kak v knige - v
prostyh  stihah  centriruetsya  pervaya  stroka (Ne pervaya, a srednyaya po dline
pervaya  chasto ochen' dlinnaya ili ochen' korotkaya, pover'te moemu opyty. - bmn)
i po nej centriruetsya vsya ostal'naya chast' stihotvoreniya (makros 3), v slozhno
oformlennyh  i  belyh  stihah  centriruetsya samaya dlinnaya stroka v fragmente
(Opyat'  zhe,  ne  samaya  dlinnaya, a srednyaya. - bmn) i po nej centriruyutsya vse
ostal'nye  (makros  11).  Kogda  tekst  chereschur  slozhnooformlennyj, makrosy
ispol'zuyutsya tol'ko dlya chernovoj podgotovki.
     Kusok poeticheskogo teksta vnutri prozy vydelyaetsya  otbivkami  sverhu  i
snizu.

     Sushchestvenno  oblegchit'  process  pravki  pomogut   neskol'ko   poleznyh
makrosov. Listingi makrosov privodyatsya v Prilozhenii. Redaktor Visual Basic
v Word'e vyzyvaetsya alt+F11.

     1. Makros avtootbivki, kotoryj avtomaticheski ustanavlivaet  5  probelov
pered tekushchej strokoj.
     2. Makros ustanovki  glavy  -  prevrashchaet  stroku  v  stroku-zagolovok,
kotoruyu servernyj skript pomeshchaet v avtogeneriruemoe oglavlenie.
     3. Makros centrirovaniya stroki.  Rabotaet  v  dvuh  rezhimah.  Pervyj  -
centrirovanie stroki probelami  po  centru.  Vtoroj  -  centrirovanie  bloka
(centrirovanie bloka po pervoj stroke i  centrirovanie  po  otcentrirovannoj
pervoj stroke  vsego  bloka).  Dlya  vtorogo  rezhima  blok  strok  neobhodimo
vydelit' pered zapuskom makrosa.
     4. Makros vyravnivaniya po pravomu krayu. Stroka vyravnivaetsya  probelami
po pravomu krayu.
     5. Makros centrirovaniya  s  zashchitoj  ot  popadaniya  v  avtogeneriruemoe
oglavlenie. Ispol'zuetsya kogda nado obojti skript na lib.ru, kotoryj  stroki
nabrannye zaglavnymi bukvami schitaet nazvaniyami glav.
     6. Makrosy vydeleniya ssylki na primechaniya.
     7. Specificheskij makros - razdelenie okna dokumenta na dva okna. Udobno
pol'zovat'sya pri pravke teksta nasyshchennogo primechaniyami i snoskami.
     8. Makros ustanovki tega "kursiv" na vydelennyj kusok  teksta.  Vmesto
tega "kursiv" mozhno vpisat' lyubye html-tegi oformleniya teksta.
     9.  "Poeticheskij"  makros.  Prosmatrivaet  vydelennyj  fragment teksta,
opredelyaet  samuyu  dlinnuyu  stroku  v  vydelennom  fragmente  (Sm.  vyshe pro
oformlenie  poeticheskih  testov.  - bmn) i centriruet ves' vydelennyj massiv
strok po etoj samoj dlinnoj stroke.

     Vse vysheizlozhennoe mozhet byt' prinyato na veru,  no  ne  est'  istina  v
poslednej instancii i yavlyaetsya lish' obobshcheniem lichnogo opyta.

     (Po   rezul'tatam   dlitel'nyh   nablyudenij   mogu  soobshchit'  nekotorye
podrobnosti  o  p'esah.  U  antichnyh  p'es  obychno stroki nachinayutsya s 13-17
simvola, u ispanskih, kak pravilo, isklyuchenij poka mne ne popadalos' - s 25.
U anglijskih - s 21-23 simvola. - bmn)



                               <> Makrosy <>

1) AVTOOTBIVKA

Sub AltEnter()

Selection.HomeKey Unit:=wdLine
Selection.TypeText Text:=" "
Selection.HomeKey Unit:=wdLine
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.TypeText Text:="     "

End Sub

2) GLAVA

Sub CtrlAltShiftEnter()

Selection.HomeKey Unit:=wdLine
Selection.TypeText Text:=" "
Selection.HomeKey Unit:=wdLine
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=""
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=""
Selection.HomeKey Unit:=wdLine
Selection.TypeText Text:="        "

End Sub


3) CENTRIROVANIE

Sub AltE()

1 Dim N As String
3 Dim pos As Integer
2 Dim x, y, i, f, c, j, Mypos  As Integer
4 Dim F1, F2 As String

x = Selection.Start
y = Selection.End
N = ActiveDocument.Range(x, y).Text
F2 = Chr$(13)
f = 1
c = 0

Rem Podschet vozvratov karetki v vydelennom fragmente

20     Mypos = InStr(f, N, F2, 1)
22    If Mypos <> 0 Then f = Mypos + 1: c = c + 1: GoTo 20

Rem Vyravnivanie po centru

Selection.HomeKey Unit:=wdLine
Selection.TypeText Text:=" "
Selection.HomeKey Unit:=wdLine
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
pos = Selection.EndKey(Unit:=wdLine, Extend:=wdMove)
Selection.HomeKey Unit:=wdLine

80 x = Int((76 - pos) / 2)
Rem MsgBox (x)

Rem vyravnivanie po centru pervoj stroki vydeleniya
90 For i = 1 To x
100 Selection.TypeText Text:=" "
110 Next i
Rem vyravnivanie po centru pervoj stroki vydeleniya

Rem vyravnivanie po pervoj stroke vydeleniya vseh ostal'nyh
For j = 1 To c - 1

Selection.HomeKey Unit:=wdLine
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.TypeText Text:=" "
Selection.HomeKey Unit:=wdLine
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
For i = 1 To x
Selection.TypeText Text:=" "
Next i

Next j
j = 0
End Sub

4) VYRAVNIVANIE PO PRAVOMU KRAYU

Sub AltR()

1 Dim N As String
3 Dim pos As Integer
2 Dim x, i As Integer
Selection.TypeText Text:=" "
Selection.HomeKey Unit:=wdLine
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
pos = Selection.EndKey(Unit:=wdLine, Extend:=wdMove)
Selection.HomeKey Unit:=wdLine

80 x = Int((76 - pos))

90 For i = 1 To x
100 Selection.TypeText Text:=" "
110 Next i

End Sub


5) VYRAVNIVANIE PO CENTRU S ZASHCHITOJ

Sub ctrlaltM()
'
Selection.HomeKey Unit:=wdLine
Selection.TypeText Text:=" "
Selection.HomeKey Unit:=wdLine
Selection.Delete Unit:=wdWord, Count:=1
Selection.TypeText Text:="<> "
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" <>"

1    Dim N As String
3 Dim pos As Integer
2 Dim x, y, i, f, c, j, Mypos  As Integer
4 Dim F1, F2 As String

x = Selection.Start
y = Selection.End
N = ActiveDocument.Range(x, y).Text
F2 = Chr$(13)
f = 1
c = 0

Rem Podschet vozvratov karetki v vydelennom fragmente

20     Mypos = InStr(f, N, F2, 1)
22    If Mypos <> 0 Then f = Mypos + 1: c = c + 1: GoTo 20


Rem Vyravnivanie po centru

Selection.HomeKey Unit:=wdLine
Selection.TypeText Text:=" "
Selection.HomeKey Unit:=wdLine
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
pos = Selection.EndKey(Unit:=wdLine, Extend:=wdMove)
Selection.HomeKey Unit:=wdLine

80 x = Int((76 - pos) / 2)


Rem vyravnivanie po centru pervoj stroki vydeleniya

90 For i = 1 To x
100 Selection.TypeText Text:=" "
110 Next i


Rem vyravnivanie po pervoj stroke vydeleniya vseh ostal'nyh

For j = 1 To c - 1
Selection.HomeKey Unit:=wdLine
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.TypeText Text:=" "
Selection.HomeKey Unit:=wdLine
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
For i = 1 To x
Selection.TypeText Text:=" "
Next i

Next j
j = 0

End Sub

4) VYRAVNIVANIE PO PRAVOMU KRAYU

Sub AltR()

1 Dim N As String
3 Dim pos As Integer
2 Dim x, i As Integer
Selection.TypeText Text:=" "
Selection.HomeKey Unit:=wdLine
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
pos = Selection.EndKey(Unit:=wdLine, Extend:=wdMove)
Selection.HomeKey Unit:=wdLine

80 x = Int((76 - pos))

90 For i = 1 To x
100 Selection.TypeText Text:=" "
110 Next i

End Sub

End Sub


6) MAKROSY VYDELENIYA SSYLKI NA PRIMECHANIYA

Odna ciferka

Sub ctrlNum1

Selection.TypeText Text:=" ["
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="]"

End Sub

Dve ciferki

Sub ctrlNum2

Selection.TypeText Text:=" ["
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:="]"

End Sub

Tri ciferki

Sub ctrlNum3

Selection.TypeText Text:=" ["
Selection.MoveRight Unit:=wdCharacter, Count:=3
Selection.TypeText Text:="]"

End Sub


7) MAKROSY RAZDELENIYA OKNA DOKUMENTA

RAZDELITX OKNO DOKUMENTA NA DVA OKNA

Sub ctrl1()

ActiveWindow.SplitVertical = 50

End Sub

PEREHOD IZ ODNOGO OKNA VNUTRI DOKUMENTA V DRUGOE

Sub ctrl`()

ActiveWindow.ActivePane.Next.Activate

End Sub

UBRATX RAZDELENIE OKNA DOKUMENTA

Sub ctrl2()

ActiveWindow.SplitVertical = 0

End Sub


8) Makros ustanovki tega "kursiv"


Sub altI()

Selection.Cut
Selection.TypeText Text:="<I>"
Selection.Paste
Selection.TypeText Text:="</I>"

End Sub


8) "Poeticheskij" makros

Sub ctrlaltE()

1 Dim N As String
3 Dim pos As Integer
2 Dim x, y, i, f, c, j, Mypos  As Integer
4 Dim F1, F2 As String

Rem Esli nichego ne vydeleno, napravlyaemsya na vyhod

If Len(Selection.Text) < 2 Then GoTo 200

Rem Ustranyaem lishnie probely v nachale stroki

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "   "
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "   "
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "   "
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "  "
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p "
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

x = Selection.Start
y = Selection.End
N = ActiveDocument.Range(x, y).Text
F2 = Chr$(13)
f = 1
c = 0
p1 = 0
p2 = 0
ls = 0
lm = 0


Rem Poisk samoj dlinnoj stroki

20     Mypos = InStr(f, N, F2, 1)
22     If Mypos <> 0 Then p2 = Mypos: ls = p2 - p1: f = Mypos + 1: c = c + 1:  p1 = p2
24     If Mypos <> 0 And ls > lm Then lm = ls
25     If Mypos = 0 Then GoTo 30
26 GoTo 20

30      Rem Pryzhok v nachalo vydeleniya

Selection.HomeKey Unit:=wdLine
Selection.TypeText Text:=" "
Selection.HomeKey Unit:=wdLine
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1

Rem Opredelyaem obshchij otstup

x = Int((76 - lm) / 2)

Selection.HomeKey Unit:=wdLine

Rem vyravnivanie pervoj stroki vydeleniya po central'noj pozicii samoj dlinnoj stroki

90 For i = 1 To x
100 Selection.TypeText Text:=" "
110 Next i


Rem vyravnivanie po central'noj pozicii samoj dlinnoj stroki vydeleniya vseh ostal'nyh

For j = 1 To c - 1
Selection.HomeKey Unit:=wdLine
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.TypeText Text:=" "
Selection.HomeKey Unit:=wdLine
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
For i = 1 To x
Selection.TypeText Text:=" "
Next i

Next j

j = 0

200     Rem Ssylka - Esli nichego ne vydeleno -

End Sub


Last-modified: Wed, 29 Oct 2003 10:56:27 GMT
Ocenite etot tekst: