CAWT - COM Automation With Tcl

 

1     Introduction.. 2

1.1       Architecture overview.. 2

1.2       Dependencies. 3

1.3       Installation and Usage. 3

2     Packages in Detail. 5

2.1       CawtCore: Basic automation functionality. 5

2.2       CawtOffice: Basic Microsoft Office automation functionality. 6

2.3       CawtEarth: Automation for Google Earth. 7

2.4       CawtExcel: Automation for Microsoft Excel 8

2.4.1     Module excelCsv. 9

2.4.2     Module excelTablelist 10

2.4.3     Module excelMatlabFile. 10

2.4.4     Module excelWord. 10

2.4.5     Module excelImgRaw.. 11

2.4.6     Module excelMediaWiki 11

2.4.7     Module excelWikit 11

2.4.8     Module excelHtml 12

2.5       CawtExplorer: Automation for Internet Explorer 17

2.6       CawtMatlab: Automation for MathWorks Matlab. 18

2.7       CawtOcr: Automation for Microsoft Document Imaging. 18

2.8       CawtOneNote: Automation for Microsoft OneNote. 19

2.9       CawtOutlook: Automation for Microsoft Outlook. 19

2.10     CawtPpt: Automation for Microsoft PowerPoint 22

2.11     CawtReader: Automation for Acrobat Reader 24

2.12     CawtSapi: Automation for Microsoft Speech API 24

2.13     CawtWord: Automation for Microsoft Word. 25

3     Miscellaneous CAWT information.. 30

3.1       License information. 30

4     CAWT applications. 31

4.1       Application EnumExplorer.tcl 31

4.2       Application OneNoteInfo.tcl 31

4.3       Application Word2Pdf.tcl 32

4.4       Application WordAbbrCheck.tcl 33

5     Test programs.. 34

5.1       Test overview.. 34

5.2       Test execution. 38

6     Inside CAWT.. 39

7     Release history.. 41

8     Tables.. 55

8.1       Table of Figures. 55

8.2       Table of Tables. 55

8.3       Table of Terms and Abbreviations. 55

 

 

1            Introduction

This document describes CAWT version 3.1.1.

 

CAWT is a high-level Tcl interface for scripting Microsoft Windows® applications having a COM interface. It uses Twapi for automation via the COM interface.

Currently packages for Microsoft Excel, Word, PowerPoint, OneNote, Outlook, SAPI, Internet Explorer, MathWorks Matlab, Adobe Acrobat Reader and Google Earth are available.

 

Note: Only Microsoft Office packages Excel, Word, PowerPoint and Outlook are in active development. The other packages are proof-of-concept examples only.

 

CAWT sources are available at https://sourceforge.net/projects/cawt/.

The CAWT homepage is at https://www.tcl3d.org/cawt/

 

The CAWT user distribution contains the Tcl sources, documentation (this document and a reference manual) and several test programs showing the use of the CAWT functionality.

 

The CAWT developer distribution additionally contains scripts for generating the documentation and the distribution packages. Documentation generation needs packages Ruff! and textutil (see chapter 1.2 Dependencies for details). The developer distribution is intended for programmers who want to extend the CAWT package.

 

1.1    Architecture overview

The CAWT package currently consists of the following sub-packages:

 

CawtCore

Basic automation functionality.

CawtOffice

Basic Microsoft Office automation functionality.

 

 

CawtEarth

Automation functionality for Google Earth.

CawtExcel

Automation functionality for Microsoft Excel.

CawtExplorer

Automation functionality for Microsoft Internet Explorer.

CawtMatlab

Automation functionality for MathWorks Matlab.

CawtOcr

Automation functionality for Microsoft Document Imaging.

CawtOneNote

Automation functionality for Microsoft OneNote

CawtOutlook

Automation functionality for Microsoft Outlook.

CawtPpt

Automation functionality for Microsoft PowerPoint.

CawtReader

Automation functionality for Adobe Acrobat Reader.

CawtSapi

Automation functionality for Microsoft Speech API.

CawtWord

Automation functionality for Microsoft Word.

 

Each sub-package is implemented as a separate Tcl package and can be loaded explicitly with the Tcl package command, ex. package require cawtexcel. All available CAWT sub-packages can be loaded with a single command: package require cawt.

 

Note: Package names are all lower case.

 

The next figure shows the architecture of the CAWT package.

 

Figure 1: Overview of CAWT packages

1.2    Dependencies

The following table shows a list of the external Tcl packages used in the CAWT infrastructure.

 

Lib

Version

Comment

URL

Libraries needed for the CAWT package

Twapi

>= 4.4

Mandatory.

https://twapi.magicsplat.com/

tDOM

>= 0.9

Optional. See Notes below.

https://tdom.org/

TkImg

>= 1.4.1

Optional. See Notes below.

https://sourceforge.net/projects/tkimg/

Tablelist

>= 6

Optional. See Notes below.

https://www.nemethi.de

Libraries needed for generating the CAWT documentation

Ruff!

>= 1.0

Optional.

https://ruff.magicsplat.com/

tcllib

>= 1.22

Optional.

https://sourceforge.net/projects/tcllib/

 

Note:

Twapi             Need Twapi >= 5 for Tcl 9.

tDOM              Mandatory for the CawtOneNote package.

TkImg:            Needed for some functionalities (see the CawtExcel package for further details).

Tablelist:        Needed only for the excelTablelist module.

 

Note:

CAWT and the above listed dependencies are available via the BAWT (Build Automation With Tcl) Tcl-BI distribution at https://www.tcl3d.org/bawt/

 

1.3    Installation and Usage

Installation of CAWT is simple and fast.

 

Check, if all of the dependencies listed in the previous chapter are available.

 

If you just want to play with the test programs to get an impression on how CAWT works, unzip the user distribution file in a folder of your choice. Then open a shell window, go to folder TestPrograms of the CAWT distribution and execute a test program with a line as follows:

 

> tclsh Excel-01_Basic.tcl

 

See also chapter 5.2 Test execution for scripts to run all or groups of test programs in batch mode.

 

If you want to use CAWT as a package for your own applications, the Cawt folder should be copied into the library section of your Tcl installation (ex. C:\Tcl\lib). If write access to this Tcl directory is not permitted, you can copy the Cawt directory somewhere else, eg. C:\myCawt. To have Tcl look for packages in this location, you must set the TCLLIBPATH environment variable with the above specified directory name as value. Note that on Windows the path must be written with slashes (not backslashes):

> set TCLLIBPATH = C:/myCawt.

 

2            Packages in Detail

This chapter explains the different packages of CAWT.

For a detailed description of the available procedures in the different sub-packages see the CAWT reference manual available at the CAWT homepage or in the distribution.

 

2.1    CawtCore: Basic automation functionality

The procedures of package CawtCore are implemented in namespace Cawt.

They provide functionality for the following domains:

 

Domain

Examples

Package information

HavePkg, GetPkgVersion

Conversion functionality

CentiMetersToPoints, TclBool

COM access via Twapi

GetOrCreateApp, IsValidId, Destroy

Application embedding

EmbedApp, SetEmbedTimeout

Event handling

SetEventCallback

Color handling

GetColor, GetColorNames, RgbToOfficeColor

Interpolation handling

oo::class Interpolate

Image utilities

ClipboardToImg, ImgToClipboard

Date utilities

XmlDateToIsoDate, OutlookDateToSeconds

String utilities

CountWords

Testing utilities

CheckString, CheckNumber, CheckMatrix

 

The following table lists all procedures available in namespace Cawt.

 

CawtCore Procedure

Short description

CentiMetersToPoints

Convert centimeter value into points.

CheckBoolean

Check, if two boolean values are identical.

CheckComObjects

Check, if the number of COM objects fits expected value.

CheckFile

Check, if two files are identical.

CheckList

Check, if two lists are identical.

CheckMatrix

Check, if two matrices are identical.

CheckNumber

Check, if two numerical values are identical.

CheckString

Check, if two string values are identical.

ClearClipboard

N/A

ClipboardToImg

Copy the clipboard content into a photo image.

ConcatFiles

Concatenates files into one file.

CountWords

Count words contained in a string.

Destroy

Destroy one or all COM objects.

EmbedApp

Embed an application into a Tk frame.

GetColor

Convert a color representation into an Office color number.

GetColorNames

Get all supported Tcl color names.

GetComObjects

Get the COM objects currently in use as a list.

GetDotsPerInch

Get the dots-per-inch value used for conversions.

GetNumComObjects

Get the number of COM objects currently in use.

GetOrCreateApp

Use or create an instance of an application.

GetPkgVersion

Get the version of a CAWT sub-package.

GetProgramByExtension

Get path to program for a given file extension.

GetTmpDir

Try different environment variables.

HavePkg

Check, if a CAWT sub-package is available.

ImgToClipboard

Copy a photo image into the clipboard.

InchesToPoints

Convert inch value into points.

IsAppIdValid

Check, if an application identifier is valid.

IsComObject

Check, if parameter is a COM object.

IsHexColor

Check, if specified color is a valid Tcl hexadecimal color string.

IsNameColor

Check, if specified color is a valid Tcl color name.

IsoDateToOfficeDate

Return ISO date string as Office date.

IsoDateToSeconds

Return ISO date string as seconds.

IsoDateToXmlDate

Return ISO date string as XML date string.

IsOfficeColor

Check, if specified color is a valid Office color number.

IsRgbColor

Check, if specified color is a valid RGB representation.

IsUnicodeFile

Check, if a file is encoded in Unicode.

IsValidUrlAddress

Check, if supplied address is a valid URL.

KillApp

Kill all running instances of an application.

OfficeColorToRgb

Convert an Office color number into a RGB color list.

OfficeDateToIsoDate

Return Office date as ISO date string.

OfficeDateToSeconds

Return Office date as seconds.

PointsToCentiMeters

Convert value in points into centimeters.

PointsToInches

Convert value in points into inches.

PopComObjects

Pop last entry from COM objects stack.

PrintNumComObjects

Print the number of currently available COM objects to stdout.

PushComObjects

Push current list of COM objects onto a stack.

RgbToOfficeColor

Convert a RGB color into an Office color number.

SecondsToIsoDate

Return date in seconds as ISO date string.

SecondsToOfficeDate

Return date in seconds as Office date.

SecondsToXmlDate

Return date in seconds as XML date string.

SetClipboardWaitTime

Set the time to wait until clipboard content is ready.

SetDotsPerInch

Set the dots-per-inch value used for conversions.

SetEmbedTimeout

Set the timeout to wait for the embedded application to start.

SetEventCallback

Set an event callback procedure.

SplitFile

Split a file into several output files.

TclBool

Cast a value to a boolean.

TclInt

Cast a value to an integer with boolean range.

TclString

Cast a value to a string.

ValueToPoints

Convert a value into points.

WaitClipboardReady

Wait until clipboard content is ready.

XmlDateToIsoDate

Return XML date string as ISO date string.

XmlDateToSeconds

Return XML date string as seconds.

Table 1: CawtCore Reference

 

2.2    CawtOffice: Basic Microsoft Office automation functionality

The procedures of package CawtOffice are implemented in namespace Office.

They provide functionality for the following domains:

 

Domain

Examples

Office application functionality

GetApplicationName, GetApplicationId

Office document properties

SetDocumentProperty, GetDocumentProperty

Office environment

GetUserName, GetUserPath, GetActivePrinter

Office macros

AddMacro, RunMacro

 

Namespace Office has an internal namespace Enum with procedures for all enumeration types of this package. The procedure names correspond to the name of the enumeration type and return a list of enumeration names and values. See the reference manual for a list of all enumeration types.

 

Example:

proc MsoBarRow {} {

    # msoBarRowFirst - 0

    # msoBarRowLast - -1

    return { msoBarRowFirst 0 msoBarRowLast -1 }

}

 

The following table lists all procedures available in namespace Office.

 

CawtOffice Procedure

Short description

AddMacro

Add macros or functions to an Office document.

AddProperty

Add a custom document property.

DeleteProperty

Delete a document property.

GetActivePrinter

Get the name of the active printer.

GetApplicationId

Get the application identifier of an Office object.

GetApplicationName

Get the name of an Office application.

GetApplicationVersion

Get the version number of an Office application.

GetDocumentProperties

Get document property names as a list.

GetDocumentProperty

Get the value of a document property.

GetEnum

Get numeric value of an enumeration.

GetEnumName

Get name of a given enumeration type and numeric value.

GetEnumNames

Get names of a given enumeration type.

GetEnumTypes

Get available enumeration types.

GetEnumVal

Get numeric value of an enumeration name.

GetInstallationPath

Get the Office installation pathname.

GetOfficeType

Get the Office type of a file.

GetProperty

Get a document property.

GetPropertyName

Get the name of a document property.

GetPropertyType

Get the type of a document property.

GetPropertyValue

Get the value of a document property.

GetStartupPath

Get the Office startup pathname.

GetTemplatesPath

Get the Office templates pathname.

GetUserLibraryPath

Get the Office user library pathname.

GetUserName

Get the name of the Office application user.

GetUserPath

Get the Office user folder's pathname.

IsApplicationId

Check, if Office object is an application identifier.

RunMacro

Run a macro or function contained in an Office document.

SetDocumentProperty

Set the value of a document property.

SetPrinterCommunication

Enable or disable printer communication.

SetPropertyValue

Set the value of a document property.

Table 2: CawtOffice Reference

 

2.3    CawtEarth: Automation for Google Earth

The name of the controlled application is GoogleEarth.ApplicationGE.

 

The procedures of package CawtEarth are implemented in namespace Earth.

They provide functionality for the following domains:

 

Domain

Examples

Application handling

Open, Quit

Camera positioning

SetCamera

 

See the test programs Earth-*.tcl for examples on how to use the procedures of this package.

 

The following table lists all procedures available in namespace Earth.

 

CawtEarth Procedure

