Design  | SFC  |  NOS  |  Code |  Diary  | WWW |  Essay |  Cisco | [Home]
 

[Bill's Home]
[Old Page]

Quick links

Design Tips
WinSock in Visual Basic
WinSock multiserver
DHTML
CSS
Flash/XML
ASP
PHP
JavaScript
Java
Delphi
RSA
WAP
Java Socket Programming
Subnetting
RS-232
Subnetting
Word

Source Code

Pascal
Java
C Programming
Applied PC Interfacing
WinSock client
WinSock server
FTP client
HTTP client
Java client/server
HTTP client
Subnetting in VB
RS-232 in VB
WinSock Multiserver

Concordance file in Word

I use Microsoft Word a great deal in my work, and I've found ways to do virtually everything that is possible in it. I've found all its weaknesses, and bugs, and have overcome most of them. Thus I will try and outlines some of the more difficult (and useful techniques) that I have gained over the years. One of the most difficult tasks is to generate an Index from a number of chapters. The best way to do this is to produce a concordance file.

A concordance file is simple a file which contains a list of words which should be marked as entries in an index. For example:

Example concordance file

SNMP
Wins
Bootp
DNS
DHCP
MIB
ANS.1
PDU
RMON
EASE
bootptab
tunnels
Caches
RFC822
GET       http: GET
HEAD      http: HEAD
POST      http: POST
PUT       http: PUT

The concordance file has two columns. One with the entry to be marked, and the other with the reference that should be used in the index. If the second column does not exist for a given entry then the entry in column one is used. If, in the second column, a reference is seperated by a colon then it is used as a sub-entry, such as:

Example index entry

 

http
    GET 14, 16
    HEAD 17
    POST 22, 25
    PUT 30
RFC822 25, 45

To speed things up even more, it is possible to write a macro to automate everything. In the following example, the concorance file is list.doc, and a document is opened up initially and then the ActiveDocument.Indexes.AutoMarkEntries method is used to mark the entries in the file.

VB Macro code

Documents.Open FileName:="hand_int_c10.doc", ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto

ActiveWindow.ActivePane.View.ShowAll = True
ActiveDocument.Indexes.AutoMarkEntries ConcordanceFileName:= _
"C:\docs\docs_notesd-h\handbook_of_the_internet\list.doc"

ActiveWindow.ActivePane.View.ShowAll = Not ActiveWindow.ActivePane.View. _
ShowAll

ActiveDocument.Close

Documents.Open FileName:="hand_int_c11.doc", ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto

ActiveWindow.ActivePane.View.ShowAll = True

ActiveDocument.Indexes.AutoMarkEntries ConcordanceFileName:= _
"C:\docs\docs_notesd-h\handbook_of_the_internet\list.doc"

ActiveWindow.ActivePane.View.ShowAll = Not ActiveWindow.ActivePane.View. _
ShowAll

ActiveDocument.Close

After a document has a processed it has entries marked with the XE invisible tag. The following shows the invisible tags within the processed document:

The index can then be inserted into the document by simply selecting Insert->Reference->Tables and Index, which gives the following:

In the next article I will show how you can crate a referenced document, which allows you to generate indexes and tables of contents across several documents.