[Date Prev][Date Next][Subject Prev][Subject Next][
Date Index][
Subject Index]
RE: converting without losing formatting
- Subject: RE: converting without losing formatting
- From: "Harrison, Shawn" Shawn_Harrison@xxxxxxxx
- Date: Fri, 12 Mar 1999 13:00:16 -0600
My last attempt at sending Word macros, I notice, bunged up the
characters to do the XyWrite formatting (the "at" symbol and the
"over-score" that appear in other text editors). So I'll send the macros
as an attachment here. Sorry about that. The same instructions apply.
Shawn
==========================
shawn_harrison@xxxxxxxx
==========================
' =====================================================
' Word2Xy
' Tags formatting in a file with XyWrite tags.
' Currently covers bold and italic.
'
Sub MAIN
TagItalic:
StartOfDocument
EditFindClearFormatting
EditFindFont .Italic = 1
EditFind .Find = "", .Format = 1
While EditFindFound()
CharRight
Insert "®MDNM¯"
EditFind .Find = "", .Format = 1
Wend
StartOfDocument
EditFind .Find = "", .Format = 1
While EditFindFound()
FormatFont .Italic = 0
CharLeft
Insert "®MDRV¯"
EditFind .Find = "", .Format = 1
Wend
EditFindClearFormatting
TagBold:
StartOfDocument
EditFindClearFormatting
EditFindFont .Bold = 1
EditFind .Find = "", .Format = 1
While EditFindFound()
CharRight
Insert "®MDNM¯"
EditFind .Find = "", .Format = 1
Wend
StartOfDocument
EditFind .Find = "", .Format = 1
While EditFindFound()
FormatFont .Bold = 0
CharLeft
Insert "®MDBO¯"
EditFind .Find = "", .Format = 1
Wend
EditFindClearFormatting
StartOfDocument
End Sub
' =================================================================
' Xy2Word
' Converts a XyWrite formatted manuscript to Word formatting.
' Current version covers redlining, bold, and italic only.
Sub MAIN
' Converts text marked with ®MDIN¯ (redline inserted) to revisions inserted text
StartOfDocument
EditFindClearFormatting
EditFind .Find = "®MDIN¯"
While EditFindFound()
beginsel = GetSelEndPos()
CharRight
EditFind .Find = "®"
endsel = GetSelStartPos()
SetSelRange beginsel, endsel
If GetSelStartPos() <> GetSelEndPos() Then
EditCut
ToolsRevisions .MarkRevisions = 1
EditPaste
ToolsRevisions .MarkRevisions = 0
End If
EditFind .Find = "®MDIN¯"
Wend
' Converts text marked with ®MDDN¯ (redline deleted) to revisions deleted text
StartOfDocument
EditFind .Find = "®MDDN¯"
While EditFindFound()
beginsel = GetSelEndPos()
CharRight
EditFind .Find = "®"
endsel = GetSelStartPos()
SetSelRange beginsel, endsel
If GetSelStartPos() <> GetSelEndPos() Then
ToolsRevisions .MarkRevisions = 1
EditClear
ToolsRevisions .MarkRevisions = 0
End If
EditFind .Find = "®MDDN¯"
Wend
' Change all text between ®MDRV¯ and the next ® to italic
StartOfDocument
EditFind .Find = "®MDRV¯"
While EditFindFound()
beginsel = GetSelEndPos()
CharRight
EditFind .Find = "®"
endsel = GetSelStartPos()
SetSelRange beginsel, endsel
FormatFont .Italic = 1
CharRight
EditFind .Find = "®MDRV¯"
Wend
' Change all text between ®MDBO¯ and the next ® to Bold
StartOfDocument
EditFind .Find = "®MDBO¯"
While EditFindFound()
beginsel = GetSelEndPos()
CharRight
EditFind .Find = "®"
endsel = GetSelStartPos()
SetSelRange beginsel, endsel
FormatFont .Bold = 1
CharRight
EditFind .Find = "®MDBO¯"
Wend
' Remove the XyWrite Codes
' ** WARNING **
' PUT THIS AFTER ALL OF YOUR FORMAT CONVERSIONS --
' IT WILL WIPE OUT ANY FORMATTING NOT COVERED BY THE MACRO
StartOfDocument
EditReplace .Find = "®*¯", .Replace = "", .PatternMatch, .ReplaceAll
EditReplace .Find = "+", .Replace = Chr$(34), .ReplaceAll
EndOfDocument
DeleteBackWord
StartOfDocument
End Sub