Short description

IsInitialized

Check, if a GoogleEarth instance is initialized.

Open

Open a GoogleEarth instance.

OpenNew

Open a new GoogleEarth instance.

Quit

Quit a GoogleEarth instance.

SaveImage

Save a grey-scale image of the current view.

SetCamera

Set camera position and orientation.

Table 3: CawtEarth Reference

 

2.4    CawtExcel: Automation for Microsoft Excel

The name of the controlled application is Excel.Application.

 

The procedures of package CawtExcel are implemented in namespace Excel.

They provide functionality for the following domains:

 

Domain

Examples

Application handling

Open, Quit, GetVersion

Workbook handling

OpenWorkbook, AddWorkbook, SaveAs, Close

Worksheet handling

AddWorksheet, DeleteWorksheet, CopyWorksheet

Row handling

InsertRow, DeleteRow, HideRow

Column handling

InsertColumn, DeleteColumn, HideColumn

Chart handling

ChartObjToClipboard, CreateChart, AddLineChart

Insert values

SetCellValue, SetRowValues, SetMatrixValues

Retrieve values

GetCellValue, GetRowValues, GetMatrixValues

Formatting functionality

SetColumnWidth, SetHyperlink, SetRangeTextColor

Clipboard functionality

ClipboardToMatrix, ClipboardToWorksheet

External file handling

Csv, Raw Images, MediaWiki, Wikit, Matlab files

External table tools handling

Tablelist, Word tables


Namespace
Excel has an internal namespace Enum with procedures for all enumeration types of this package. The procedure names correspond to the name of the enumeration type and return a list of enumeration names and values. See the reference manual for a list of all enumeration types.

 

Example:

proc XlAxisGroup {} {

    # xlPrimary - 1

    # xlSecondary - 2

    return { xlPrimary 1 xlSecondary 2 }

}

 

The commands are grouped and implemented in the following modules:

 

Implementation file

Description

excelConst.tcl

All Excel enumeration types.

excelBasic.tcl

Basic Excel commands.

excelUtil.tcl

Higher-level utility commands.

excelChart.tcl

Higher-level commands for chart creation.

excelCsv.tcl

Commands for reading/writing CSV files.

excelTablelist.tcl

Exchange Excel data with Tablelist.

excelMatlabFile.tcl

Exchange Excel data with Matlab MAT-Files. Level 4 files only.

excelWord.tcl

Exchange Excel data with Word tables.

excelImgRaw.tcl

Exchange Excel data with Tk photo images. 1-channel floating-point RAW files only.

excelMediaWiki.tcl

Exchange Excel data with MediaWiki tables.

excelWikit.tcl

Exchange Excel data with Wikit tables.

excelHtml.tcl

Export Excel data to HTML files.

 

See the following URL’s for details on table file formats:

Matlab:            https://www.mathworks.com/help/pdf_doc/matlab/matfile_format.pdf

Raw images:   https://docs.activestate.com/activetcl/8.6/tcl/img/doc/img-raw.html

MediaWiki:      https://www.mediawiki.org/wiki/Help:Tables

Wikit:               https://wiki.tcl-lang.org/page/Formatting+Rules

 

See the test programs Excel-*.tcl for examples on how to use the procedures of this package.

 

The next chapters explain the Excel modules dealing with data exchange.

2.4.1     Module excelCsv

Figure 2: Module excelCsv

 

2.4.2     Module excelTablelist

Figure 3: Module excelTablelist

 

2.4.3     Module excelMatlabFile

Figure 4: Module excelMatlabFile

 

2.4.4     Module excelWord

Figure 5: Module excelWord

 

2.4.5     Module excelImgRaw

Figure 6: Module excelImgRaw

 

2.4.6     Module excelMediaWiki

Figure 7: Module excelMediaWiki

 

2.4.7     Module excelWikit

Figure 8: Module excelWikit

 

2.4.8     Module excelHtml

Figure 9: Module excelHtml

 

The following table lists all procedures available in namespace Excel.

 

CawtExcel Procedure

Short description

AddColumnChartSimple

Add a clustered column chart to a worksheet. Simple case.

AddLineChart

Add a line chart to a worksheet. Generic case.

AddLineChartSimple

Add a line chart to a worksheet. Simple case.

AddPointChartSimple

Add a point chart to a worksheet. Simple case.

AddRadarChartSimple

Add a radar chart to a worksheet. Simple case.

AddSeriesTrendLine

Add a trend line to a series.

AddWorkbook

Add a new workbook with one worksheet.

AddWorksheet

Add a new worksheet to the end of a workbook.

ArrangeWindows

Arrange the windows of an Excel application.

ChartObjToClipboard

Copy a chart object to the clipboard.

ClipboardToMatrix

Return the matrix values contained in the clipboard.

ClipboardToWorksheet

Insert the matrix values contained in the clipboard into a worksheet.

Close

Close a workbook without saving changes.

ColumnCharToInt

Return an Excel column string as a column number.

ColumnIntToChar

Return a column number as an Excel column string.

CopyColumn

Copy the contents of a column into another column.

CopyRange

Copy the contents of a cell range into another cell range.

CopyWorksheet

Copy the contents of a worksheet into another worksheet.

CopyWorksheetAfter

Copy the contents of a worksheet after another worksheet.

CopyWorksheetBefore

Copy the contents of a worksheet before another worksheet.

CreateChart

Create a new empty chart in a worksheet.

CreateRangeString

Create a range string in A1 notation.

CsvRowToList

Return a CSV encoded row as a list of column values.

CsvStringToMatrix

Return a matrix from a CSV encoded table string.

DeleteColumn

Delete a column.

DeleteRow

Delete a row.

DeleteWorksheet

Delete a worksheet.

DeleteWorksheetByIndex

Delete a worksheet identified by its index.

DiffExcelFiles

Compare two Excel files visually.

DuplicateColumn

Duplicate a column.

DuplicateRow

Duplicate a row.

ExcelFileToHtmlFile

Convert an Excel file to a HTML table file.

ExcelFileToMatlabFile

Convert an Excel file to a Matlab table file.

ExcelFileToMediaWikiFile

Convert an Excel file to a MediaWiki table file.

ExcelFileToRawImageFile

Convert an Excel file to a raw photo image file.

ExcelFileToWikitFile

Convert an Excel file to a Wikit table file.

FormatHeaderRow

Format a row as a header row.

FreezePanes

Freeze a range in a worksheet identified by its row/column index.

GetActiveWorkbook

Return the active workbook of an application.

GetCellComment

Return the comment text of a cell.

GetCellIdByIndex

Return a cell of a worksheet.

GetCellRange

Return a numeric cell range as an Excel range string in A1 notation.

GetCellsId

Return the cells identifier of a worksheet.

GetCellValue

Return the value of a cell.

GetCellValueA1

Return the value of a cell.

GetChartNumSeries

Return the number of series of a chart.

GetChartSeries

Get a specific series of a chart.

GetColumnNumber

Return an Excel column string or number as a column number.

GetColumnRange

Return a numeric column range as an Excel range string.

GetColumnValues

Return column values as a Tcl list.

GetCsvSeparatorChar

Returns the column separator character.

GetCurrencyFormat

Return an Excel number format string for currencies.

GetDecimalSeparator

Return the decimal separator used by Excel.

GetEnum

Get numeric value of an enumeration.

GetEnumName

Get name of a given enumeration type and numeric value.

GetEnumNames

Get names of a given enumeration type.

GetEnumTypes

Get available enumeration types.

GetEnumVal

Get numeric value of an enumeration name.

GetExtString

Return the default extension of an Excel file.

GetFirstUsedColumn

Return the index of the first used column of a worksheet.

GetFirstUsedRow

Return the index of the first used row of a worksheet.

GetHiddenColumns

Return the hidden columns of a worksheet.

GetHiddenRows

Return the hidden rows of a worksheet.

GetLastUsedColumn

Return the index of the last used column of a worksheet.

GetLastUsedRow

Return the index of the last used row of a worksheet.

GetListItemSeparator

Return the list item separator used by Windows.

GetMatrixValues

Return worksheet table values as a matrix.

GetMaxColumns

Return the maximum number of columns of an Excel table.

GetMaxRows

Return the maximum number of rows of an Excel table.

GetNamedRange

Get the identifier of a named range.

GetNamedRangeNames

Get the names of named ranges.

GetNumberFormat

Return an Excel number format string.

GetNumColumns

Return the number of columns of a cell range.

GetNumRows

Return the number of rows of a cell range.

GetNumStyles

Return the number of styles in a workbook.

GetNumUsedColumns

Return the number of used columns of a worksheet.

GetNumUsedRows

Return the number of used rows of a worksheet.

GetNumWorksheets

Return the number of worksheets in a workbook.

GetRangeAsIndex

Get address of a cell range as list of row/column indices.

GetRangeAsString

Get address of a cell range as Excel range string in A1 notation.

GetRangeCharacters

Return characters of a cell range.

GetRangeFillColor

Get the fill color of a cell range.

GetRangeFontAttributes

Get the font attibutes of a cell or character range.

GetRangeFontBold

Get the bold font style of a cell range.

GetRangeFontItalic

Get the italic font style of a cell range.

GetRangeFontName

Get the font name of a cell or character range.

GetRangeFontSize

Get the font size of a cell range.

GetRangeFontSubscript

Get the subscript font style of a cell or character range.

GetRangeFontSuperscript

Get the superscript font style of a cell or character range.

GetRangeFontUnderline

Get the underline font style of a cell range.

GetRangeFormat

Get the number format of a cell range.

GetRangeHorizontalAlignment

Get the horizontal alignment of a cell range.

GetRangeTextColor

Get the text color of a cell range.

GetRangeValues

Return range values as a matrix.

GetRangeVerticalAlignment

Get the vertical alignment of a cell range.

GetRangeWrapText

Get the wrap text mode of a cell range.

GetRowValues

Return row values as a Tcl list.

GetStyleId

Find a style by its index or name.

GetTablelistHeader

Return the header line of a tablelist as a list.

GetTablelistValues

Return the values of a tablelist as a matrix.

GetThousandsSeparator

Return the thousands separator used by Excel.

GetVersion

Return the version of an Excel application.

GetWorkbookIdByName

Find an open workbook by its name.

GetWorkbookName

Return the name of a workbook.

GetWorksheetAsMatrix

Return worksheet table as a matrix.

GetWorksheetIdByIndex

Find a worksheet by its index.

GetWorksheetIdByName

Find a worksheet by its name.

GetWorksheetIndexByName

Find a worksheet index by its name.

GetWorksheetName

Return the name of a worksheet.

HideColumn

Hide or unhide a column.

HideRow

Hide or unhide a row.

ImgToWorksheet

Put a photo image into a worksheet.

Import

Import data from an external data source.

InsertColumn

Insert a new empty column.

InsertImage

Insert an image into a worksheet.

InsertRow

Insert a new empty row.

IsWorkbookId

Check, if Excel object is a workbook identifier.

IsWorkbookOpen

Check, if a workbook is open.

IsWorkbookProtected

Check, if a workbook is protected.

IsWorksheetEmpty

Check, if a worksheet is empty.

IsWorksheetProtected

Check, if a worksheet is content protected.

IsWorksheetVisible

Check, if a worksheet is visible.

ListToCsvRow

Return a list of column values as a CSV encoded row string.

MapWorksheetName

Map the name of a worksheet to confirm to Excel constraints.

MatlabFileToExcelFile

Convert a Matlab table file to an Excel file.

MatlabFileToWorksheet

Insert the data values of a Matlab file into a worksheet.

MatrixToClipboard

Copy a matrix into the clipboard.

MatrixToCsvString

Return a CSV encoded table string from a matrix list.

MediaWikiFileToExcelFile

Convert a MediaWiki table file to an Excel file.

MediaWikiFileToWorksheet

Insert the values of a MediaWiki table file into a worksheet.

Open

Open an Excel instance. Use an already running instance, if available.

OpenNew

Open a new Excel instance.

OpenWorkbook

Open a workbook, i.e. load an Excel file.

PlaceChart

Place an existing chart into a worksheet.

Quit

Quit an Excel instance.

RawImageFileToExcelFile

Convert a raw photo image file to an Excel file.

RawImageFileToWorksheet

Insert the pixel values of a raw photo image into a worksheet.

ReadCsvFile

Read a CSV table file into a matrix.

ReadMatlabFile

Read a Matlab file into a matrix.

ReadMatlabHeader

Read the header of a Matlab file.

ReadMediaWikiFile

Read a MediaWiki table file into a matrix.

ReadRawImageFile

Read a raw photo image into a matrix.

ReadRawImageHeader

Read the header of a raw photo image.

ReadWikitFile

Read a Wikit table file into a matrix.

ResizeChartObj

Set the position and size of a chart object.

SaveAs

Save a workbook to an Excel file.

SaveAsCsv

Save a worksheet to file in CSV format.

SaveChartObjAsImage

Save a chart as an image in a file.

ScaleImage

Scale an image.

ScreenUpdate

Toggle the screen updating of an Excel application window.

Search

Find a string in a worksheet cell range.

SelectAll

Select all cells of a worksheet.

SelectCellByIndex

Select a cell by its row/column index.

SelectRangeByIndex

Select a range by specifying a numeric cell range.

SelectRangeByString

Select a range by specifying an Excel range string in A1 notation.

SetCellValue

Set the value of a cell.

SetChartMaxScale

Set the maximum scale of an axis of a chart.

SetChartMinScale

Set the minimum scale of an axis of a chart.

SetChartObjPosition

Set the position of a chart object.

SetChartObjSize

Set the size of a chart object.

SetChartScale

Set the minimum and maximum scale of both axes of a chart.

SetChartSourceByIndex

Set the cell range for the source of a chart.

SetChartTicks

Set the tick spacing of an axis of a chart.

SetChartTitle

