Etudes for Microsoft Word Programmers

Home ] Up ] Etude 3.1. Working with Document Properties. ] Etude 3.2. Customizing Drag-n-Drop for Document Window ] Etude 3.3. Microsoft Word as Automation Server. ] Etude 3.4. Transcriber ]


  Server -
1. A person whose occupation is to serve at table (as in a restaurant).
 

http://www.websters-online-dictionary.org/definition/server

Etude 3.3. Microsoft Word as Automation Server

The utility WordCount meant for the making of Microsoft Word documents words and styles usage statistics vocabulary is described in this etude.

++ proxy class creation on the basis of type library is considered in the etude. The brief review of the projects using automation is presented as well.


Contents

What is Automation
Brief Review of Projects that use Automation
Microsoft Word
Type Libraries
Creating C++ Proxy based on Type Library
Header file "msword9.h"
Implementation file "msword9.pp"
Resources
Functional Specification
Conclusion
Tasks


What is Automation

Automation (OLE Automation) usually means the possibility to use (call) automation server functions (automation server is Microsoft Word in this etude) from the scripts (for instance, Visual Basic Script or Java Script) or from the programs written on programming languages (VB, VBA, C++, etc.). Scripts or programs that use automation server functions are called automation clients.

For example, the following script (VBScript) opens the file "D:\1.DOC" and saves it in the file "D:\1.RTF".

'
' File AhDoc2RTF.vbs
'
' Etudes for Microsoft Word Programmers.
' Etude 3.3. Word as Automation Server.
'
' First published on http://www.transcriber.ru
'
' 2000-2009. Evgeny Akhundzhanov. All rights reserved worldwide.
'
Set objWord = CreateObject("Word.Application")
objWord.Application.ChangeFileOpenDirectory "D:\"
objWord.Documents.Open "1.doc"
objWord.ActiveDocument.SaveAs "1.rtf", 6 ' wdFormatRTF
objWord.ActiveDocument.Close

The script can be launched directly by a double click from the Windows Explorer or by the following command line.

cscript //nologo AhDoc2RTF.vbs

The corresponding VBA macro looks like this -

'
' File AhDoc2RTF.dot
'
' Etudes for Microsoft Word Programmers.
' Etude 3.3. Word as Automation Server.
'
' First published on http://www.transcriber.ru
'
' 2000-2009. Evgeny Akhundzhanov. All rights reserved worldwide.
'
Sub AhDoc2RTF()
ChangeFileOpenDirectory "D:\"
Documents.Open FileName:="2.doc", ConfirmConversions:=False, ReadOnly:= _
False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:= _
"", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", _
Format:=wdOpenFormatAuto, XMLTransform:=""
ActiveDocument.SaveAs FileName:="2.rtf", FileFormat:=wdFormatRTF, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
End Sub

 

All Microsoft Office programs, Windows Media Player and also Adobe Photoshop, Adobe InDesign and many others support automation.

You get to know all the programs supporting automation installed on the computer by selecting the "Tools\References" menu item from the Visual Basic editor main menu. Just start Microsoft Word and press Alt+F11 to open Visual Basic editor.

Brief Review of the Projects that use Automation

The screenshots and hyperlinks of some automation using projects are given in the table below.

Screenshot Project

Active Document Containers

Andrew Garbuzov, September 29, 1998.

Using MS Office in MFC application

Igor Tkachev, May 15, 2000.

OLE Automation with MS Word

Anish C.V., February 15, 2002.

 

Microsoft Office Applications automation in examples

Microsoft Office

Natalia Elmanova, Dec 23, 2005.

A brilliant article from Martin Greens site Office Tips which describes in detail how to use the standard element Calendar in your VBA projects.

http://www.fontstuff.com/word/wordtut03a.htm
The system Live Documents (Web-enabling Microsoft Office) by InstaColl company. There is such a phrase in requirements (to a candidate) of the InstaColl company:

"Knowledge of office automation using VC++ is an advantage".

   

You can easily find dozens other projects using OLE Automation searching "ActiveX" or "OLE Automation.

 


Microsoft Word Type Libraries

The type library file names and their location for different Microsoft Word versions are given in the following table.

Word Version

Type Library

Folder

Word 97

MSWORD8.OLB

...

Word 2000

MSWORD9.OLB

C:\Program Files\Microsoft Office\Office

Word XP

MSWORD10.OLB

