Products  |  Solutions  |  Support  |  Download  |  Order  
   
 Home  |  Forum  |  Knowledge Base  |  Search 


Word Integration

Biblioscape and Word integration is achieved through Window's Dynamic Data Exchange (DDE). Biblioscape and Word can both act as DDE server and client. The following functions are included in the Word template file bib_word.dot.

autoExec: install Biblioscape related menus and toolbar to Word menu system.
papFormat: saves the current document in RTF and send the file path to Biblioscape to format.
papUnformat: saves the current document in RTF and send the file path to Biblioscape to unformat.
htmlPapFormat: saves the current document in HTML and send the file path to Biblioscape to format.
htmlPapUnformat: saves document in HTML and send the file path to Biblioscape to unformat.
searchRef: prompt user to enter search string and sent to Biblioscape to run full text search.
convertGreek: convert Greek letter word into symbol. For example, "alpha" to "
a".

autoExec
Public Sub MAIN()
If WordBasic.[MenuText$](0, WordBasic.CountMenus(0, 1), 1) <> "&Biblioscape" Then
WordBasic.ToolsCustomizeMenuBar MenuText:="&Biblioscape", Add:=1, _
Position:=-1
Else
Rem In case I want to add or remove some menuItem in the future
Rem This way, user do not need to remove menuBar manually
Rem I will remove Biblioscape menuBar each time and then re-add all

WordBasic.ToolsCustomizeMenuBar Menu:="&Biblioscape", Remove:=1
WordBasic.ToolsCustomizeMenuBar MenuText:="&Biblioscape", Add:=1, _
Position:=-1
End If
addMenuBib
End Sub

Private Sub addMenuBib()

WordBasic.ToolsCustomizeMenus Position:=1, Category:=2, Name:="searchRef", _
MenuType:=0, Menu:="Biblioscape", MenuText:="&Search for Reference", _
AddBelow:="", Context:=1, Add:=1

Rem add a sperator
Rem ToolsCustomizeMenus .Position = 2, .Category = 2, .Name = REM"(Separator)", \
Rem .MenuType = 0, .Menu = "Biblioscape", .MenuText = "-", \
Rem .AddBelow = "", .Context = 1, .Add

WordBasic.ToolsCustomizeMenus Position:=3, Category:=2, Name:="papFormat", _
MenuType:=0, Menu:="Biblioscape", MenuText:="&Format Document", _
AddBelow:="", Context:=1, Add:=1
WordBasic.ToolsCustomizeMenus Position:=4, Category:=2, Name:="papUnformat", _
MenuType:=0, Menu:="Biblioscape", MenuText:="&Unformat Document", _
AddBelow:="", Context:=1, Add:=1

Rem add a sperator, html format, and unformat
Rem ToolsCustomizeMenus .Position = 5, .Category = 2, .Name = REM"(Separator)", \
Rem .MenuType = 0, .Menu = "Biblioscape", .MenuText = "-", \
Rem .AddBelow = "", .Context = 1, .Add


WordBasic.ToolsCustomizeMenus Position:=6, Category:=2, Name:="HtmlPapFormat", _
MenuType:=0, Menu:="Biblioscape", MenuText:="HTML - F&ormat Document", _
AddBelow:="", Context:=1, Add:=1
WordBasic.ToolsCustomizeMenus Position:=7, Category:=2, Name:="HtmlPapUnformat", _
MenuType:=0, Menu:="Biblioscape", MenuText:="HTML - U&nformat Document", _
AddBelow:="", Context:=1, Add:=1

Rem add a sperator and convert greek
Rem ToolsCustomizeMenus .Position = 8, .Category = 2, .Name = REM"(Separator)", \
Rem .MenuType = 0, .Menu = "Biblioscape", .MenuText = "-", \
Rem .AddBelow = "", .Context = 1, .Add


WordBasic.ToolsCustomizeMenus Position:=9, Category:=2, Name:="convGreek", _
MenuType:=0, Menu:="Biblioscape", MenuText:="&Convert Greek", _
AddBelow:="", Context:=1, Add:=1

End Sub

papFormat
Public Sub MAIN()
Dim fullDocPath$
Dim myDocPath$
Dim myDocName$
Dim myRTFFile$
Dim chan

Rem turn off show hidden text option
WordBasic.ToolsOptionsView Hidden:=0

Rem First save the existing file as doc format
WordBasic.FileSave

Rem Get file path and file name, so I know where to save the RTF file
fullDocPath$ = WordBasic.[FileName$]()
myDocPath$ = WordBasic.[FileNameInfo$](fullDocPath$, 5)
myDocName$ = WordBasic.[FileNameInfo$](fullDocPath$, 4)
myRTFFile$ = myDocPath$ + myDocName$ + ".RTF"

Rem Then save the existing file as RTF format
Rem WordBasic.FileSaveAs Name:=myRTFFile$, Format:=6, LockAnnot:=0, Password:="", AddToMru:=1, WritePassword:="", RecommendReadOnly:=0, EmbedFonts:=0, NativePictureFormat:=0, FormsData:=0
ActiveDocument.SaveAs FileName:=myRTFFile$, fileformat:=wdFormatRTF