Set the title of a chart.

SetColumnsWidth

Set the width of a range of columns.

SetColumnValues

Insert column values from a Tcl list.

SetColumnWidth

Set the width of a column.

SetCommentDisplayMode

Set the global display mode of comments.

SetCommentSize

Set the shape size of a comment.

SetCsvSeparatorChar

Set the column separator character.

SetHeaderRow

Insert row values from a Tcl list and format as a header row.

SetHyperlink

Insert a hyperlink into a cell.

SetHyperlinkToCell

Insert a hyperlink to a cell into another cell.

SetHyperlinkToFile

Insert a hyperlink to a file into a cell.

SetLinkToCell

Insert an internal link to a cell into another cell.

SetListItemSeparator

Set the list item separator used by Excel.

SetMatrixValues

Insert matrix values into a worksheet.

SetNamedRange

Set the name of a cell range.

SetRangeBorder

Set the attributes of one border of a cell range.

SetRangeBorders

Set the attributes of all borders of a cell range.

SetRangeComment

Set the comment text of a cell range.

SetRangeFillColor

Set the fill color of a cell range.

SetRangeFontAttributes

Set the font attibutes of a cell or character range.

SetRangeFontBold

Set the bold font style of a cell range.

SetRangeFontItalic

Set the italic font style of a cell range.

SetRangeFontName

Set the font name of a cell or character range.

SetRangeFontSize

Set the font size of a cell range.

SetRangeFontSubscript

Set the subscript font style of a cell or character range.

SetRangeFontSuperscript

Set the superscript font style of a cell or character range.

SetRangeFontUnderline

Set the underline font style of a cell range.

SetRangeFormat

Set the number format of a cell range.

SetRangeHorizontalAlignment

Set the horizontal alignment of a cell range.

SetRangeMergeCells

Merge/Unmerge a range of cells.

SetRangeTextColor

Set the text color of a cell range.

SetRangeTooltip

Set a selection based tooltip for a cell range.

SetRangeValues

Set range values from a matrix.

SetRangeVerticalAlignment

Set the vertical alignment of a cell range.

SetRangeWrapText

Set the text wrapping mode of a cell range.

SetRowHeight

Set the height of a row.

SetRowsHeight

Set the height of a range of rows.

SetRowValues

Insert row values from a Tcl list.

SetSeriesAttributes

Set the attributes of a series.

SetSeriesLineWidth

Set the line width of a series.

SetTablelistHeader

Insert header values into a tablelist.

SetTablelistValues

Insert matrix values into a tablelist.

SetWindowState

Set the window state of an Excel application.

SetWorksheetFitToPages

Adjust a worksheet to fit onto given number of pages.

SetWorksheetFooter

Set the texts of the footer of a worksheet.

SetWorksheetHeader

Set the texts of the header of a worksheet.

SetWorksheetMargins

Set the margins of a worksheet.

SetWorksheetName

Set the name of a worksheet.

SetWorksheetOrientation

Set the orientation of a worksheet.

SetWorksheetPaperSize

Set the paper size of a worksheet.

SetWorksheetPrintOptions

Set printing options of a worksheet.

SetWorksheetTabColor

Set the color of the tab of a worksheet.

SetWorksheetZoom

Set the zoom factor for printing of a worksheet.

ShowAlerts

Toggle the display of Excel application alerts.

ShowCellByIndex

Show a cell identified by its row/column index.

ShowWorksheet

Show a worksheet.

TablelistToWorksheet

Insert the values of a tablelist into a worksheet.

ToggleAutoFilter

Toggle the AutoFilter switch of a cell range.

UnhideWorksheet

Unhide a worksheet, if it is hidden.

UseImgTransparency

Toggle usage of transparency channel of an image.

Visible

Set or query the visibility of an Excel application window.

WikitFileToExcelFile

Convert a Wikit table file to an Excel file.

WikitFileToWorksheet

Insert the values of a Wikit table file into a worksheet.

WordTableToWorksheet

Insert the values of a Word table into a worksheet.

WorksheetToClipboard

Copy worksheet data into the clipboard.

WorksheetToHtmlFile

Write the values of a worksheet into a HTML table file.

WorksheetToImg

Put worksheet background colors into a photo image.

WorksheetToMatlabFile

Insert the values of a worksheet into a Matlab file.

WorksheetToMediaWikiFile

Insert the values of a worksheet into a MediaWiki table file.

WorksheetToRawImageFile

Insert the values of a worksheet into a raw photo image file.

WorksheetToTablelist

Insert the values of a worksheet into a tablelist.

WorksheetToWikitFile

Insert the values of a worksheet into a Wikit table file.

WorksheetToWordTable

Insert the values of a worksheet into a Word table.

WriteCsvFile

Write the values of a matrix into a CSV file.

WriteHtmlFile

Write the values of a matrix into a Html table file.

WriteMatlabFile

Write the values of a matrix into a Matlab file.

WriteMediaWikiFile

Write the values of a matrix into a MediaWiki table file.

WriteRawImageFile

Write the values of a matrix into a raw photo image file.

WriteWikitFile

Write the values of a matrix into a Wikit table file.

Table 4: CawtExcel Reference

 

2.5    CawtExplorer: Automation for Internet Explorer

The name of the controlled application is InternetExplorer.Application.

 

The procedures of package CawtExplorer are implemented in namespace Explorer.

They provide functionality for the following domains:

 

Domain

Examples

Application handling

Open, Quit

URL navigation

Navigate, GoBack, GoHome

 

See the test programs Explorer-*.tcl for examples on how to use the procedures of this package.

 

Note: If running on Windows Vista or 7, you have to lower the security settings like follows:

 

Internet Options -> Security -> Trusted Sites    : Low

Internet Options -> Security -> Internet         : Medium + unchecked Enable Protected Mode

Internet Options -> Security -> Restricted Sites : unchecked Enable Protected Mode

 

The following table lists all procedures available in namespace Explorer.

 

CawtExplorer Procedure

Short description

FullScreen

Toggle the fullscreen mode of an Internet Explorer application window.

Go

Go to a specific page.

IsBusy

Check, if an Internet Explorer instance is busy.

Navigate

Navigate to a URL or local file.

Open

Open an Internet Explorer instance.

OpenNew

Open a new Internet Explorer instance.

Quit

Quit an Internet Explorer instance.

Visible

Toggle the visibility of an Internet Explorer application window.

Table 5: CawtExplorer Reference

 

2.6    CawtMatlab: Automation for MathWorks Matlab

The name of the controlled application is Matlab.Application.

 

The procedures of package CawtMatlab are implemented in namespace Matlab.

They provide functionality for the following domains:

 

Domain

Examples

Application handling

Open, Quit

Command execution

ExecCmd

 

See the test programs Matlab-*.tcl for examples on how to use the procedures of this package.

 

The following table lists all procedures available in namespace Matlab.

 

CawtMatlab Procedure

Short description

ExecCmd

Execute a Matlab command.

Open

Open a Matlab instance.

OpenNew

Open a new Matlab instance.

Quit

Quit a Matlab instance.

Visible

Toggle the visibility of a Matlab application window.

Table 6: CawtMatlab Reference

 

2.7    CawtOcr: Automation for Microsoft Document Imaging

The name of the controlled application is MODI.Document.

 

The procedures of package CawtOcr are implemented in namespace Ocr.

They provide functionality for the following domains:

 

Domain

Examples

Application handling

Open, Close

Character recognition

Scan, GetFullText, GetWord, GetWordStatistics

 

See the test programs Ocr-*.tcl for examples on how to use the procedures of this package.

 

The following table lists all procedures available in namespace Ocr.

 

CawtOcr Procedure

Short description

Close

Close an OCR document instance.

GetFullText

Return the recognized text of an OCR layout.

GetNumImages

Return the number of images of an OCR document.

GetNumWords

Return the number of words identified in an OCR document.

GetWord

Return the text of a recognized word.

GetWordStats

Return statistics of a recognized word.

Open

Open an OCR document instance.

OpenDocument

Open an image file for OCR scanning.

Scan

Scan an image.

Table 7: CawtOcr Reference

 

2.8    CawtOneNote: Automation for Microsoft OneNote

The name of the controlled application is OneNote.Application.

 

The procedures of package CawtOneNote are implemented in namespace OneNote.

They provide functionality for the following domains:

 

Domain

Examples

Application handling

Open, Quit, GetVersion

Retrieving information

GetNotebooks, GetSections, GetPages

 

See the test programs OneNote-*.tcl for examples on how to use the procedures of this package.

 

The following table lists all procedures available in namespace OneNote.

 

CawtOneNote Procedure

Short description

FindNodeByName

Get a specific node by name.

FindNotebook

Get a specific notebook by name.

FindPage

Get a specific page by name.

FindSection

Get a specific section by name.

GetApplicationId

Get the application identifier of a OneNote object.

GetDomId

Get the DOM identifier of a OneNote object.

GetDomRoot

Get the DOM root of a OneNote object.

GetEnum

Get numeric value of an enumeration.

GetEnumName

Get name of a given enumeration type and numeric value.

GetEnumNames

Get names of a given enumeration type.

GetEnumTypes

Get available enumeration types.

GetEnumVal

Get numeric value of an enumeration name.

GetExtString

Return the default extension of a OneNote file.

GetLastModified

Get nodes with specific modification date.

GetNodeAttribute

Get attribute value of a DOM node.

GetNodeHyperLink

Get hyperlink to OneNote node.

GetNodeName

Get value of node attribute name.

GetNodesByType

Get nodes of specific type.

GetNodeType

Get type of a DOM node.

GetNotebooks

Get the notebooks of a OneNote object.

GetPageContent

Get page content as XML.

GetPages

Get the pages of a OneNote section.

GetSections

Get the sections of a OneNote notebook.

GetVersion

Return the version of a OneNote application.

IsNodeType

Check, if node is of specific type.

Open

Open a OneNote instance.

PrintPage

Print page content as XML to standard output.

Quit

Quit a OneNote instance.

Table 8: CawtOneNote Reference

 

2.9    CawtOutlook: Automation for Microsoft Outlook

The name of the controlled application is Outlook.Application.

 

The procedures of package CawtOutlook are implemented in namespace Outlook.

They provide functionality for the following domains:

 

Domain

Examples

Application handling

Open, Quit, GetVersion

Account handling

GetAccountId, GetAccountSmtpAddresses

Mail handling

CreateMail, CreateHtmlMail, SendMail

Calendar handling

AddCalendar, DeleteCalendar, GetCalendarId

Category handling

AddCategory, DeleteCategory, GetCategoryId

Contact handling

AddContact, GetContactProperties

Appointment handling

AddAppointment, DeleteAppointment

Holiday file handling

ReadHolidayFile, ApplyHolidayFile

 

Namespace Outlook has an internal namespace Enum with procedures for all enumeration types of this package. The procedure names correspond to the name of the enumeration type and return a list of enumeration names and values. See the reference manual for a list of all enumeration types.

 

Example:

proc OlAlignment {} {

    # olAlignmentLeft - 0

    # olAlignmentRight - 1

    return { olAlignmentLeft 0 olAlignmentRight 1 }

}

 

The commands are grouped and implemented in the following modules:

 

Implementation file

Description

outlookConst.tcl

All Outlook enumeration types.

outlookBasic.tcl

Basic Outlook commands.

outlookCalendar.tcl

Outlook calendar commands.

outlookColor.tcl

Outlook commands related to color handling.

outlookContact.tcl

Outlook contact commands.

outlookAccount.tcl

Outlook account commands.

outlookMail.tcl

Outlook mail commands.

 

See the test programs Outlook-*.tcl for examples on how to use the procedures of this package.

Note: The Outlook test programs send test mails and modify the Outlook calendar.

 

The following table lists all procedures available in namespace Outlook.

 

CawtOutlook Procedure

Short description

AddAppointment

Create a new appointment in an Outlook calendar.

AddCalendar

Add a new Outlook calendar.

AddCategory

Add a new category to the Outlook categories.

AddContact

Create a new contact in an Outlook contact folder.

AddContactFolder

Add a new Outlook contact folder.

AddHolidayAppointment

Create a new appointment in an Outlook calendar.

ApplyHolidayFile

Read an Outlook holiday file and insert appointments.

CreateHtmlMail

Create a new Outlook HTML mail.

CreateMail

Create a new Outlook text mail.

DeleteAppointmentByIndex

Delete an appointment of an Outlook calendar by its index.

DeleteCalendar

Delete an Outlook calendar.

DeleteCategory

Delete an Outlook category.

DeleteContactByIndex

Delete a contact of an Outlook contact folder by its index.

DeleteContactFolder

Delete an Outlook contact folder.

GetAccountId

Get an account by its index or SMTP address.

GetAccountSmtpAddresses

Get a list of account SMTP addresses.

GetAppointmentByIndex

Get an appointment of an Outlook calendar by its index.

GetAppointmentProperties

Get properties of an Outlook appointment.

GetCalendarId

Get an Outlook calendar by its name.

GetCalendarNames

Get a list of Outlook calendar names.

GetCategoryColor

Convert a category color enumeration or name

GetCategoryColorEnum

Convert a category color enumeration or name into a color enumeration.

GetCategoryColorName

Convert a category color enumeration into a category color name.

GetCategoryColorNames

Get all category color names.

GetCategoryId

Get a category by its index or name.

GetCategoryNames

Get a list of category names.

GetContactByIndex

Get a contact of an Outlook contact folder by its index.

GetContactFolderId

Get an Outlook contact folder by its name.

GetContactFolderNames

Get a list of Outlook contact folder names.

GetContactProperties

Get property values of an Outlook contact.

GetContactReadOnlyPropertyNames

Get a list of Outlook contact read-only property names.

GetContactReadWritePropertyNames

Get a list of Outlook contact read-write property names.

GetEnum

Get numeric value of an enumeration.