C:\Program Files\Microsoft Office\OFFICE10

Word 2003

MSWORD11.OLB

C:\Program Files\Microsoft Office\OFFICE11

Word 2007

MSWORD12.OLB

C:\Program Files\Microsoft Office\OFFICE12

Creating C++ Proxy based on type library

The given screenshots are taken from Visual Studio 6.0

Use ClassWizard for automatic new classes generation on the basis of type library. Select Automation tab, press "Add Class" and select "From a type library" item from the popup menu.

 

In the "Import from type Library" dialog pick the type library file for the required Microsoft Word version. For Microsoft Word 2000 it is MSWORD9.OLB  and it is usually situated in the folder: "C:\Program Files\Microsoft Office\Office".

After pressing the "Open" button the "Confirm Classes" dialog appears allowing to select the necessary names and classes for the header file and implementation file.

 

The classes implementation code is generated automatically and the corresponding files are automatically added to the current Visual Studio project. ClassWizard generates the wrapper classes automatically; wrappers work with IDispatch interface of the Microsoft Word objects. It is seen from the examples of the source codes given below.

Comparing the generated files "mswordXXX.h" (where XXX = 8,9,10,11,12) for different Microsoft Word versions (for example, with the help of windiff utility) you can see the changes of the Microsoft Word object model.

Header "msword9.h"

The "MSWord9.h" file contains about 9000 lines. The code of the announcement of the class _Application is given as an example.

// Machine generated IDispatch wrapper class(es) created with ClassWizard
// _Application wrapper class
 
