Регистрация Вход
Библиотека /
Поиск по библиотекеМоя библиотекаИскать книгу(обмен)

Макросы Ворда для загрузки/выгрузки ASCII

Макросы Ворда для загрузки/выгрузки ASCII


Word --> text only


From: Goff Макрос помечает все выделения курсивом и болдом HTML-ными тагами При сохранении в "Text only" вордовая окраска сохранится как html-ная окраска. Я не знаю, можно ли ставить перекрестные таги в тексте, я имею ввиду конструкцию: nnnnnnnbbbbbbbbbbibibibiibibbibiiiiiiiiiiiiiinnnnn, по краиней мере, если это не допустимо, то дай знать, переделаю Sub MAIN StartOfDocument BOLDCHECK: If AtEndOfDocument() = - 1 Then Goto ENDBOLD If Bold() = 1 Then CharLeft : Insert "" : CharRight : Goto BOLDMODE CharRight Goto BOLDCHECK BOLDMODE: If AtEndOfDocument() = - 1 Then Insert "" : Goto ENDBOLD If Bold() = 0 Then CharLeft : Insert "" : CharRight : Goto BOLDCHECK CharRight Goto BOLDMODE ENDBOLD: StartOfDocument ITALCHECK: If AtEndOfDocument() = - 1 Then Goto ENDITAL If Italic() = 1 Then CharLeft : Insert "" : CharRight : Goto ITALMODE CharRight Goto ITALCHECK ITALMODE: If AtEndOfDocument() = - 1 Then Insert "" : Goto ENDITAL If Italic() = 0 Then CharLeft : Insert "" : CharRight : Goto ITALCHECK CharRight Goto ITALMODE ENDITAL: StartOfDocument UNDCHECK: If AtEndOfDocument() = - 1 Then Goto ENDUND If Underline() = 1 Then CharLeft : Insert "" : CharRight : Goto UNDMODE CharRight Goto UNDCHECK UNDMODE: If AtEndOfDocument() = - 1 Insert "" : Then Goto ENDUND If Underline() = 0 Then CharLeft : Insert "" : CharRight : Goto UNDCHECK CharRight Goto UNDMODE ENDUND: End Sub

Formated ascii --> Word


From: Goff To: moshkow@ipwsun.ras.ru Я работаю в газете, делаю верстку, и когда надоело вносить одну и туже правку в огромных количествах, сделал три макроса для Worda. Думаю, пригодятся, у нас они здорово облегчают работу по подготовке текстов к печати. Архив txtmacro.zip содержит M Filemode Length Date Time File - ---------- -------- ----------- -------- ----------- -rw-r--r-- 13061 29-Jan-1998 07:49:08 readme.txt -rw-r--r-- 39424 29-Jan-1998 07:48:30 normal.dot -rw-r--r-- 21504 29-Jan-1998 07:53:12 general.doc - ---------- -------- ----------- -------- ----------- 73989 3 files В файле normal.dot есть три макроса, они выведены в меню "сервис" reformat rtf - этот убирает прибамбасы после сканирования текста FineReader'ом, конвертируя фреймы и прочую фигню в "плоский" текст, но с сохранением таблиц и параграфов. reformat txt - этот сбивает знак абзаца в конце каждой строки, а дважды повторенный знак абзаца меняет на один. И самый пользительный для наведения красоты, он же повторен в текстовом файле - reformat general - делает много чего, например, убирает сдвоенные пробелы, убирает пробелы перед точками, после открывающих скобок, заменяет короткие тире на человеческие длинные, ну и так далее. Текст после этого реформата выглядит почти безупречно. В конце макроса есть два вложенных цикла, убирающих ненужные пробелы после точек, запятых и двоеточий в датах, дробных числах и т.д. Они здорово удлиняют время работы макроса, поэтому, если эти оставшиеся в численных пробелы менее критичны чем время, то их можно удалить. скроллинг "туда-сюда" документа в конце - всего лишь знак о нормальном окончании работы макроса. !!! макрос сохраняет реформатированный документ без запроса и сразу же закрывает его !!! С наилучшими пожеланиями, надеюсь, что пригодится.

General.macro


Sub MAIN StartOfDocument EditReplace .Find = "EditReplace .Find = "EditReplace .Find = ",-", .Replace = ",- ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = ".-", .Replace = ".- ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = "^p-", .Replace = "^p- ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " " + Chr$(34), .Replace = " " + Chr$(171), .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = "^p" + Chr$(34), .Replace = "^p" + Chr$(171), .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = "-" + Chr$(34), .Replace = "- " + Chr$(171), .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = Chr$(34) + " ", .Replace = Chr$(187) + " ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = Chr$(34) + ".", .Replace = Chr$(187) + ".", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = Chr$(34) + ",", .Replace = Chr$(187) + ",", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = Chr$(34) + "-", .Replace = Chr$(187) + " - ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = Chr$(34) + "^p", .Replace = Chr$(187) + "^p", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = "(" + Chr$(34), .Replace = "(" + Chr$(171), .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = Chr$(34) + ")", .Replace = Chr$(187) + ")", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = "- ", .Replace = " - ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " - ", .Replace = " EditReplace .Find = "(", .Replace = " (", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = ")", .Replace = ") ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " :", .Replace = ": ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " ;", .Replace = "; ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " .", .Replace = ". ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " ,", .Replace = ", ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " !", .Replace = "! ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " ?", .Replace = "? ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = ".", .Replace = ". ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = ",", .Replace = ", ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 For K = 1 To 10 EditReplace .Find = " ", .Replace = " ", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 Next K For L = 1 To 4 EditReplace .Find = ". .", .Replace = "..", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 Next L EditReplace .Find = " )", .Replace = ")", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = "( ", .Replace = "(", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " пед.", .Replace = " Пед.", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = "-пед.", .Replace = "- Пед.", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = ". " + Chr$(187), .Replace = Chr$(187) + ".", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " -", .Replace = "-", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " :", .Replace = ":", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " ;", .Replace = ";", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " .", .Replace = ".", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " ,", .Replace = ",", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " !", .Replace = "!", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " ?", .Replace = "?", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = " %", .Replace = "%", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = ".." + Chr$(187) + ".", .Replace = "..." + Chr$(187), .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = "^p ", .Replace = "^p", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = "EditReplace .Find = Chr$(148), .Replace = Chr$(171), .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = Chr$(147), .Replace = Chr$(187), .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 For n = 48 To 57 For m = 48 To 57 EditReplace .Find = Chr$(n) + ". " + Chr$(m), .Replace = Chr$(n) + "." + Chr$(m), .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = Chr$(n) + ", " + Chr$(m), .Replace = Chr$(n) + "," + Chr$(m), .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 EditReplace .Find = Chr$(n) + ": " + Chr$(m), .Replace = Chr$(n) + ":" + Chr$(m), .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0 Next m Next n VLine 31 VLine - 31 FileSave FileClose End Sub

Наша библиотека является официальным зеркалом библиотеки Максима Мошкова lib.ru

Реклама