GetEnumName

Get name of a given enumeration type and numeric value.

GetEnumNames

Get names of a given enumeration type.

GetEnumTypes

Get available enumeration types.

GetEnumVal

Get numeric value of an enumeration name.

GetFoldersRecursive

Get all Outlook folders of a specific type.

GetMailIds

Get a list of mail identifiers.

GetMailSubjects

Get a list of mail subjects.

GetNumAccounts

Get the number of Outlook accounts.

GetNumAppointments

Get the number of appointments in an Outlook calendar.

GetNumCalendars

Get the number of Outlook calendars.

GetNumCategories

Get the number of Outlook categories.

GetNumContactFolders

Get the number of Outlook contact folders.

GetNumContacts

Get the number of contacts in an Outlook contact folder.

GetVersion

Get the version of an Outlook application.

HaveCalendar

Check, if an Outlook calendar exists.

HaveCategory

Check, if a category already exists.

HaveContactFolder

Check, if an Outlook contact folder exists.

Open

Open an Outlook instance.

Quit

Quit an Outlook instance.

ReadHolidayFile

Read an Outlook holiday file.

SendMail

Send an Outlook mail.

SetContactProperties

Set property values of an Outlook contact.

Table 9: CawtOutlook Reference

 

2.10 CawtPpt: Automation for Microsoft PowerPoint

The name of the controlled application is PowerPoint.Application.

 

The procedures of package CawtPpt are implemented in namespace Ppt.

They provide functionality for the following domains:

 

Domain

Examples

Application handling

Open, Quit, GetVersion

Presentation handling

OpenPres, AddPres, SaveAs, Close

Slide handling

AddSlide, CopySlide, ShowSlide, ExportSlide

SlideShow handling

UseSlideShow, SlideShowFirst, SlideShowNext

Shape handling

AddShape, ConfigureShape, ConnectShapes

Custom layout handling

GetNumCustomLayouts, GetCustomLayoutName

 

Namespace Ppt has an internal namespace Enum with procedures for all enumeration types of this package. The procedure names correspond to the name of the enumeration type and return a list of enumeration names and values. See the reference manual for a list of all enumeration types.

 

Example:

proc PpArrangeStyle {} {

    # ppArrangeCascade - 2

    # ppArrangeTiled - 1

    return { ppArrangeCascade 2 ppArrangeTiled 1 }

}

 

See the test programs Ppt-*.tcl for examples on how to use the procedures of this package.

 

The following table lists all procedures available in namespace Ppt.

 

CawtPpt Procedure

Short description

AddPres

Add a new empty presentation.

AddShape

Add a new shape to a slide.

AddSlide

Add a new slide to a presentation.

AddTextbox

Add a text box into a slide.

AddTextboxText

Add a text string to a text box.

CheckCreateVideoStatus

Check video creation status.

Close

Close a presentation without saving changes.

CloseAll

Close all presentations of a PowerPoint instance.

ConfigureConnector

Configure a connector.

ConfigureShape

Configure a shape.

ConnectShapes

Add a new connector connecting two shapes.

CopySlide

Make a copy of a slide.

CreateVideo

Create a video from a presentation.

ExitSlideShow

Exit specified slide show.

ExportPptFile

Export a PowerPoint file to an image sequence.

ExportSlide

Export a slide as an image.

ExportSlides

Export a range of slides as image files.

GetActivePres

Return the active presentation of an application.

GetCommentKeyLeftPosition

Return the left position of a comment with specific key.

GetCommentKeyPosition

Return the top-left position of a comment with specific key.

GetCommentKeyTopPosition

Return the top position of a comment with specific key.

GetCommentKeyValue

Return the value of a key stored in a comment.

GetComments

Get the comment texts of a slide as a Tcl list.

GetCreateVideoStatus

Get video creation status.

GetCurrentSlideIndex

Return the current slide index of a presentation.

GetCustomLayoutId

Get a custom layout by its index or name.

GetCustomLayoutName

Return the name of a custom layout.

GetEnum

Get numeric value of an enumeration.

GetEnumName

Get name of a given enumeration type and numeric value.

GetEnumNames

Get names of a given enumeration type.

GetEnumTypes

Get available enumeration types.

GetEnumVal

Get numeric value of an enumeration name.

GetExtString

Return the default extension of a PowerPoint file.

GetNumComments

Return the number of comments of a slide.

GetNumCustomLayouts

Return the number of custom layouts of a presentation.

GetNumShapes

Return the number of shapes of a slide.

GetNumSites

Return the number of sites of a shape.

GetNumSlideImages

Return the number of images of a slide.

GetNumSlides

Return the number of slides of a presentation.

GetNumSlideShows

Return the number of slide shows of a presentation.

GetNumSlideVideos

Return the number of videos of a slide.

GetPptImageFormat

Get PowerPoint image format from Img format.

GetPresImages

Get the images of a presentation.

GetPresPageHeight

Get the page height of a presentation.

GetPresPageWidth

Get the page width of a presentation.

GetPresVideos

Get the videos of a presentation.

GetShapeId

Get shape identifier from shape index.

GetShapeMediaType

Return the media type of a shape.

GetShapeName

Return the name of a shape.

GetShapeType

Return the type of a shape.

GetSlideId

Get slide identifier from slide index.

GetSlideIdByName

Find a slide by its name.

GetSlideImages

Get the images of a slide.

GetSlideIndex

Return the index of a slide.

GetSlideName

Return the name of a slide.

GetSlideVideos

Get the videos of a slide.

GetSupportedImageFormats

Get the image formats supported by PowerPoint.

GetTemplateExtString

Return the default extension of a PowerPoint template file.

GetVersion

Return the version of a PowerPoint application.

GetViewType

Return the view type of a presentation.

InsertImage

Insert an image into a slide.

InsertVideo

Insert a video into a slide.

IsImageFormatSupported

Check, if the image format is supported by PowerPoint.

IsValidPresId

Check, if a presentation identifier is valid.

MoveSlide

Move a slide to another position.

Open

Open a PowerPoint instance. Use an already running instance, if available.

OpenNew

Open a new PowerPoint instance.

OpenPres

Open a presentation, i.e. load a PowerPoint file.

Quit

Quit a PowerPoint instance.

SaveAs

Save a presentation to a PowerPoint file.

SetHyperlinkToSlide

Create a hyperlink from a shape to a slide.

SetMediaPlaySettings

Set the play settings of a media (audio or video).

SetPresPageSetup

Set the page size of a presentation.

SetShapeName

Set the name of a shape.

SetSlideName

Set the name of a worksheet.

SetSlideShowTransition

Set transition attributes of a slide.

SetTextboxFontSize

Set the font size of the text in a text box.

SetViewType

Set the view type of a presentation.

ShowAlerts

Toggle the display of PowerPoint application alerts.

ShowSlide

Show a specific slide.

SlideShowFirst

Go to first slide in slide show.

SlideShowLast

Go to last slide in slide show.

SlideShowNext

Go to next slide in slide show.

SlideShowPrev

Go to previous slide in slide show.

UseSlideShow

Use specified slide show.

Visible

Toggle the visibility of a PowerPoint application window.

Table 10: CawtPpt Reference

 

2.11 CawtReader: Automation for Acrobat Reader

Note: Acrobat Reader is currently not controlled by the COM interface, but uses the program command line options.

 

The procedures of package CawtReader are implemented in namespace Reader.

They provide functionality for the following domains:

 

Domain

Examples

Application handling

Open, OpenNew, Quit, SetReaderProg

 

See the test programs Reader-*.tcl for examples on how to use the procedures of this package.

 

The following table lists all procedures available in namespace Reader.

 

CawtReader Procedure

Short description

Open

Open an Acrobat Reader instance.

OpenNew

Open a new Acrobat Reader instance.

Quit

Quit all Acrobat Reader instances.

SetReaderProg

Set the path to Acrobat Reader program.

Table 11: CawtReader Reference

 

2.12 CawtSapi: Automation for Microsoft Speech API

The name of the controlled application is sapi.SpVoice.

 

The procedures of package CawtSapi are implemented in namespace Sapi.

They provide functionality for the following domains:

 

Domain

Examples

Application handling

Open

Voice handling

GetVoiceByName, GetVoiceNames, SetVoice

Speaking

SetSpeakOptions, Speak

 

See the test programs Sapi-*.tcl for examples on how to use the procedures of this package.

 

The following table lists all procedures available in namespace Sapi.

 

CawtSapi Procedure

Short description

GetEnum

Get numeric value of an enumeration.

GetEnumName

Get name of a given enumeration type and numeric value.

GetEnumNames

Get names of a given enumeration type.

GetEnumTypes

Get available enumeration types.

GetEnumVal

Get numeric value of an enumeration name.

GetSpeakOptions

Get speak options.

GetVoiceByName

Get a voice identifier by specifying its name.

GetVoiceNames

Get a list of voice names.

Open

Open a SAPI object instance.

SetSpeakOptions

Set speak options.

SetVoice

Set the voice for speaking.

Speak

Speak a sentence.

Table 12: CawtSapi Reference

 

2.13 CawtWord: Automation for Microsoft Word

The name of the controlled application is Word.Application.

 

The procedures of package CawtWord are implemented in namespace Word.

They provide functionality for the following domains:

 

Domain

Examples

Application handling

Open, Quit, GetVersion

Document handling

OpenDocument, AddDocument, SaveAs, Close

Table handling

AddTable, GetNumRows, SetCellValue, GetCellValue

Text handling

AddParagraph, AppendText, AddText

Range handling

GetStartRange, GetRangeStartIndex, ExtendRange

Search/Replace functionality

FindString, ReplaceString, ReplaceByProc, Search

Formatting functionality

SetRangeFontBold, SetRangeBackgroundColor

Caption handling

InsertCaption, ConfigureCaption

Bookmark handling

AddBookmark, GetBookmarkName, SetLinkToBookmark

Hyperlink handling

GetHyperlinksAsDict, GetNumHyperlinks

List handling

GetListGalleryId, GetListTemplateId, InsertList

 

Namespace Word has an internal namespace Enum with procedures for all enumeration types of this package. The procedure names correspond to the name of the enumeration type and return a list of enumeration names and values. See the reference manual for a list of all enumeration types.

 

Example:

proc WdBookmarkSortBy {} {

    # wdSortByLocation - 1

    # wdSortByName - 0

    return { wdSortByLocation 1 wdSortByName 0 }

}

 

See the test programs Word-*.tcl for examples on how to use the procedures of this package.

 

The following table lists all procedures available in namespace Word.

 

CawtWord Procedure

Short description

AddBookmark

Add a bookmark to a text range.

AddContentControl

Add a content control to a text range.

AddDocument

Add a new empty document to a Word instance.

AddImageTable

Add a new table and fill the cells with images.

AddPageBreak

Add a page break to a text range.

AddParagraph

Add a new paragraph to a document.

AddRow

Add one or more rows to a table.

AddTable

Add a new table in a text range.

AddText

Add text to a Word document.

AppendParagraph

Append a paragraph at the end of the document.

AppendText

Append text to a Word document.

Close

Close a document without saving changes.

CollapseRange

Collapse a text range to the start or end position.

ConfigureCaption

Configure style of a caption type identified by its label identifier.

CopyRange

Copy the contents of a range into another range.

CountWords

Count words contained in a Word document.

CreateRange

Create a new text range.

CreateRangeAfter

Create a new text range after specified range.

CropImage

Crop an image at the four borders.

DeleteRow

Delete a row of a table.

DeleteSubdocumentLinks

Delete all subdocument links from a Word document.

DeleteTable

Delete a table.

DiffWordFiles

Compare two Word files visually.

ExpandSubdocuments

Expand all subdocuments in a Word document.

ExtendRange

Extend the range indices of a text range.

FindString

Find a string in a text range or a document.

FormatHeaderRow

Format a row as a header row.

GetBookmarkName

Get the name of a bookmark.

GetBookmarkNames

Get the names of all bookmarks of a document.

GetCellRange

Return a cell or cells of a Word table as a range.

GetCellValue

Return the value of a Word table cell.

GetColumnRange

Return a column of a Word table as a selection.

GetColumnValues

Return column values of a Word table as a Tcl list.

GetCompatibilityMode

Return the compatibility version of a Word application.

GetCrossReferenceItems

Get all cross reference items of a given type.

GetDocumentId

Get the document identifier of a Word component.

GetDocumentIdByIndex

Find a document by its index.

GetDocumentName

Get the name of a document.

GetEndRange

Return the text range representing the end of the document.

GetEnum

Get numeric value of an enumeration.

GetEnumName

Get name of a given enumeration type and numeric value.

GetEnumNames

Get names of a given enumeration type.

GetEnumTypes

Get available enumeration types.

GetEnumVal

Get numeric value of an enumeration name.

GetExtString

Return the default extension of a Word file.

GetFooterText

Get the text of the document footer.

GetHeaderText

Get the text of the document header.

GetHeadingRanges

Get the ranges of a specific heading level.

GetHeadingsAsDict

Get a dictionary with headings of a document.

GetHyperlinksAsDict

Get a dictionary with hyperlinks of a document.

GetImageId

Find an image by its index or name.

GetImageList

Get a list of images of a Word document.

GetImageName

Return the name of an image.

GetListGalleryId

Get one of the 3 predefined list galleries.

GetListTemplateId

Get one of the 7 predefined list templates.

GetMatrixValues

Return table values as a matrix.

GetNumCharacters

Return the number of characters in a Word document.

GetNumColumns

Return the number of columns of a Word table.

GetNumDocuments

Return the number of documents in a Word application.

GetNumHyperlinks

Return the number of hyperlinks of a Word document.

GetNumImages

Return the number of images of a Word document.

GetNumPages

Return the number of pages in a Word document.

GetNumRows

Return the number of rows of a Word table.

GetNumSubdocuments