Rem Close the existing file
WordBasic.FileClose

Rem Check if Biblioscape is running, and open a DDE channel
Rem send the save RTF file fullName to let Biblioscape to process
If WordBasic.AppIsRunning("Biblioscape") = 0 Then
WordBasic.MsgBox "Biblioscape is not running, please start Biblioscape first.", "Biblioscape Macro", 16
Else
Rem open a chanel send the path, but do not respond in biblioscape, because
Rem before closing the chanel, DDECommand send to word get no response
chan = WordBasic.DDEInitiate("Biblioscape", "DdeServerConv_scan")
WordBasic.DDEPoke chan, "DdeServerItem_scan", "word; rtfToRtf; " + myRTFFile$
Rem biblioscape will respond to this closeing event, and initiate another DDE link and send in command
WordBasic.DDETerminate chan
End If

End Sub

papUnformat
Public Sub MAIN()
Dim fullDocPath$
Dim myDocPath$
Dim myDocName$
Dim myRTFFile$
Dim chan

Rem First save the existing file as doc format
WordBasic.FileSave

Rem Get file path and file name, so I know where to save the RTF file
fullDocPath$ = WordBasic.[FileName$]()
myDocPath$ = WordBasic.[FileNameInfo$](fullDocPath$, 5)
myDocName$ = WordBasic.[FileNameInfo$](fullDocPath$, 4)
myRTFFile$ = myDocPath$ + myDocName$ + ".RTF"

Rem Then save the existing file as RTF format
Rem WordBasic.FileSaveAs Name:=myRTFFile$, Format:=6, LockAnnot:=0, Password:="", AddToMru:=1, WritePassword:="", RecommendReadOnly:=0, EmbedFonts:=0, NativePictureFormat:=0, FormsData:=0
ActiveDocument.SaveAs FileName:=myRTFFile$, fileformat:=wdFormatRTF

Rem Close the existing file
WordBasic.FileClose

Rem Check if Biblioscape is running, and open a DDE channel
Rem send the save RTF file fullName to let Biblioscape to process
If WordBasic.AppIsRunning("Biblioscape") = 0 Then
WordBasic.MsgBox "Biblioscape is not running, please start Biblioscape first.", "Biblioscape Macro", 16
Else
Rem open a chanel send the path, but do not respond in biblioscape, because
Rem before closing the chanel, DDECommand send to word get no response
chan = WordBasic.DDEInitiate("Biblioscape", "DdeServerConv_scan")
WordBasic.DDEPoke chan, "DdeServerItem_scan", "word; unformatRtfToRtf; " + myRTFFile$
Rem biblioscape will respond to this closeing event, process the file and open another DDE and send in command
WordBasic.DDETerminate chan
End If

End Sub

HtmlPapFormat
Public Sub MAIN()
Dim fullDocPath$
Dim myDocPath$
Dim myDocName$
Dim myHTMFile$
Dim chan

Rem First save the existing file as doc format
WordBasic.FileSave

Rem Get file path and file name, so I know where to save the HTM file
fullDocPath$ = WordBasic.[FileName$]()
myDocPath$ = WordBasic.[FileNameInfo$](fullDocPath$, 5)
myDocName$ = WordBasic.[FileNameInfo$](fullDocPath$, 4)
myHTMFile$ = myDocPath$ + myDocName$ + ".HTM"

Rem Then save the existing file as RTF format
Rem WordBasic.FileSaveAs Name:=myHTMFile$, Format:=100, LockAnnot:=0, Password:="", AddToMru:=1, WritePassword:="", RecommendReadOnly:=0, EmbedFonts:=0, NativePictureFormat:=0, FormsData:=0
ActiveDocument.SaveAs FileName:=myHTMFile$, fileformat:=wdFormatHTML

Rem Close the existing file
WordBasic.FileClose (2)

Rem Check if Biblioscape is running, and open a DDE channel
Rem send the save RTF file fullName to let Biblioscape to process
If WordBasic.AppIsRunning("Biblioscape") = 0 Then
WordBasic.MsgBox "Biblioscape is not running, please start Biblioscape first.", "Biblioscape Macro", 16
Else
Rem open a chanel send the path, but do not respond in biblioscape, because
Rem before closing the chanel, DDECommand send to word get no response
chan = WordBasic.DDEInitiate("Biblioscape", "DdeServerConv_scan")
WordBasic.DDEPoke chan, "DdeServerItem_scan", "word; htmlToHtml; " + myHTMFile$
Rem biblioscape will respond to this closeing event, and initiate another DDE link and send in command
WordBasic.DDETerminate chan
End If

End Sub

HtmlPapUnformat
Public Sub MAIN()
Dim fullDocPath$
Dim myDocPath$
Dim myDocName$
Dim myHTMFile$
Dim chan

Rem First save the existing file as doc format
WordBasic.FileSave

