[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

RE: converting without losing formatting



>
> Thanks for helping me clarify. The version is Xyrwite 3.54. A
"normal," is something
> I use in Xywrite which is a formatted piece of text I use over and over
and insert
> into document. I need help doing some of my work. As you know, it is
very hard to
> find someone who knows xywrite well enough to use it or willing to
learn it. They
> will do the work in Word, and I want to be able to give them my Xywrite
"normal"
> (basic skeleten and formatting of a regular report I use in XY) and
have them fill it
> in with the information and then be able to convert it back, or open it
in Xywrite
> without losing the formatting. Is this clearer? If not, let me know.
>
> THanks, Mimi
>

If you know how to write Word macros, you can open the XyWrite template
(what you've called a "normal") in Word directly as Plain Text, and then
run a Word macro that translates the XyWrite formatting codes to Word
formatting. Then, when the documents are finished, you can run another
Word macro to convert from Word formatting to XyWrite formatting codes,
and save the file as Plain Text. Because, XyWrite files are plain ASCII
text, and can be created by Word, but Word files are binary, and cannot
be created or manipulated by XyWrite.

You'll have to do the work of creating the word macros to cover the
formatting you care about. However, I've attach to the end of this
message the text of two Word 6.0 macros to get you started. Just cut and
paste these macros into blank macro windows in Word, and go from there.
You can follow the pattern of these and fill in the other types of
formatting you want to translate.

Hope that helps,
Shawn
==========================
shawn_harrison@xxxxxxxx
==========================

*** WORD 6.0 MACRO TO CONVERT XYWRITE FILE TO WORD FORMATTING **

' Xy2Word
' 	Converts a XyWrite formatted manuscript to Word formatting.
'	Current version covers redlining, bold, and italic only.

Sub MAIN

' Converts text marked with rMDIN_ (redline inserted) to revisions
inserted text
		StartOfDocument
		EditFindClearFormatting
		EditFind .Find = "rMDIN_"
		While EditFindFound()
			beginsel = GetSelEndPos()
			CharRight
			EditFind .Find = "r"
			endsel = GetSelStartPos()
			SetSelRange beginsel, endsel
			If GetSelStartPos() <> GetSelEndPos() Then
				EditCut
				ToolsRevisions .MarkRevisions = 1
				EditPaste
				ToolsRevisions .MarkRevisions = 0
			End If
			EditFind .Find = "rMDIN_"
		Wend

' Converts text marked with rMDDN_ (redline deleted) to revisions deleted
text
		StartOfDocument
		EditFind .Find = "rMDDN_"
		While EditFindFound()
			beginsel = GetSelEndPos()
			CharRight
			EditFind .Find = "r"
			endsel = GetSelStartPos()
			SetSelRange beginsel, endsel
			If GetSelStartPos() <> GetSelEndPos() Then
				ToolsRevisions .MarkRevisions = 1
				EditClear
				ToolsRevisions .MarkRevisions = 0
			End If
			EditFind .Find = "rMDDN_"
		Wend

' Change all text between rMDRV_ and the next r to italic
		StartOfDocument
		EditFind .Find = "rMDRV_"
		While EditFindFound()
			beginsel = GetSelEndPos()
			CharRight
			EditFind .Find = "r"
			endsel = GetSelStartPos()
			SetSelRange beginsel, endsel
			FormatFont .Italic = 1
			CharRight
			EditFind .Find = "rMDRV_"
		Wend

' Change all text between rMDBO_ and the next r to Bold
		StartOfDocument
		EditFind .Find = "rMDBO_"
		While EditFindFound()
			beginsel = GetSelEndPos()
			CharRight
			EditFind .Find = "r"
			endsel = GetSelStartPos()
			SetSelRange beginsel, endsel
			FormatFont .Bold = 1
			CharRight
			EditFind .Find = "rMDBO_"
		Wend

' Remove the XyWrite Codes
'	** WARNING **
' 	PUT THIS ROUTINE AFTER ALL OF YOUR FORMAT CONVERSIONS --
'	IT WILL WIPE OUT ANY FORMATTING NOT COVERED BY THE MACRO
		StartOfDocument
		EditReplace .Find = "r*_", .Replace = "", .PatternMatch, .ReplaceAll
		EditReplace .Find = "+", .Replace = Chr$(34), .ReplaceAll
		EndOfDocument
		DeleteBackWord
		StartOfDocument
End Sub


*** WORD 6.0 MACRO TO TAG FORMATTED WORD FILE WITH XYWRITE FORMATTING **

' tagformatting
'	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 "rMDNM_"
		EditFind .Find = "", .Format = 1
	Wend
	StartOfDocument
	EditFind .Find = "", .Format = 1
	While EditFindFound()
		FormatFont .Italic = 0
		CharLeft
		Insert "rMDRV_"
		EditFind .Find = "", .Format = 1
	Wend
	EditFindClearFormatting

TagBold:
	StartOfDocument
	EditFindClearFormatting
	EditFindFont .Bold = 1
	EditFind .Find = "", .Format = 1
	While EditFindFound()
		CharRight
		Insert "rMDNM_"
		EditFind .Find = "", .Format = 1
	Wend
	StartOfDocument
	EditFind .Find = "", .Format = 1
	While EditFindFound()
		FormatFont .Bold = 0
		CharLeft
		Insert "rMDBO_"
		EditFind .Find = "", .Format = 1
	Wend
	EditFindClearFormatting

StartOfDocument
End Sub