Return the number of subdocuments in a Word document.

GetNumTables

Return the number of tables of a Word document.

GetPageSetup

Get page setup values.

GetRangeEndIndex

Return the end index of a text range.

GetRangeFont

Get font specific parameters.

GetRangeInformation

Get information about a text range.

GetRangeScreenPos

Return the screen position of a text range.

GetRangeStartIndex

Return the start index of a text range.

GetRangeText

Return the text of a text range.

GetRowId

Return identifier of a Word table row.

GetRowRange

Return rows of a Word table as a range.

GetRowValues

Return row values of a Word table as a Tcl list.

GetSelectionRange

Return the text range representing the current selection.

GetStartRange

Return a text range representing the start of the document.

GetSubdocumentPath

Return the file path of a subdocument.

GetTableIdByIndex

Find a table by its index.

GetTableIdByName

Find table(s) by its name.

GetTableName

Return the name of a table.

GetVersion

Return the version of a Word application.

InsertCaption

Insert a caption into a range of a document.

InsertFile

Insert a file into a Word document.

InsertImage

Insert an image into a range of a document.

InsertList

Insert a Word list.

InsertText

Insert text in a Word document.

IsInlineShape

Check, if a Word object is an InlineShape.

IsValidCell

Check, if a Word table cell is valid.

IsVisible

Check the visibility of a Word application window.

MergeCells

Merge a range of cells.

Open

Open a Word instance. Use an already running instance, if available.

OpenDocument

Open a document, i.e. load a Word file.

OpenNew

Open a new Word instance.

PrintHeadingDict

Print the contents of a heading dictionary onto stdout.

PrintHyperlinkDict

Print the contents of a hyperlink dictionary onto stdout.

PrintRange

Print the indices of a text range.

Quit

Quit a Word instance.

ReplaceByProc

Replace a string in a text range. Procedural case.

ReplaceImage

Replace an existing image.

ReplaceString

Replace a string in a text range or a document. Simple case.

SaveAs

Save a document to a Word file.

SaveAsPdf

Save a document to a PDF file.

ScaleImage

Scale an image.

ScreenUpdate

Toggle the screen updating of a Word application window.

Search

Search or replace a string in a text range or a document. Generic case.

SelectRange

Select a text range.

SetCellValue

Set the value of a Word table cell.

SetCellVerticalAlignment

Set the vertical alignment of a Word table cell.

SetColumnsWidth

Set the width of a range of table columns.

SetColumnValues

Insert column values into a Word table.

SetColumnWidth

Set the width of a table column.

SetCompatibilityMode

Set the compatibility mode of a document.

SetContentControlDropdown

Set the values for a content control dropdown list.

SetContentControlText

Set the text of a content control.

SetHeaderRow

Insert row values into a Word table and format as a header row.

SetHeadingFormat

Set the HeadingFormat flag of table rows.

SetHyperlink

Insert an external hyperlink into a Word document.

SetHyperlinkToFile

Insert a hyperlink to a file into a Word document.

SetImageName

Set the name of an image.

SetInternalHyperlink

Insert an internal hyperlink into a Word document.

SetLinkToBookmark

Insert an internal link to a bookmark into a Word document.

SetMatrixValues

Insert matrix values into a Word table.

SetPageSetup

Set page setup values.

SetRangeBackgroundColor

Set the background color of a table cell range.

SetRangeBackgroundColorByEnum

Set the background color of a table cell range.

SetRangeEndIndex

Set the end index of a text range.

SetRangeFont

Set font specific parameters.

SetRangeFontBackgroundColor

Set the background color of a text range.

SetRangeFontBold

Toggle the bold font style of a text range.

SetRangeFontColor

Set the text color of a text range.

SetRangeFontItalic

Toggle the italic font style of a text range.

SetRangeFontName

Set the font name of a text range.

SetRangeFontSize

Set the font size of a text range.

SetRangeFontUnderline

Toggle the underline font style of a text range.

SetRangeHighlightColorByEnum

Set the highlight color of a text range.

SetRangeHorizontalAlignment

Set the horizontal alignment of a text range.

SetRangeMergeCells

Merge a range of cells.

SetRangeStartIndex

Set the start index of a text range.

SetRangeStyle

Set the style of a text range.

SetRowHeight

Set the height of a table row.

SetRowValues

Insert row values from a Tcl list.

SetTableAlignment

Set the alignment of a Word table.

SetTableBorderLineStyle

Set the border line styles of a Word table or cell range.

SetTableBorderLineWidth

Set the border line widths of a Word table or cell range.

SetTableName

Set the name of a table.

SetTableOptions

Set miscellaneous table options.

SetTableVerticalAlignment

Set the vertical alignment of all Word table cells.

SetViewParameters

Set view parameters of a document.

ShowAlerts

Toggle the display of Word application alerts.

ToggleSpellCheck

Toggle checking of grammatical and spelling errors.

TrimString

Trim a string.

UpdateFields

Update all fields as well as tables of content and figures of a document.

Visible

Toggle the visibility of a Word application window.

Table 13: CawtWord Reference

 

3            Miscellaneous CAWT information

This chapter contains miscellaneous information about CAWT.

 

3.1    License information

The CAWT package is copyrighted by Paul Obermeier and distributed under the 3-clause BSD license. See file CAWT-License.txt in the CAWT distribution for the license text.

CAWT relies on several other Tcl packages. See the table in chapter 1.2 Dependencies for links to these packages to get their license information.

 

4            CAWT applications

CAWT includes the following scripts, which can be used as standalone applications:

 

4.1    Application EnumExplorer.tcl

The application EnumExplorer.tcl can be used to explore the common Office enumerations as well as the enumerations of the Office applications Excel, OneNote, Outlook, PowerPoint, Sapi and Word.

 

Figure 10: Screenshot of EnumExplorer.tcl

 

If started with option --help, it prints out a usage message:

 

> tclsh EnumExplorer.tcl --help

 

Usage: EnumExplorer.tcl [Namespace]

 

Start enumeration explorer and display specified namespace.

If no namespace is given, the first namespace in this list is used:

  Office Excel Ppt Word Outlook OneNote Sapi

 

Pressing the "Copy as enum" button or the "C" key copies the

currently selected enumeration as Tcl variable to the clipboard.

Example: $Excel::xlAboveStdDev

 

Pressing the "Copy as string" button or the "c" key copies the

currently selected enumeration name to the clipboard.

Example: xlAboveStdDev

 

4.2    Application OneNoteInfo.tcl

The application OneNoteInfo.tcl can be used to either retrieve information about OneNote notebooks, sections or pages as well as send Outlook mails about changed pages.

 

If started with option --help, it prints out a usage message:

 

> tclsh OneNoteInfo.tcl --help

 

Usage: OneNoteInfo.tcl [Options]

 

Utility program to retrieve information from OneNote.

 

Actions:

  --help           : Print help message and exit.

  --print          : Print information about notebooks, sections or pages to stdout.

                     If no other option is given, print a list of all notebook names.

                     If --notebook is given, print all section names of that notebook.

                     If --section and --notebook are given, print all page names of

                     that section.

  --check          : Find recently changed pages.

                     Use options --days and --mail to change default behaviour.

                     Default is: Look back 1 days. Print found page names to stdout.

 

Options:

  --notebook <string>: Check or print specified notebook.

  --section <string> : Check or print specified section.

  --page <string>    : Check or print specified page.

  --xml <string>     : Print information in OneNote XML format.

  --days <int>       : Specify number of days for recently changed pages.

  --mail <string>    : Send list of recently changed pages via Outlook mail.

                       If given string is a valid file name, scan that file

                       for mail addresses. Each line must contain key

                       "always" or "option" followed by a mail address.

                       Otherwise the string is expected to be a mail address.

  --test             : Build Outlook mail, but do not send. Use for testing.

 

 

Example: Find all pages changed in the last 20 days and send that information via Outlook HTML mail to a list of defined users. The table of changed pages contains links to the corresponding notebooks, sections and pages.

 

> tclsh OneNoteInfo.tcl --check --days 20 --notebook CAWT --mail OneNoteMailList.txt

 

Figure 11: Auto-generated Outlook mail from OneNoteInfo.tcl

4.3    Application Word2Pdf.tcl

The application Word2Pdf.tcl can be used to convert a Word file to a PDF file.

Note, that PDF export is supported by Word since version 2007.

 

If started with option --help, it prints out a usage message:

 

> tclsh Word2Pdf.tcl --help

 

Usage: Word2Pdf.tcl [Options] WordFile PdfFile

 

Options: None at the moment.

 

4.4    Application WordAbbrCheck.tcl

The application WordAbbrCheck.tcl can be used to list and count the words contained in a Word document. The output may be used to check for used abbreviations in the document, which are not contained in an abbreviation table.

Note: The functionality of this program is available with a graphical user interface in the poApps Office module. poApps is available at https://www.tcl3d.org/poApps/.

 

If started with option --help, it prints out a usage message:

 

> tclsh WordAbbrCheck.tcl --help

 

Usage: WordAbbrCheck.tcl [Options] WordFile

  Open a Word document and perform several checks and statistics.

  If no options are specified, the number of words in the document

  are counted.

 

Options:

  --help             : Print this help message.

  --showfiles        : Open log and result files after generation.

  --outfile <string> : Store results in given file.

                       Use "stdout" to print to standard output.

                       Default: Results are stored in a file with

                       same root name as input file, but extension ".txt".

  --minlength <int>  : Only count words having more than minlength

                       characters. Default: 2 characters.

  --maxlength <int>  : Only count words having less than maxlength

                       characters. Default: Unlimited.

  --nonumbers        : Only count words which are no numbers.

  --sortmode <string>: Sorting mode of word output.

                       Default: length.

                       Possible values: dictionary, length, increasing, decreasing.

  --csv              : Write result data in CSV format.

                       Default: Space seperated.

  --printtables      : Print table names of the Word file and exit.

  --abbr <string>    : Title of a table in the Word file containing

                       abbreviations. It is assumed, that the abbreviations

                       start in row 2 and are listed in column 1.

  --links            : Check validity of internal and external links.

 

5            Test programs

This chapter gives an overview of the available test programs and describes how to execute the tests.

 

5.1    Test overview

The following test and demonstration programs are currently available:

 

Test Program

Description

Cawt-01_Basic.tcl

Test basic functionality of the CawtCore package.

Cawt-02_Color.tcl

Test color functionality of the CawtCore package.

Cawt-03_Date.tcl

Test date conversion functionality of the CawtCore package.

Cawt-04_String.tcl

Test string functionalities of the CawtCore package.

Cawt-05_File.tcl

Test file handling functionality of the CawtCore package.

Cawt-06_Img.tcl

Test image handling functionality of the CawtCore package.

Cawt-07_ComObj.tcl

Test COM object functionality of the CawtCore package.

Cawt-08_TestUtil.tcl

Test Check functionality of the CawtCore package.

Cawt-09_Embed.tcl

Test embedding procedures of the CawtCore package.

Cawt-10_Interpolate.tcl

Test interpolation functionality of the CawtCore package.

Cawt-11_Url.tcl

Test CawtCore procedures for checking URL addresses.

Earth-01_Basic.tcl

Test basic functionality of the CawtEarth package.

Earth-02_MunichTour.tcl

Load position information into an Excel sheet, read back that information and create a Tk GUI with buttons corresponding to these positions.

Excel-01_Basic.tcl

Test basic functionality of the CawtExcel package.

Excel-02_Misc.tcl

Test miscellaneous CawtExcel procedures like setting colors, column width, inserting formulas and searching.

Excel-03_Add.tcl

Test CawtExcel procedures for adding and deleting workbooks and worksheets.

Excel-04_Insert.tcl

Test CawtExcel procedures for inserting data as rows, columns or matrices.

Excel-05_Ranges.tcl

Test CawtExcel procedures for retrieving the number of (used) rows and columns.

Excel-06_Chart.tcl

Test CawtExcel procedures for creating charts and exporting charts as Tk photo images.

Excel-07_Csv.tcl

Test CawtExcel procedures related to CSV files.

Excel-07_CsvUniCode.tcl

Test CawtExcel procedures related to CSV files.

Excel-08_Tablelist.tcl

Test CawtExcel procedures to exchange data between Excel and Tablelist.

Excel-08_TablelistSelection.tcl

Test CawtExcel procedures to exchange data between Excel and Tablelist.

Excel-09_WordTable.tcl

Test CawtExcel procedures to exchange data between Excel and Word tables.

Excel-10_Matrix.tcl

Test CawtExcel procedures to read data into a matrix and write matrix data into Matlab or RAW image files.

Excel-11_RawImage-16bit.tcl

Test CawtExcel procedures to exchange data between Excel and 16-bit integer RAW images.

Excel-11_RawImage.tcl

Test CawtExcel procedures to exchange data between Excel and 32-bit floating point RAW images.

Excel-12_MatlabFile.tcl

Test CawtExcel procedures to exchange data between Excel and Matlab files.

Excel-13_MediaWiki.tcl

Test CawtExcel procedures to exchange data between Excel and MediaWiki tables.

Excel-14_Wikit.tcl

Test CawtExcel procedures to exchange data between Excel and Wikit tables.

Excel-14_WikitWithLinks.tcl

Test CawtExcel procedures to export an Excel workbook as Wikit tables with hyperlinks.

Excel-15_Clipboard.tcl

Test CawtExcel procedures to exchange data between Excel and the Windows clipboard.

Excel-16_SetGet.tcl

Test CawtExcel procedures for setting and getting cell values.

Excel-17_Diff.tcl

Test CawtExcel procedure for diff'ing Excel files.

Excel-17_DiffEqual.tcl

Test CawtExcel procedure for diff'ing Excel files.

Excel-18_SparseMatrix.tcl

Test CawtExcel procedures for handling sparse matrices.

Excel-19_MarkLink.tcl