Rem Get file path and file name, so I know where to save the HTM file
fullDocPath$ = WordBasic.[FileName$]()
myDocPath$ = WordBasic.[FileNameInfo$](fullDocPath$, 5)
myDocName$ = WordBasic.[FileNameInfo$](fullDocPath$, 4)
myHTMFile$ = myDocPath$ + myDocName$ + ".HTM"

Rem Then save the existing file as RTF format
Rem WordBasic.FileSaveAs Name:=myHTMFile$, Format:=100, LockAnnot:=0, Password:="", AddToMru:=1, WritePassword:="", RecommendReadOnly:=0, EmbedFonts:=0, NativePictureFormat:=0, FormsData:=0
ActiveDocument.SaveAs FileName:=myHTMFile$, fileformat:=wdFormatHTML

Rem Close the existing file
WordBasic.FileClose (2)

Rem Check if Biblioscape is running, and open a DDE channel
Rem send the save RTF file fullName to let Biblioscape to process
If WordBasic.AppIsRunning("Biblioscape") = 0 Then
WordBasic.MsgBox "Biblioscape is not running, please start Biblioscape first.", "Biblioscape Macro", 16
Else
Rem open a chanel send the path, but do not respond in biblioscape, because
Rem before closing the chanel, DDECommand send to word get no response
chan = WordBasic.DDEInitiate("Biblioscape", "DdeServerConv_scan")
WordBasic.DDEPoke chan, "DdeServerItem_scan", "word; unformatHtmlToHtml; " + myHTMFile$
Rem biblioscape will respond to this closeing event, process the file and open another DDE and send in command
WordBasic.DDETerminate chan
End If

End Sub

searchRef
Public Sub MAIN()
Dim chan
If WordBasic.AppIsRunning("Biblioscape") = 0 Then
WordBasic.MsgBox "Biblioscape is not running, please start Biblioscape first.", "Biblioscape Macro", 16
Else
Rem open a chanel send the path, but do not respond in biblioscape, because
Rem before closing the chanel, DDECommand send to word get no response
chan = WordBasic.DDEInitiate("Biblioscape", "DdeServerConv_scan")
WordBasic.DDEPoke chan, "DdeServerItem_scan", "word; searchRef; " + WordBasic.[InputBox$]("Search Reference: -- Using *, ?, AND, OR, NOT, LIKE, NEAR, double quotes.", "Search for Reference")
Rem biblioscape will respond to this closeing event, and initiate another DDE link and send in command
WordBasic.DDETerminate chan
End If
End Sub

convertGreek
Public Sub MAIN()
WordBasic.StartOfDocument
WordBasic.EditFindClearFormatting
WordBasic.EditReplaceClearFormatting
WordBasic.EditReplaceFont Points:="", Underline:=-1, Color:=-1, StrikeThrough:=-1, Superscript:=-1, Subscript:=-1, Hidden:=-1, SmallCaps:=-1, AllCaps:=-1, Spacing:="", Position:="", Kerning:=-1, KerningMin:="", Tab:="0", Font:="Symbol", Bold:=-1, Italic:=-1
WordBasic.EditReplace Find:="alpha", Replace:="a", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="beta", Replace:="b", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="gamma", Replace:="g", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="delta", Replace:="d", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="epsilon", Replace:="e", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="zeta", Replace:="z", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="eta", Replace:="h", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="theta", Replace:="q", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="iota", Replace:="i", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="kappa", Replace:="k", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="lambda", Replace:="l", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="mu", Replace:="m", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="nu", Replace:="n", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="xi", Replace:="x", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="omicron", Replace:="o", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="pi", Replace:="p", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="rho", Replace:="r", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="sigma", Replace:="s", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="tau", Replace:="t", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="upsilon", Replace:="u", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="phi", Replace:="f", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="chi", Replace:="c", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="psi", Replace:="y", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="omega", Replace:="w", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="ALPHA", Replace:="A", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="BETA", Replace:="B", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="GAMMA", Replace:="G", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="DELTA", Replace:="D", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="EPSILON", Replace:="E", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="ZETA", Replace:="Z", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="ETA", Replace:="H", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="THETA", Replace:="Q", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="IOTA", Replace:="I", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="KAPPA", Replace:="K", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="LAMBDA", Replace:="L", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="MU", Replace:="M", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="NU", Replace:="N", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="XI", Replace:="X", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="OMICRON", Replace:="O", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="PI", Replace:="P", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="RHO", Replace:="R", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="SIGMA", Replace:="S", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="TAU", Replace:="T", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="UPSILON", Replace:="U", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="PHI", Replace:="F", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="CHI", Replace:="C", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="PSI", Replace:="Y", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
WordBasic.EditReplace Find:="OMEGA", Replace:="W", Direction:=0, MatchCase:=1, WholeWord:=1, PatternMatch:=0, SoundsLike:=0, ReplaceAll:=1, Format:=1, Wrap:=1
End Sub


Last updated on August 01, 2008  E-mail us at support@biblioscape.com
© Copyright 1997-2008 CG Information All Rights Reserved