class _Application : public COleDispatchDriver
{
public:
      _Application() {}       // Calls COleDispatchDriver default constructor
      _Application(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
      _Application(const _Application& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
 
// Attributes
public:
 
// Operations
public:
      LPDISPATCH GetApplication();
      long GetCreator();
      LPDISPATCH GetParent();
      CString GetName();
      LPDISPATCH GetDocuments();
      LPDISPATCH GetWindows();
      LPDISPATCH GetActiveDocument();
      LPDISPATCH GetActiveWindow();
      LPDISPATCH GetSelection();
      LPDISPATCH GetWordBasic();
      LPDISPATCH GetRecentFiles();
      LPDISPATCH GetNormalTemplate();
      LPDISPATCH GetSystem();
      LPDISPATCH GetAutoCorrect();
      LPDISPATCH GetFontNames();
      LPDISPATCH GetLandscapeFontNames();
      LPDISPATCH GetPortraitFontNames();
      LPDISPATCH GetLanguages();
      LPDISPATCH GetAssistant();
      LPDISPATCH GetBrowser();
      LPDISPATCH GetFileConverters();
      LPDISPATCH GetMailingLabel();
      LPDISPATCH GetDialogs();
      LPDISPATCH GetCaptionLabels();
      LPDISPATCH GetAutoCaptions();
      LPDISPATCH GetAddIns();
      BOOL GetVisible();
      void SetVisible(BOOL bNewValue);
      CString GetVersion();
      BOOL GetScreenUpdating();
      void SetScreenUpdating(BOOL bNewValue);
      BOOL GetPrintPreview();
      void SetPrintPreview(BOOL bNewValue);
      LPDISPATCH GetTasks();
      BOOL GetDisplayStatusBar();
      void SetDisplayStatusBar(BOOL bNewValue);
      BOOL GetSpecialMode();
      long GetUsableWidth();
      long GetUsableHeight();
      BOOL GetMathCoprocessorAvailable();
      BOOL GetMouseAvailable();
      VARIANT GetInternational(long Index);
      CString GetBuild();
      BOOL GetCapsLock();
      BOOL GetNumLock();
      CString GetUserName_();
      void SetUserName(LPCTSTR lpszNewValue);
      CString GetUserInitials();
      void SetUserInitials(LPCTSTR lpszNewValue);
      CString GetUserAddress();
      void SetUserAddress(LPCTSTR lpszNewValue);
      LPDISPATCH GetMacroContainer();
      BOOL GetDisplayRecentFiles();
      void SetDisplayRecentFiles(BOOL bNewValue);
      LPDISPATCH GetCommandBars();
      LPDISPATCH GetSynonymInfo(LPCTSTR Word, VARIANT* LanguageID);
      LPDISPATCH GetVbe();
      CString GetDefaultSaveFormat();
      void SetDefaultSaveFormat(LPCTSTR lpszNewValue);
      LPDISPATCH GetListGalleries();
      CString GetActivePrinter();
      void SetActivePrinter(LPCTSTR lpszNewValue);
      LPDISPATCH GetTemplates();
      LPDISPATCH GetCustomizationContext();
      void SetCustomizationContext(LPDISPATCH newValue);
      LPDISPATCH GetKeyBindings();
      LPDISPATCH GetKeysBoundTo(long KeyCategory, LPCTSTR Command, VARIANT* CommandParameter);
      LPDISPATCH GetFindKey(long KeyCode, VARIANT* KeyCode2);
      CString GetCaption();
      void SetCaption(LPCTSTR lpszNewValue);
      CString GetPath();
      BOOL GetDisplayScrollBars();
      void SetDisplayScrollBars(BOOL bNewValue);
      CString GetStartupPath();
      void SetStartupPath(LPCTSTR lpszNewValue);
      long GetBackgroundSavingStatus();
      long GetBackgroundPrintingStatus();
      long GetLeft();
      void SetLeft(long nNewValue);
      long GetTop();
      void SetTop(long nNewValue);
      long GetWidth();
      void SetWidth(long nNewValue);
      long GetHeight();
      void SetHeight(long nNewValue);
      long GetWindowState();
      void SetWindowState(long nNewValue);
      BOOL GetDisplayAutoCompleteTips();
      void SetDisplayAutoCompleteTips(BOOL bNewValue);
      LPDISPATCH GetOptions();
      long GetDisplayAlerts();
      void SetDisplayAlerts(long nNewValue);
      LPDISPATCH GetCustomDictionaries();
      CString GetPathSeparator();
      void SetStatusBar(LPCTSTR lpszNewValue);
      BOOL GetMAPIAvailable();
      BOOL GetDisplayScreenTips();
      void SetDisplayScreenTips(BOOL bNewValue);
      long GetEnableCancelKey();
      void SetEnableCancelKey(long nNewValue);
      BOOL GetUserControl();
      LPDISPATCH GetFileSearch();
      long GetMailSystem();
      CString GetDefaultTableSeparator();
      void SetDefaultTableSeparator(LPCTSTR lpszNewValue);
      BOOL GetShowVisualBasicEditor();
      void SetShowVisualBasicEditor(BOOL bNewValue);
      CString GetBrowseExtraFileTypes();
      void SetBrowseExtraFileTypes(LPCTSTR lpszNewValue);
      BOOL GetIsObjectValid(LPDISPATCH Object);
      LPDISPATCH GetHangulHanjaDictionaries();
      LPDISPATCH GetMailMessage();
      BOOL GetFocusInMailHeader();
      void Quit(VARIANT* SaveChanges, VARIANT* OriginalFormat, VARIANT* RouteDocument);
      void ScreenRefresh();
      void LookupNameProperties(LPCTSTR Name);
      void SubstituteFont(LPCTSTR UnavailableFont, LPCTSTR SubstituteFont);
      BOOL Repeat(VARIANT* Times);
      void DDEExecute(long Channel, LPCTSTR Command);
      long DDEInitiate(LPCTSTR App, LPCTSTR Topic);
      void DDEPoke(long Channel, LPCTSTR Item, LPCTSTR Data);
      CString DDERequest(long Channel, LPCTSTR Item);
      void DDETerminate(long Channel);
      void DDETerminateAll();
      long BuildKeyCode(long Arg1, VARIANT* Arg2, VARIANT* Arg3, VARIANT* Arg4);
      CString KeyString(long KeyCode, VARIANT* KeyCode2);
      void OrganizerCopy(LPCTSTR Source, LPCTSTR Destination, LPCTSTR Name, long Object);
      void OrganizerDelete(LPCTSTR Source, LPCTSTR Name, long Object);
      void OrganizerRename(LPCTSTR Source, LPCTSTR Name, LPCTSTR NewName, long Object);
      // method 'AddAddress' not emitted because of invalid return type or parameter type
      CString GetAddress(VARIANT* Name, VARIANT* AddressProperties, VARIANT* UseAutoText, VARIANT* DisplaySelectDialog, VARIANT* SelectDialog, VARIANT* CheckNamesDialog, VARIANT* RecentAddressesChoice, VARIANT* UpdateRecentAddresses);
      BOOL CheckGrammar(LPCTSTR String);
      BOOL CheckSpelling(LPCTSTR Word, VARIANT* CustomDictionary, VARIANT* IgnoreUppercase, VARIANT* MainDictionary, VARIANT* CustomDictionary2, VARIANT* CustomDictionary3, VARIANT* CustomDictionary4, VARIANT* CustomDictionary5,
            VARIANT* CustomDictionary6, VARIANT* CustomDictionary7, VARIANT* CustomDictionary8, VARIANT* CustomDictionary9, VARIANT* CustomDictionary10);
      void ResetIgnoreAll();
      LPDISPATCH GetSpellingSuggestions(LPCTSTR Word, VARIANT* CustomDictionary, VARIANT* IgnoreUppercase, VARIANT* MainDictionary, VARIANT* SuggestionMode, VARIANT* CustomDictionary2, VARIANT* CustomDictionary3, VARIANT* CustomDictionary4,
            VARIANT* CustomDictionary5, VARIANT* CustomDictionary6, VARIANT* CustomDictionary7, VARIANT* CustomDictionary8, VARIANT* CustomDictionary9, VARIANT* CustomDictionary10);
      void GoBack();
      void Help(VARIANT* HelpType);
      void AutomaticChange();
      void ShowMe();
      void HelpTool();
      LPDISPATCH NewWindow();
      void ListCommands(BOOL ListAllCommands);
      void ShowClipboard();
      void OnTime(VARIANT* When, LPCTSTR Name, VARIANT* Tolerance);
      void NextLetter();
      short MountVolume(LPCTSTR Zone, LPCTSTR Server, LPCTSTR Volume, VARIANT* User, VARIANT* UserPassword, VARIANT* VolumePassword);
      CString CleanString(LPCTSTR String);
      void SendFax();
      void ChangeFileOpenDirectory(LPCTSTR Path);
      void GoForward();
      void Move(long Left, long Top);
      void Resize(long Width, long Height);
      float InchesToPoints(float Inches);
      float CentimetersToPoints(float Centimeters);
      float MillimetersToPoints(float Millimeters);
      float PicasToPoints(float Picas);
      float LinesToPoints(float Lines);
      float PointsToInches(float Points);
      float PointsToCentimeters(float Points);
      float PointsToMillimeters(float Points);
      float PointsToPicas(float Points);
      float PointsToLines(float Points);
      void Activate();
      float PointsToPixels(float Points, VARIANT* fVertical);
      float PixelsToPoints(float Pixels, VARIANT* fVertical);
      void KeyboardLatin();
      void KeyboardBidi();
      void ToggleKeyboard();
      long Keyboard(long LangId);
      CString ProductCode();
      LPDISPATCH DefaultWebOptions();
      void SetDefaultTheme(LPCTSTR Name, long DocumentType);
      CString GetDefaultTheme(long DocumentType);
      LPDISPATCH GetEmailOptions();
      long GetLanguage();
      LPDISPATCH GetCOMAddIns();
      BOOL GetCheckLanguage();
      void SetCheckLanguage(BOOL bNewValue);
      LPDISPATCH GetLanguageSettings();
      LPDISPATCH GetAnswerWizard();
      long GetFeatureInstall();
      void SetFeatureInstall(long nNewValue);
      void PrintOut(VARIANT* Background, VARIANT* Append, VARIANT* Range, VARIANT* OutputFileName, VARIANT* From, VARIANT* To, VARIANT* Item, VARIANT* Copies, VARIANT* Pages, VARIANT* PageType, VARIANT* PrintToFile, VARIANT* Collate,
            VARIANT* FileName, VARIANT* ActivePrinterMacGX, VARIANT* ManualDuplexPrint, VARIANT* PrintZoomColumn, VARIANT* PrintZoomRow, VARIANT* PrintZoomPaperWidth, VARIANT* PrintZoomPaperHeight);
      VARIANT Run(LPCTSTR MacroName, VARIANT* varg1, VARIANT* varg2, VARIANT* varg3, VARIANT* varg4, VARIANT* varg5, VARIANT* varg6, VARIANT* varg7, VARIANT* varg8, VARIANT* varg9, VARIANT* varg10, VARIANT* varg11, VARIANT* varg12, VARIANT* varg13,
            VARIANT* varg14, VARIANT* varg15, VARIANT* varg16, VARIANT* varg17, VARIANT* varg18, VARIANT* varg19, VARIANT* varg20, VARIANT* varg21, VARIANT* varg22, VARIANT* varg23, VARIANT* varg24, VARIANT* varg25, VARIANT* varg26, VARIANT* varg27,
            VARIANT* varg28, VARIANT* varg29, VARIANT* varg30);
};

Implementation "msword9.pp"

The "MSWord9.cpp" file contains about 35 and a half thousand lines. The code of the several functions implementation of the class _Application is given as an example.

// Machine generated IDispatch wrapper class(es) created with ClassWizard
 
#include "stdafx.h"
#include "msword9.h"
 
LPDISPATCH _Application::GetApplication()
{
LPDISPATCH result;
InvokeHelper(0x3e8, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
return result;
}
 
long _Application::GetCreator()
{
long result;
InvokeHelper(0x3e9, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
 
CString _Application::GetName()
{
CString result;
InvokeHelper(0x0, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
return result;
}
 
LPDISPATCH _Application::GetDocuments()
{
LPDISPATCH result;
InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
return result;
}
 
LPDISPATCH _Application::GetActiveDocument()
{
LPDISPATCH result;
InvokeHelper(0x3, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
return result;
}
 
LPDISPATCH _Application::GetSelection()
{
LPDISPATCH result;
InvokeHelper(0x5, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
return result;
}
 
void _Application::SetScreenUpdating(BOOL bNewValue)
{
static BYTE parms[] = VTS_BOOL;
InvokeHelper(0x1a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, bNewValue);
}

 
void _Application::HelpTool()
{
InvokeHelper(0x14c, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
 
float _Application::InchesToPoints(float Inches)
{
float result;
static BYTE parms[] = VTS_R4;
InvokeHelper(0x172, DISPATCH_METHOD, VT_R4, (void*)&result, parms, Inches);
return result
;
}


Resources

Utility "WordCount.exe" and  "AhWordCount.dll", 203 Kb, ZIP,  [download].

WordCount [!].

"WordCount" Home page.

Functional Specificaton

Task

The Autotext feature is usually used to speed up keying in the repeated text fragments. You should have a list of the most  repeated words and sentences if you want to make an autotext dictionary.

The program is necessary which analyses the given document or all documents in the given folder and builds a word usage statistics dictionary.

Purpose

The "WordCount.exe" program is aimed at counting the frequency of word usage and style usage in the selected Microsoft Word document or in all documents of the selected folder. The received information can be used when one needs to build autotext deictionary or style usage statistics.

The Program uses Microsoft Word as automation server. Microsoft Word should be installed on the users computer for the successful work of the Program.

Brief Description

The main program window in the file  picking mode looks like this:

The main "WordCount.exe" program window in the folder picking mode looks like this:

The Browse button allows picking the necessary document or folder depending on the selected mode. The Run button launches the process of statistics collection at the end of which the "Words Statistics" or "Styles Statistics" dialog appears.

The "Words/Styles Statistics" dialog allows saving the received results in the file of XML format.

Example of the XML output (Words)

  <?xml version="1.0" encoding="UTF-8" ?>
<!--
Created by AhWordCount.dll. Time = May 14, 2007. 16:03:01
  -->
<!--
 2000-2007. Evgeny Akhundzhanov. All rights reserved worldwide.
  -->
<!--
See details on "C++ Etudes" page on http://www.transcriber.ru
  -->
<!--
Words Statistics
  -->
<!--
WordCount.exe reports:
  -->
- <Document>
  <FilePath>Pokonos.doc</FilePath>
- <Words>
  <Word Name="Pocono" Count="18" />
  <Word Name="Poconos" Count="17" />
  <Word Name="Stroudsburg" Count="13" />
  <Word Name="through" Count="10" />
  <Word Name="Delaware" Count="10" />
  <Word Name="shops" Count="9" />
  <Word Name="summer" Count="9" />
  <Word Name="local" Count="8" />
  <Word Name="their" Count="8" />
  <Word Name="around" Count="7" />
  <Word Name="River" Count="7" />
  <Word Name="great" Count="7" />
  <Word Name="music" Count="7" />
  <Word Name="place" Count="7" />
  <Word Name="there" Count="7" />
  <Word Name="Mountain" Count="6" />
  <Word Name="There" Count="6" />
  <Word Name="Shawnee" Count="6" />
  <Word Name="Street" Count="6" />
  <Word Name="fishing" Count="6" />
  <Word Name="cooking" Count="5" />
  <Word Name="dancing" Count="5" />
  <Word Name="favorite" Count="5" />
  <Word Name="Festival" Count="5" />
  <Word Name="foliage" Count="5" />
  <Word Name="Mount" Count="5" />
  <Word Name="Pennsylvania" Count="5" />
  <Word Name="Tannersville" Count="5" />
  <Word Name="people" Count="5" />
  <Word Name="Victorian" Count="5" />
  <Word Name="popular" Count="5" />
  <Word Name="region" Count="5" />
  <Word Name="rides" Count="5" />
  <Word Name="Water" Count="5" />
  <Word Name="small" Count="5" />
  <Word Name="average" Count="5" />
  <Word Name="bands" Count="5" />
  <Word Name="Creek" Count="5" />
  <Word Name="can't" Count="5" />
  </Words>
  </Document>

Example of the XML output for Styles could be found on the WordCount home page.

Experiments showed that the program spends about 0.12 seconds to process 1 object. To be more exact, the program spent 365 seconds to process the document containing 3160 words.

NB! Data collection may take several minutes.

Begin experimenting with short documents.

Conclusion

Automation (OLE Automation) and C++ class creation on the basis of automation server type libraries are studied in this etude.

The "WordCount.exe" program is created. It collects the word and style statistics of a selected document or of all documents of a selected folder. The program uses Microsoft Word as automation server. The output statistics can be used in making autotext dictionaries, for instance.

Tasks

Task 1

                  

At the first appearance of HTML, this technology was fantastically informal, indistinct and liberal.
I remember the Microsoft Office project director say disdainfully in 1995 that HTML will never be successful because of its primitivity and Word will win because Word documents have rich potential and their structure is fully formalized.

 

 

Adam Bosworth on ICSO04.
Backward translation from Russian edition of the "More Joel on Software" by  Joel Spolsky.

 

Microsoft Word documents (files with .DOC extension) can be opened only in Microsoft Word.

The Microsoft Word documents format is very complex. The .DOC format description is now open but the situation is none the better for it as the complexity of the internal structure of Microsoft Word documents reflects, in a way, more than  twenty years old history of all Microsoft Word editions.

See what Joel Spolsky writes about it in the article Why are the Microsoft Office file formats so complicated?

As I see it, Microsoft is late with conversion to the open document format at least for fifteen years.

Nowadays with the appearance of portable hard drives and flash cards more and more people carry their data with them in a direct  sense. And gigabytes on portable data media become cheaper every day.

The necessity of reading documents may arise in the cybercafé, on holidays or at a friends place. Sometimes you can be given a computer not only without Microsoft Word but also without Windows (operational systems like Mac OS X or Linux become more and more popular).

The problem is also 100% actual concerning old data saved on CDs and DVDs.

Under these conditions the topical task is to convert or reconvert (old format) data into some open format like RTF or HTML. In fact, it can be any open format with which you can work in free WordPad editor or HTML, which you can open in any browser on any operational system.

Write a program or a macro which recursively sorts out all DOC documents in the selected folder and converts them into any open format  (RTF, HTML or XML whichever you prefer).

See also the page devoted to the AhDocResaver utility.

 

Task 2

Is it possible to gather word statistics with the help of a script? Write the necessary script.

 

Task 3

Besides the word combination "OLE Automation", another one, OLE Linking and Embedding is also usually associated with the OLE technology. So study the potential of the Microsoft Word menu item "Insert\Object".

The publishing houses requirements to the manuscript formatting almost always contain phrases like: The illustrations may be inserted directly to the text of the publication but links are no way allowed or The illustrations to the book are submitted as separate files.

Why in your opinion the publishing houses do not want to accept the manuscripts with the pictures inserted by links?

 

Task 4

Think of several criteria to compare the formats of compound documents and the technologies of working with them. Add them to the table below. Fill in the table of OLE and HTML comparison. Add the columns for other technologies if necessary.

Criteria OLE HTML
Popularity    
Required Software    
The Simplicity of Study and Usage    
Your Criteria 1    
Your Criteria 2    
Your Criteria 3    

 

 


Etudes for Microsoft Word Programmers.
Etude 3.3. Microsoft Word as Automation Server


Unless otherwise noted, all materials on this site are
2000-2009 Evgeny Akhundzhanov, All Rights Reserved Worldwide
Microsoft is in no way affiliated with, nor offers endorsement of, this site.
www.transcriber.ru | E-mail the Author