Test CawtExcel procedures related to marking and linking cells.

Excel-20_ImgUtil.tcl

Test CawtExcel procedures for dealing with images.

Excel-21_ImgCell.tcl

Test CawtExcel procedures for inserting images using cell background colors.

Excel-22_Html.tcl

Test CawtExcel procedures to export Excel data to a HTML file.

Excel-23_Font-Attributes.tcl

Test CawtExcel procedures related to font attribute handling.

Excel-23_Font.tcl

Test CawtExcel procedures related to font handling.

Excel-24_Format.tcl

Test CawtExcel procedures related to specifying number formats.

Excel-25_Properties.tcl

Test CawtExcel procedures related to property handling.

Excel-26_PageSetup.tcl

Test CawtExcel procedures related to page setup and printing.

Excel-27_RowColumn.tcl

Test CawtExcel procedures for row and column handling: Insert, delete, hide, duplicate.

Excel-28_NamedRange.tcl

Test CawtExcel procedures related to named ranges.

Excel-29_EmptySheet.tcl

Test CawtExcel procedures dealing with empty worksheets.

Excel-30_SelectRange.tcl

Test miscellaneous CawtExcel procedures like setting colors, column width, inserting formulas and searching.

Excel-31_Import.tcl

Test CawtExcel procedures related to import functionality.

Excel-32_Quit.tcl

Test quitting Excel without saving modified worksheets.

Excel-33_AddAndRunMacro.tcl

Test CawtOffice procedures to add Excel macros (Sub and Function) from a string and run these macros.

Excel-33_ImportAndRunMacro.tcl

Test CawtOffice procedures to add Excel macros (Sub and Function) from a source file and run these macros.

Excel-33_RunMacro.tcl

Test CawtOffice procedures to run macros (Sub and Function) contained in an Excel file.

Excel-34_Events.tcl

Test event handling functionality of Excel.

Excel-35_Styles.tcl

Test CawtExcel procedures related to Styles handling.

Excel-36_Embed.tcl

Test CawtExcel procedures for embedding an Excel workbook into a Tk frame.

Excel-37_WorksheetName.tcl

Test CawtExcel procedures for mapping worksheet names.

Excel-38_Interpolate.tcl

Test interpolation functionality of the CawtCore package in Excel example.

Excel-39_DateTime.tcl

Test CawtExcel procedures related to dates and times.

Explorer-01_Basic.tcl

Test basic functionality of the CawtExplorer package.

Explorer-02_Misc.tcl

Test miscellaneous CawtExplorer functions like navigating to an URL and using fillscreen mode.

Explorer-03_Events.tcl

Test event handling functionality of Internet Explorer.

Matlab-01_Basic.tcl

Test basic functionality of the CawtMatlab package.

Matlab-02_MFile.tcl

Test CawtMatlab procedures for executing Matlab commands.

Ocr-01_Basic.tcl

Test basic functionality of the CawtOcr package.

Ocr-02_Misc.tcl

Test miscellaneous CawtOcr procedures.

OneNote-01_Basic.tcl

Test basic functionality of the CawtOneNote package.

Outlook-01_Basic.tcl

Test basic functionality of the CawtOutlook package.

Outlook-02_Mail.tcl

Test mail functionality of the CawtOutlook package. Note: This script sends two test mails (in text and HTML format) to cawt@tcl3d.org.

Outlook-03_Holiday.tcl

Test holiday appointment functionality of the CawtOutlook package. Note: This script sets appointments in your Outlook calendar.

Outlook-04_Appointment.tcl

Test appointment functionality of the CawtOutlook package. Note: This script sets appointments in your Outlook calendar.

Outlook-05_MailFolders.tcl

Test mail folder functionality of the CawtOutlook package.

Outlook-06_ContactFolders.tcl

Test contact functionality of the CawtOutlook package.

Outlook-07_Accounts.tcl

Test account functionality of the CawtOutlook package.

Ppt-01_Basic.tcl

Test basic functionality of the CawtPpt package.

Ppt-02_Misc.tcl

Test miscellaneous CawtPpt procedures like adding slides, inserting images and saving slides as image files.

Ppt-03_Add.tcl

Test CawtPpt procedures for adding and copying slides.

Ppt-04_Present.tcl

Test CawtPpt procedures for presenting a slide show.

Ppt-05_Export.tcl

Test CawtPpt procedures for exporting a PowerPoint presentation as HTML slide show.

Ppt-06_CustomLayout.tcl

Test CawtPpt procedures for using PowerPoint custom layouts.

Ppt-07_Properties.tcl

Test CawtPpt procedures related to property handling.

Ppt-08_Comments.tcl

Test CawtPpt procedures for handling PowerPoint comments.

Ppt-09_Shapes.tcl

Test CawtPpt procedures related to creating, manipulating and connecting shapes.

Ppt-10_AllShapes.tcl

Test CawtPpt procedure for creating all available shapes.

Ppt-11_AllConnectors.tcl

Test CawtPpt procedure for creating all available connectors.

Ppt-12_Quit.tcl

Test quitting PowerPoint without saving modified presentations.

Ppt-13_Media.tcl

Test CawtPpt procedures related to media content, i.e. images and videos.

Ppt-14_CreateVideo.tcl

Test creating videos from PowerPoint slides.

Ppt-15_ButtonEvent.tcl

Test CawtPpt procedures for simulating button events.

Ppt-16_Embed.tcl

Test CawtPpt procedures for embedding a PowerPoint presentation into a Tk frame.

Reader-01_Basic.tcl

Test basic functionality of the CawtReader package.

Reader-02_Embed.tcl

Test CawtExcel procedures for embedding an Acrobat Reader window into a Tk frame.

Sapi-01_Basic.tcl

Test basic functionality of the CawtSapi package.

Sapi-02_Speak.tcl

Test speaking voices of the CawtSapi package.

Sapi-03_SpeakOptions.tcl

Test speaking options of the CawtSapi package.

Sapi-04_SpeakFlags.tcl

Test speaking flags of the CawtSapi package.

Word-01_Basic.tcl

Test basic functionality of the CawtWord package.

Word-02_Table.tcl

Test CawtWord procedures related to Word table management.

Word-02_TableWidth.tcl

Test CawtWord procedures related to Word table width management.

Word-03_Text.tcl

Test CawtWord procedures for handling text.

Word-04_Find.tcl

Test CawtWord procedures related to simple search and replace functionality.

Word-04_FindGeneric.tcl

Test CawtWord procedures related to generic search and replace functionality.

Word-05_Report.tcl

Test CawtWord procedures needed for generating a test report.

Word-06_Diff.tcl

Test CawtWord procedure for diff'ing Word files.

Word-07_Link.tcl

Test CawtWord procedures for handling links and inserting files.

Word-08_ImgUtil.tcl

Test CawtWord procedures for dealing with images.

Word-09_Controls.tcl

Test CawtWord procedures for handling content controls.

Word-10_Properties.tcl

Test CawtWord procedures related to property handling.

Word-11_Tables.tcl

Test CawtWord procedures related to Word table management.

Word-12_LargeTable.tcl

Test CawtWord procedures to insert a large Word table.

Word-13_MultiTables.tcl

Test CawtWord procedures to insert multiple Word tables across multiple pages.

Word-14_Quit.tcl

Test quitting Word without saving modified documents.

Word-15_MergeCells.tcl

Test CawtWord procedures related to Word table cell merging.

Word-16_ReplaceImages.tcl

Test CawtWord procedures for replacing images stored as InlinesShapes and Shapes.

Word-17_Subdocuments.tcl

Test CawtWord procedures related to subdocument handling.

Word-18_PageSetup.tcl

Test Word page setup setter and getter procedures.

Word-19_Heading.tcl

Test CawtWord procedures related to Word headings.

Word-19_HeadingDict.tcl

Test CawtWord procedures related to Word headings.

Word-20_Font.tcl

Test CawtWord procedures for handling fonts.

Word-21_RunMacro.tcl

Test CawtOffice procedures to run a macro contained in a Word file.

Word-22_Events.tcl

Test event handling functionality of Word.

Word-23_Embed.tcl

Test CawtWord procedures for embedding a Word document into a Tk frame.

Table 14: Test Programs

 

The CAWT sub-packages have been tested successfully with the above-mentioned programs on the following operating systems and COM application versions:

 

Package

Operating system

Application version

CawtEarth

Windows 7, 8, 10

6.2, 7.1.2

CawtExcel

Windows 7, 8, 10, 11

2013, 2016, 2019 (*)

CawtExplorer

Windows 7, 8 (**)

IE 8, IE 9, IE 11

CawtMatlab

Windows 7

R2007b

CawtOcr

Windows 7, 8

2013

CawtOneNote

Windows 7, 8, 10, 11

2013, 2016

CawtOutlook

Windows 7, 8, 10, 11

2013, 2016, 2019 (*)

CawtPpt

Windows 7, 8, 10, 11

2013, 2016, 2019 (*)

CawtReader

Windows 7, 8, 10

DC

CawtSapi

Windows 8, 10

5.3, 5.4

CawtWord

Windows 7, 8, 10, 11

2013, 2016, 2019 (*)

 

(*) Older Office versions may work, but are not tested anymore.

(**) See chapter 2.5 CawtExplorer: Automation for Internet Explorer for known issues with Internet Explorer on Windows 7 and 8.

 

5.2    Test execution

To execute a single test program, execute it with the Tcl shell:

 

> tclsh Excel-02_Misc.tcl

 

To execute all test programs of a sub-package, use the utility script RunTest.tcl:

 

> tclsh RunTest.tcl Excel

 

To execute all test programs of CAWT, use the batch program RunTests.bat:

 

> RunTests.bat

 

Each test program accepts an optional string parameter. If this parameter is set to auto, the test program closes and quits the controlled application. If this parameter is not set, the controlled application stays open, so the results can be viewed directly in the application window.

 

The RunTest.tcl utility script, calls all test programs available for a sub-package by specifying the corresponding namespace name. The test programs are called with the above mentioned auto parameter. Additionally, the script can be supplied with optional parameters to switch off either the tests or to switch off the code coverage checks.

If called without any parameters, the script issues a help message onto standard output.

 

Usage: RunTest.tcl [Options] Namespace [Namespace]

 

Run the test programs and code coverage checks for specified namespace(s).

Namespaces usable: Cawt Excel Ppt Word OneNote Outlook Sapi Ocr Reader Earth Matlab Explorer.

 

Options:

  --help   : Display this usage message and exit.

  --verbose: Show the detailed results of the tests. (Default: No)

  --notests: Do not run the tests. (Default: Run tests)

  --nocover: Do not run the coverage checks. (Default: Run coverage)

 

6            Inside CAWT

The information in this chapter is for programmers, who want to extend and improve CAWT.

 

Download the developer distribution from the CAWT homepage or checkout the source code from SourceForge. This distribution contains in addition to the user distribution the documentation source files (a Word and a PowerPoint file), as well as some additional utility scripts.

Create or update Office enumeration values

The files containing common Office enumerations (officeConst.tcl) as well as the enumeration values of the Office applications Excel (excelConst.tcl), PowerPoint (pptConst.tcl), Word (wordConst.tcl), Outlook (outlookConst.tcl) and SAPI (sapiConst.tcl) are automatically generated with script createConstFile.tcl.

The enumeration values of the current CAWT distribution are based on Microsoft Office 2019. If you have a newer Office version and want to update the enumeration files, execute the batch program createConstFiles.bat, which is located at the root directory of CAWT. Before calling the batch program, you should edit it to fit the locations of your Office programs.

Create or update CAWT documentation

The CAWT documentation comes in 2 parts, the user manual (this document) and a reference manual.

The reference manual is created with the help of the Ruff! package from inline documentation. So, if adding new procedures to the CAWT packages, be sure to also update the inline documentation.

The sources of the user manual are a Word template document and a PowerPoint presentation located in folder Documents/UserManual.

The final documentation is created by Tcl script genCawtDoc.tcl, which first creates the reference manual by calling Ruff!, and then the user manual.

The user manual is generated by exporting the slides of the presentation and inserting them into a copy of the Word template document. Additionally, a list of test scripts and tables of all CAWT procedures (containing links to the reference manual) are inserted. Finally, some keywords representing the current date, year and CAWT version are replaced with their corresponding values. The final user manual document is then written in Word and PDF format into folder Documents/Final.

 

Figure 12: Documentation generation workflow

 

If specifying the strings ref or user as command line parameter for script genCawtDoc.tcl, only the reference manual resp. the user manual is generated.

Create a CAWT distribution

To create a distribution (both user and developer), call Tcl script makeDist.tcl.

Note, that you should have updated the documentation before creating a distribution.

The location of the distribution output files and the program to create ZIP files are listed at the top of file makeDist.tcl, and must be adapted to your local situation.

 

7            Release history

The following table gives an overview of the release history of CAWT and its predecessors TcomOffice and TcomExcel.

 

Version

Date

Release notes

TcomExcel

0.1

2008-09-11

Initial release. Support for Excel 2000 and 2003.

0.2

2009-09-19

Extended functionality. Added support for Excel 2007.

0.3

2010-10-29

Bug fixes and extended test programs.

0.3.1

2011-01-13

Extended functionality. Added support for Excel 2010.

0.3.2

2011-04-05

Extended functionality.

TcomOffice

0.4.0

2011-07-17

New module TcomWord for Word automation.

0.4.1

2011-08-28

Extended functionality.

CAWT

1.0.0

2012-12-23

Replaced Tcom with Twapi for COM access.

Added support for PowerPoint, Internet Explorer, Google Earth and Matlab.

Added user and reference manual.

Unification of procedure names.

Supports Microsoft Office versions 2003, 2007, 2010.

1.0.1

2013-04-28

Extended Excel chart generation.

Updated Twapi version to 4.0a16.

Added support to generate a CAWT starkit.

1.0.2

2013-07-28

Updated Twapi version to 4.0b22.

Updated Img version to 1.4.1.

Added new module CawtOcr.

New procedures in CawtCore:

  • Clipboard2Img, Img2Clipboard

New procedures in CawtExcel:

  • SetRangeBorder

1.0.3

2013-08-30

New procedures in CawtExcel:

  • ExcelFileToMediaWikiFile, ExcelFileToWikitFile
  • ExcelFileToRawImageFile, RawImageFileToExcelFile
  • ExcelFileToMatlabFile, MatlabFileToExcelFile
  • GetTablelistValues, SetTablelistValues

1.0.4

2013-11-23

Improved test suite.

Added support for Office 2013.

Added support for 64-bit Office.

Updated Img extension to version 1.4.2 (32-bit and 64-bit).

Update Tablelist to version 5.10.

New procedures in CawtWord:

  • SaveAsPdf
  • UpdateFields
  • CropImage.

New procedures in CawtExcel:

  • CopyWorksheetBefore, CopyWorksheetAfter
  • GetWorksheetIndexByName
  • IsWorksheetProtected, IsWorksheetVisible
  • SetWorksheetTabColor
  • UnhideWorksheet
  • DiffExcelFiles

1.0.5

2014-01-26

New procedures in CawtExcel:

  • SetCommentDisplayMode, SetRangeComment
  • SetRangeMergeCells, GetRangeCharacters
  • SetRangeFontSubscript, SetRangeFontSuperscript

1.0.6

2014-04-21

Improved and extended test suite.

Updated Twapi version to 4.0b53 to fix a bug with sparse matrices as well as core dumps with Word 2013.

Improved and corrected handling of sparse matrices in Excel.

Bug fix in excelCsv module.

Possible incompatibility in GetRowValues and GetColumnValues: Changed startRow resp. startCol to default value 0 instead of 1.

New procedures in CawtExcel:

  • GetWorksheetAsMatrix
  • GetMaxRows, GetMaxColumns
  • GetFirstUsedRow, GetLastUsedRow
  • GetFirstUsedColumn, GetLastUsedColumn

1.0.7

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2014-06-14

Updated Twapi version to official 4.0.61.

CawtExcel:

  • Added support for reading and writing CSV files with multi-line cells.

CawtPpt:

  • Extended CopySlide to copy slides between presentations.
  • Extended AddPres with optional parameter for template file.
  • Extended AddSlide to supply a custom layout object as type parameter.

Extended test suite for changed and new procedures.

New procedures in CawtCore:

  • ColorToRgb

New procedures in CawtExcel:

  • UseImgTransparency, WorksheetToImg, ImgToWorksheet
  • SetRowHeight, SetRowsHeight
  • GetRangeFillColor
  • SetHyperlinkToFile, SetHyperlinkToCell, SetLinkToCell
  • SetRangeTooltip

New procedures in CawtPpt:

  • MoveSlide,
  • GetTemplateExtString
  • GetNumCustomLayouts
  • GetCustomLayoutName, GetCustomLayoutId

1.1.0

2014-08-30

Compatibility issue:

  • Incompatible changes in module CawtWord.
  • Unified signatures of AddText, AppendText and AddParagraph, AppendParagraph.
  • Changed handling of text ranges.

New module CawtOutlook to control Microsoft Outlook applications:

  • Currently only functionality for creating and sending mails is implemented.

Extended test suite for changed and new procedures.

New procedures in CawtExcel:

  • FreezePanes, ScreenUpdate

New procedures in CawtWord:

  • SelectRange, GetRangeInformation, CreateRange
  • SetRangeFontName, SetRangeStyle, SetRangeFontSize
  • InsertText, AddText, GetNumCharacters
  • AddPageBreak, ToggleSpellCheck

1.2.0

2014-12-14

Compatibility issue:

  • Incompatible changes in module CawtWord. Removed parameter docId from all procedures, which had both docId and rangeId parameters:
  • SetRangeStartIndex, SetRangeEndIndex, ExtendRange,
  • AddText, SetHyperlink, AddTable.

CawtExcel:

  • Added optional startRow parameter to TablelistToWorksheet.

Extended test suite for changed and new procedures.

New procedures in CawtWord:

  • GetDocumentId
  • SetRangeFontUnderline, CreateRangeAfter
  • InsertCaption, ConfigureCaption
  • AddBookmark, GetBookmarkName, SetLinkToBookmark
  • GetListGalleryId, GetListTemplateId, InsertList

2.0.0

2015-03-31

Ensembled all CAWT namespaces, ex. write "Excel Open" instead of "::Excel::Open".

All Office enumerations are stored in module specific hash tables, ex.  write "xlThick" instead of "$::Excel::xlThick".

Updated and extended user manual (automatic insertion of CAWT procedure reference list).

Added new application EnumExplorer.tcl to display Office enumerations.

New module excelHtml.tcl for HTML export of Excel tables.

External packages:

  • Updated Twapi to version 4.1.27.
  • Updated Img (32 and 64 bit) to version 1.4.3.
  • Updated Tablelist to version 5.13.

CawtExcel:

  • New implementation of InsertImage based on Shapes.AddPicture instead of Pictures.Insert

CawtWord:

  • Extended procedure UpdateFields to additionally update TablesOfContents and TablesOfFigures of a document.

New procedures in CawtCore:

  • GetApplicationVersion, IsApplicationId
  • PushComObjects, PopComObjects
  • PrintNumComObjects, CheckComObjects
  • GetComObjects, GetNumComObjects
  • Replaced procedure IsValidId with IsComObject

New procedures in CawtExcel:

  • GetRangeAsIndex, GetRangeAsString, GetRangeTextColor

New procedures in CawtWord:

  • ScaleImage, SetInternalHyperlink, InsertFile, DiffWordFile

2.1.0

2015-09-01

Updated Twapi to version 4.2.a1, because of new Twapi functionality "tclcast bstr" and bug fix to retrieve document properties.

Added support to generate a CAWT starpack.

CawtExcel:

  • Take hidden flag of both Excel and tablelist columns into account in procedures TablelistToWorksheet and WorksheetToTablelist.
  • Fixed SetCellValue and SetRangeFormat using new TclString procedure.

CawtPpt:

  • Extended functionality of ExportPptFile and ExportSlides to take into account slide comments regarding export file names.

New procedures in CawtCore:

  • TclString

New procedures in CawtExcel:

  • DeleteColumn, DeleteRow
  • HideColumn, GetHiddenColumns
  • GetDecimalSeparator (replacing GetFloatSeparator)
  • GetThousandsSeparator
  • GetNumberFormat (replacing GetLangNumberFormat)

New procedures in CawtPpt:

  • AddTextbox, AddTextboxText, SetTextboxFontSize
  • GetNumComments, GetComments, GetCommentKeyValue

New procedures in CawtWord:

  • AddContentControl
  • SetContentControlDropdown, SetContentControlText
  • GetDocumentProperties, GetDocumentProperty
  • SetDocumentProperty.

2.1.1

2015-10-31

Support for Office 2016.

 

External packages:

  • Updated Tablelist to version 5.14.

2.1.2

2015-11-10

Extended support for Excel page setup.

Changed all Office procedures with size parameters to accept inches, centimeters or points.

 

CawtExcel:

  • Corrected SetWorksheetFitToPages to accept zero as values for wide and tall parameters. Zero indicates automatic determination of number of pages.

New procedures in CawtCore:

  • SetPrinterCommunication,
  • ValueToPoints, PointsToCentiMeters, PointsToInches.

New procedures in CawtExcel:

  • SetWorksheetPrintOptions, SetWorksheetPaperSize,
  • SetWorksheetMargins, SetWorksheetFooter,
  • SetWorksheetHeader.

2.2.0

2015-12-12

Enhanced functionality in Core and Office modules.

 

Compatibility issue:

  • AddWorksheet now adds the new sheet at the end, as was already written in the documentation. Previous behaviour was to insert before active worksheet.

New module CawtOffice:

  • Moved basic Office procedures into namespace Office.
  • Added aliases in namespace Cawt for backwards compatibility.
  • Added new enumeration constants file for basic Office types based on type library in mso.dll.

CawtCore:

  • Colors can now be specified in hex notation, Tcl color names, RGB or as Office color numbers.

 

CawtExcel:

  • Extended SetLinkToCell to copy number format when linking.
  • Extended SetRangeFormat to accept Excel style number formats.
  • Extended SetHyperlinkToFile to accept relative path names.
  • Corrected hyperlinking to relative file names.

New procedures in CawtCore:

  • GetColor, GetColorNames,
  • IsHexColor, IsNameColor, IsOfficeColor, IsRgbColor
  • OfficeColorToRgb, RgbToOfficeColor

New procedures in CawtExcel:

  • CopyRange, GetCurrencyFormat, GetRangeFormat

New procedures in CawtPpt:

  • AddShape, ConfigureShape,
  • ConnectShapes, ConfigureConnector

New procedures in CawtWord:

  • SetHyperlinkToFile

2.3.0

2016-08-16

New module CawtOneNote.

 

Compatibility issue:

  • Excel::GetRangeAsIndex now returns a 2-element (cell) or 4-element (range) list. Previous behaviour was to always return a 4 element list.

 

CawtOneNote:

  • Added basic functionality for Microsoft OneNote.
  • Added script OneNoteInfo.tcl to retrieve information from OneNote.

 

New procedures in CawtExcel:

  • DuplicateColumn, DuplicateRow
  • GetHiddenRows, HideRow
  • InsertColumn, InsertRow
  • GetColumnNumber, ShowWorksheet
  • GetRangeWrapText, SetRangeWrapText
  • SetRangeValues, GetRangeValues, IsWorkbookId
  • SetNamedRange, GetNamedRange
  • GetNamedRangeNames

 

New procedures in CawtOutlook:

  • CreateHtmlMail

 

External packages:

  • Updated Tablelist to version 5.15.
  • Updated Twapi to version 4.2a3.
  • New package tDOM 0.8.3 (needed for CawtOneNote).

2.3.1

2016-12-10

Enhanced functionality in Core and Office modules.

 

CawtExcel:

  • Extended Excel module excelImgRaw to support 16-bit integer images.

 

New procedures in CawtCore:

  • CheckBoolean

 

New procedures in CawtExcel:

  • GetCellComment

 

New procedures in CawtWord:

  • Search SetRangeFontBackgroundColor

 

External packages:

  • Updated Img (32 and 64 bit) to version 1.4.6.
  • Updated Tablelist to version 5.16.

2.4.0

2017-06-18

New module CawtReader.

 

Compatibility issue:

  • Excel::ExcelFileToHtmlFile has changed signature.
  • Now uses parameter args for extended options.

 

CawtReader:

  • Added basic functionality for Acrobat Reader (not via COM).

 

CawtExcel:

  • Extended module excelHtml to convert Excel hyperlinks.

 

New procedures in CawtWord:

  • IsValidCell

 

External packages:

  • Updated Tablelist to version 5.17.
  • Updated Twapi to version 4.2a5.

2.4.1

2017-12-30

Enhanced functionality in Outlook module.

 

CawtOutlook:

  • Added handling of appointments, calendars and categories.
  • Added ability to read and apply Outlook holiday files.

 

CawtExcel:

  • Added ability to save CSV files in UTF-8 format.

 

New procedures in CawtExcel:

  • CreateRangeString, SetChartTicks

 

New procedures in CawtWord:

  • AddImageTable, GetImageId, GetImageName,
  • GetNumImages, ReplaceImage, SetImageName,
  • CountWords

 

External packages:

  • Updated Tablelist to version 6.0.
  • Updated Twapi to version 4.2.12.
  • Updated tDOM to version 0.9.0.
  • Updated Img to version 1.4.7.

2.4.2

2018-04-26

Enhanced functionality in several modules.

 

CawtPpt:

  • Added new configure options for shapes: -beginsite, -endsite
  • Added new configure option for connectors: -weight

 

CawtWord:

  • Corrected procedure SetDocumentProperty.

 

New procedures in CawtExcel:

  • Import, CopyColumn, SetChartSourceByIndex,
  • SetChartTitle, GetChartNumSeries, GetChartSeries,
  • SetSeriesLineWidth

 

New procedures in CawtPpt:

  • SetPresPageSetup, SetHyperlinkToSlide, GetNumSites

 

New procedures in CawtWord:

  • DeleteRow, SetRangeMergeCells

2.4.3

2018-12-27

Support for Office 2019.

 

CawtOffice:

  • Added script DocumentInfo.tcl to retrieve information about Office documents.

 

CawtWord:

  • Extended procedure GetRowRange to use start and end rows.
  • Extended procedure GetNumImages to consider both InlineShapes as well as Shapes.

 

New procedure in CawtOffice:

  • GetOfficeType

 

New procedure in CawtExcel:

  • AddSeriesTrendLine

 

New procedures in CawtPpt:

  • GetCommentKeyTopPosition, GetNumShapes,
  • GetPresImages, GetPresVideos, GetShapeId,
  • GetShapeMediaType, GetShapeName, GetShapeType,
  • InsertVideo, SetShapeName, SetMediaPlaySettings

 

New procedures in CawtWord:

  • CollapseRange, CopyRange, DeleteTable, GetImageList,
  • GetPageSetup, GetRowId, GetTableIdByName,
  • GetTableName, IsVisible, MergeCells, ScreenUpdate,
  • SetCellVerticalAlignment, SetHeadingFormat,
  • SetRowHeight, SetTableName

 

External packages:

  • Updated Tablelist to version 6.3.
  • Updated Img to version 1.4.8.
  • Updated Twapi to version 4.3.5.
  • Updated tDOM to version 0.9.1.

2.4.4

2019-06-08

Enhanced functionality in several modules.

 

CawtCore:

  • Added new utility procedures *OfficeDate*.  Declared old *OutlookDate* procedures as obsolete.

 

CawtExcel:

  • Extended procedure GetCellRange to allow specification of a cell range, not only a single cell.
  • Extended procedure AddSeriesTrendLine with option keys -linewidth and -linecolor.

 

New procedure in CawtExcel:

  • SetSeriesAttributes

 

New procedures in CawtWord:

  • SetTableAlignment, SetTableOptions,
  • SetTableVerticalAlignment

 

External packages:

  • Updated Tablelist to version 6.5.
  • Updated Img to version 1.4.9.

2.4.5

2019-08-13

Enhanced functionality in Word module.

 

CawtWord:

  • Corrected procedures FindString and Search, when called with a docId.

 

New procedures in CawtWord:

  • GetFooterText, GetHeaderText,
  • DeleteSubdocumentLinks, ExpandSubdocuments,
  • GetNumSubdocuments, GetSubdocumentPath

 

External packages:

  • Updated Tablelist to version 6.6.
  • Updated Twapi to version 4.3.7.

2.4.6

2019-10-12

Enhanced reference documentation.

 

CawtCore:

  • Extended test suite for complete test coverage.
  • Fixed bug in procedure GetColorNames.

 

Office modules:

  • Added procedures for each enumeration type.

 

CawtPpt:

  • Added new option "-fit" to proc InsertImage.

 

New procedures in CawtPpt:

  • CheckCreateVideoStatus, CreateVideo,
  • SetSlideShowTransition,
  • GetPresPageHeight, GetPresPageWidth

 

External packages:

  • Updated Ruff! to version 1.0b3.

2.4.7

2019-11-03

Enhanced functionality in Ppt and Word modules.

 

CawtPpt:

  • Extended InsertImage to support both image file names as well as photo images.
  • Corrected procedure ExportPptFile.
  • Added additional "-check" option to proc CreateVideo to specify the check interval.

 

New procedures in CawtPpt:

  • GetPptImageFormat, GetSupportedImageFormats,
  • GetCreateVideoStatus, IsImageFormatSupported

 

New procedures in CawtWord:

  • SetPageSetup,
  • GetCrossReferenceItems, GetHeadingRanges,
  • GetRangeText, SetRangeFontColor,
  • GetRangeFont, SetRangeFont

2.4.8

2020-03-08

Support for Office macro execution.

 

CawtExcel:

  • Fixed bugs in DiffExcelFiles.

 

CawtWord:

  • Fixed COM object leak in IsValidCell.

 

New procedures in CawtCore:

  • GetTmpDir

 

New procedures in CawtOffice:

  • AddMacro, RunMacro

 

New procedures in CawtExcel:

  • GetCellValueA1

 

New procedures in CawtWord:

  • GetRangeScreenPos

2.4.9

2020-06-09

Enhanced functionality in Excel module

 

All modules:

  • Compare procedure options with -nocase.

 

CawtExcel:

  • Fixed bug when reading CSV files with Unix line endings.

 

New procedures in CawtExcel: 

  • SetRangeFontAttributes, GetRangeFontAttributes

2.5.0

2020-07-24

Enhanced functionality for handling Office document properties.

 

CawtOffice:

  • Extended to support all types of document properties: bool, int, float, date and string.

 

New procedures in CawtOffice: 

  • AddProperty, DeleteProperty, GetProperty,
  • GetPropertyName, GetPropertyType, GetPropertyValue,
  • SetPropertyValue

2.6.0

2021-01-06

New module CawtSapi adding support for Microsoft Speech API.

 

New procedures in CawtCore:

·         SetEventCallback

 

External packages:

·         Updated Twapi to version 4.5.2.

·         Updated Tablelist to version 6.11.

·         Updated tDOM to version 0.9.2.

·         Updated Img to version 1.4.12.

2.7.0

2021-02-27

Enhanced functionality for handling Outlook contacts.

 

CawtCore:

·         Extended procedure CountWords to additionally sort by increasing or decreasing counts.

 

CawtExcel:

·         Changes in procedure WorksheetToTablelist:

Improved speed when handling worksheets with large number of columns.

Tablelist column headers are labeled like in Excel: A, B, C.

Added options -header, -rownumber, -maxrows, -maxcols.

 

CawtWord:

·         Extended GetHyperlinksAsDict to be used as a coroutine.

 

New procedures in CawtOutlook: 

·         AddContact, AddContactFolder, DeleteContactByIndex,

·         DeleteContactFolder, GetContactByIndex,

·         GetContactFolderId, GetContactFolderNames,

·         GetContactProperties, GetNumContactFolders,

·         GetContactReadOnlyPropertyNames,

·         GetContactReadWritePropertyNames,

·         GetNumContacts, HaveContactFolder,

·         SetContactProperties

 

New procedures in CawtPpt: 

·         GetNumSlideImages, GetNumSlideVideos,

·         GetSlideIdByName, GetSlideImages, GetSlideName,

·         GetSlideVideos, SetSlideName

 

New procedures in CawtWord: 

·         GetBookmarkNames, GetHyperlinksAsDict,

·         PrintHyperlinkDict, GetNumHyperlinks

 

External packages:

·         Updated Tablelist to version 6.12.

·         Updated Ruff! to version 1.1.

2.8.0

2021-06-27

Added functionality for embedding applications.

 

CawtExcel: 

·         Extended procedure OpenWorkbook to embed the application into a Tk frame.

 

CawtPpt: 

·         Extended procedure OpenPres to embed the application into a Tk frame.

 

CawtReader: 

·         Extended procedure Open to embed the application into a Tk frame.

 

CawtWord: 

·         Extended procedure OpenDocument to embed the application into a Tk frame.

 

New procedures in CawtCore: 

·         EmbedApp

 

New procedures in CawtExcel: 

·         GetNumStyles, GetStyleId

 

New procedures in CawtWord: 

·         GetNumPages, SetViewParameters

 

External packages:

·         Updated Tablelist to version 6.14.

·         Updated Ruff! to version 1.2.

2.8.1

2021-07-22

Maintenance release.

 

CawtExcel: 

·         Added automatic mapping of worksheet names to Excel constraints regarding invalid characters and maximum length.

 

CawtWord: 

·         Corrected behaviour of GetHyperlinksAsDict, if link points to an invalid domain.

2.8.2

2021-08-20

Maintenance release.

 

CawtWord: 

·         Corrected behaviour of GetHyperlinksAsDict, if link points to an URL with spaces.

·         Extended SetTableOptions with new option -width.

·         Extended SetColumnWidth to specify width in percent.

2.9.0

2021-12-19

Added functionality for interpolation curves.

 

CawtCore: 

·         Added oo:class to interpolate between control points.

 

CawtWord: 

·         GetHyperlinksAsDict:

o   Improved speed of URL validity check.

o   Added support for URL's with subaddress (ex. www.tcl3d.org/doc.html#Index).

 

New procedures in CawtCore: 

·         IsValidUrlAddress, SetClipboardWaitTime,

·         WaitClipboardReady

 

New procedures in CawtPpt: 

·         IsValidPresId, GetCurrentSlideIndex

 

External packages:

·         Updated Ruff! to version 2.0.

·         Updated Tablelist to version 6.16.

·         Updated Twapi to version 4.6.0.

2.9.1

2022-04-09

Maintenance release.

 

CawtExcel: 

·         Added option "-selection" to procedure WorksheetToTablelist to transfer the selected Excel cell range.

·         Corrected regexp in procedures GetRangeAsIndex and GetCellValueA1.

 

CawtOutlook: 

·         Improved GetFoldersRecursive.

 

New procedures in CawtWord: 

·         GetHeadingsAsDict, PrintHeadingDict

2.9.2

2022-12-21

Maintenance release.

 

CawtWord: 

·         Extended SetTableName and GetTableName to specify or retrieve the descriptive table text.

 

Test programs and documentation:

·         Corrected links due to new Ruff! version.

2.9.3

2023-03-20

Maintenance release.

 

CawtExcel: 

·         Corrected default value of parameter worksheetNameOrIndex from 0 to 1 in procedures ExcelFileToWikitFile and ExcelFileToMediaWikiFile.

·         Added test script showing how to export an Excel workbook as Wikit tables with hyperlinks.

 

CawtWord: 

·         Extended validity detection of sub-addresses in procedure GetHyperlinksAsDict to include <a id=”XXX”> in addition to <a name=”XXX”> addresses.

 

New procedures in CawtPpt: 

·         GetCommentKeyLeftPosition, GetCommentKeyPosition

 

External packages:

·         Updated Img to version 1.4.14.

·         Updated Ruff! to version 2.3.0.

·         Updated Tablelist to version 6.20.

·         Updated tDOM to version 0.9.3.

·         Updated Twapi to version 4.7.2.

2.9.4

2023-07-17

Maintenance release.

 

CawtWord: 

·         Extended validity detection of sub-addresses in procedure GetHyperlinksAsDict to include <a id='XXX'> and <a name='XXX'> addresses.

2.9.5

2024-03-12

Maintenance release.

 

CawtCore: 

·         Take care of changed Img behaviour in procedure ImgToClipboard:

·         Img 2.0 returns image data as binary string.

·         Img 1.4 returns image data as base64 encoded string.

 

CawtOutlook: 

·         Added new options "-requiredattendees" and "-optionalattendees" to procedures GetAppointmentProperties and AddAppointment.

2.9.6

2024-06-13

Maintenance release.

 

All modules:

·         Added support for Tcl 9.

·         Added support for Twapi 5.

 

New procedures in CawtExcel: 

·         GetListItemSeparator, SetListItemSeparator.

3.0.0

2024-12-08

Major release with full Tcl9 support.

 

·         More Tcl9 changes detected with tcl9-migrate tool.

·         Removed possible errors detected by Nagelfar.

·         Removed obsolete base64 package. Used "binary decode" instead.

·         Removed external packages and starkits. Use a BAWT Tcl-BI distribution for external packages.

 

CawtCore: 

·         Corrrected OfficeDate conversions.

 

CawtOffice: 

·         Updated enumerations and version strings for Office 2019.

 

CawtExcel: 

·         Added new format option "display" to procedure GetCellValue.

3.1.0

2025-01-29

Added new Outlook functionality.

 

CawtOutlook: 

·         Added new module for handling Outlook accounts.

·         Added options "-account" and “-onbehalf” to procedure SendMail.

 

Test programs: 

·         Delete directory testOut after test execution.

·         Added option "--nodelete" to disable deletion.

 

Removed obsolete procedures: 

·         Cawt::IsValidId (use Cawt::IsComObject instead)

·         Cawt::OutlookDateToSeconds (use Cawt::OfficeDateToSeconds instead)

·         Cawt::SecondsToOutlookDate (use Cawt::SecondsToOfficeDate instead)

·         Cawt::OutlookDateToIsoDate (use Cawt::OfficeDateToIsoDate instead)

·         Cawt::IsoDateToOutlookDate (use Cawt::IsoDateToOfficeDate instead)

·         Excel::GetFloatSeparator (use Excel::GetDecimalSeparator instead)

·         Excel::GetLangNumberFormat (use Excel::GetNumberFormat instead)

·         Excel::ChartToClipboard (use Excel::ChartObjToClipboard instead)

·         Excel::SaveChartAsImage (use Excel::SaveChartObjAsImage instead)

·         Excel::SetChartSize (use Excel::SetChartObjSize instead)

·         Office::RgbToColor (use Cawt::RgbToOfficeColor instead)

·         Office::ColorToRgb (use Cawt::OfficeColorToRgb instead)

·         Office::ShowAlerts (use modules specific ShowAlerts instead)

·          Outlook::OpenNew (use Outlook::Open instead)

3.1.1

2025-07-10

Maintenance release.

 

CawtExcel: 

·         Adapted clipboard management to changed TWAPI 5.1 behaviour.

·         Some minor fixes.

 

8            Tables

This chapter contains lists of figures, tables and terms and abbreviations.

 

8.1    Table of Figures

Figure 1: Overview of CAWT packages. 3

Figure 2: Module excelCsv. 9

Figure 3: Module excelTablelist 10

Figure 4: Module excelMatlabFile. 10

Figure 5: Module excelWord. 10

Figure 6: Module excelImgRaw.. 11

Figure 7: Module excelMediaWiki 11

Figure 8: Module excelWikit 11

Figure 9: Module excelHtml 12

Figure 10: Screenshot of EnumExplorer.tcl 31

Figure 11: Auto-generated Outlook mail from OneNoteInfo.tcl 32

Figure 12: Documentation generation workflow.. 39

 

8.2    Table of Tables

Table 1: CawtCore Reference. 6

Table 2: CawtOffice Reference. 7

Table 3: CawtEarth Reference. 8

Table 4: CawtExcel Reference. 17

Table 5: CawtExplorer Reference. 17

Table 6: CawtMatlab Reference. 18

Table 7: CawtOcr Reference. 18

Table 8: CawtOneNote Reference. 19

Table 9: CawtOutlook Reference. 22

Table 10: CawtPpt Reference. 24

Table 11: CawtReader Reference. 24

Table 12: CawtSapi Reference. 25

Table 13: CawtWord Reference. 29

Table 14: Test Programs. 37

 

8.3    Table of Terms and Abbreviations

 

Term / Abbreviation

Meaning

API

Application Program Interface

BAWT

Build Automation With Tcl

BSD

Berkeley Software Distribution

CAWT

COM Automation With Tcl

COM

Component Object Model

CSV

Comma Separated Values

DOM

Document Object Model

GUI

Graphical User Interface

HTML

Hypertext Markup Language

ISO

International Organization for Standardization

OCR

Optical Character Recognition

PDF

Portable Document Format

RGB

Red-Green-Blue

SAPI

Speech Application Programming Interface

Tcl

Tool Command Language

Tk

Toolkit

URL

Uniform Resource Locator

UTF

Unicode Transformation Format

XML

Extensible Markup Language