Home
Cawt User Manual - poSoft
Contents
1. CAWT User Manual Version 2 1 0 2015 09 01 Page 24 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl Excel 23 Font tcl Test CawtExcel procedures related to font handling Excel 24 Format tcl Test CawtExcel procedures related to specifying number formats If called without options the system separators are used If English is specified a dot is used as floating point separator and a comma as thousands separator If German is specified a comma is used as floating point separator and a dot as thousands separator Excel 25 Properties tcl Test CawtExcel procedures related to property handling 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 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 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 a test mail to info poSoft de Ppt 01 Basic
2. CAWT COM Automation With Tcl 2 3 5 Module excellmgRaw Module excellmgRaw Procedure overview ReadRawimageFile SetMatrixValues OpenWorkbook Matrix WriteRawlmageFile List of lists GetMatrixValues RawlmageFileToWorksheet WorksheetToRawimageFile RawimageFileToExcelFile ExcelFileToRawimageFile Figure 6 Module excellmgRaw 2 3 6 Module excelMediaWiki Module excelMediaWiki Procedure overview ReadMediaWikiFile SetMatrixValues OpenWorkbook Matrix WriteMediaWikiFile List of lists GetMatrixValues WorksheetToMediaWikiFile MediaWikiFile ToExcelFile ExcelFileToMediaWikiFile Figure 7 Module excelMediaWiki 2 3 7 Module excelWikit Module excelWikit Procedure overview ReadWikitFile SetMatrixValues OpenWorkbook Matrix WriteWikitFile List of lists GetMatrixValues WikitFileToWorksheet WorksheetToWikitFile WikitFileToExcelFile ExcelFileToWikitFile Figure 8 Module excelWikit CAWT User Manual Version 2 1 0 2015 09 01 Page 9 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl 2 3 8 Module excelHtml Module excelHtml Procedure overview OpenWorkbook SetMatrixValues Matrix WriteHtmiFile List of lists GetMatrixValues WorksheetToHtmiFile ExcelFileToHtmlFile Figure 9 Module excelHtml The following table lists all procedures available in na
3. 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 e Clipboard2Img Img2Clipboard New procedures in CawtExcel e SetRangeBorder 1 0 3 2013 08 30 New procedures in CawtExcel e ExcelFileToMediaWikiFile ExcelFileToWikitFile e ExcelFileToRawlmageFile RawlmageFileToExcelFile e ExcelFileToMatlabFile MatlabFileToExcelFile e 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 e SaveAsPdf e UpdateFields e Croplmage New procedures in CawtExcel e CopyWorksheetBefore CopyWorksheetAfter GetWorksheetIndexByName IsWorksheetProtected IsWorksheetVisible SetWorksheetTabColor UnhideWorksheet CAWT User Manual Version 2 1 0 2015 09 01 Page 29 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl e DiffExcelFiles 1 0 5 2014 01 26 New procedures in CawtExcel e SetCommentDisplayMode SetRangeComment e SetRangeMergeCells GetRangeCharacters e SetRangeFontSubscript SetRangeFontSuperscript
4. Text handling AddParagraph AppendText AddText Range handling GetStartRange GetRangeStartIndex ExtendRange Search Replace functionality FindString ReplaceString ReplaceByProc Formatting functionality SetRangeFontBold SetRangeBackgroundColor Caption handling InsertCaption ConfigureCaption Bookmark handling AddBookmark GetBookmarkName SetLinkToBookmark List handling GetListGallerylId GetListTemplatelId InsertList 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 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 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 T E Configure style of a caption type identified by its label identifier CreateRange Create a new text range CreateRangeAfter Create a new text range after specified range
5. Version 2 1 0 2015 09 01 Page 3 of 32 CAWT COM Automation With Tcl 1 3 Installation and Usage Installation of CAWT is simple and fast 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 Test Programs of the CAWT distribution and execute a test program with a line as follows gt tclsh Excel 01 Basic tcl See also chapter 5 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 Tc1 1ib 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 gt set TCLLIBPATH C myCawt If suitable versions of Twapi Tkimg Base64 or Tablelist are already available on your machine you may remove the appropriate folders from the Externals subfolder Otherwise you should move these packages into the same folder where you have copied Cawt to CAWT User Manual Version 2 1 0 2015 09 01 Page 4 of 32 Copyright 2008 2015
6. CropImage Crop an image at the four borders DiffWordFiles Compare two Word files visually 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 GetCellRange Return a cell 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 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 Return the numeric value of an enumeration GetEnumNames Return a list of names of a given enumeration type GetEnumTypes Return a list of available enumeration types GetEnumVal Return the numeric value of an enumeration name GetExtString GetListGalleryld tl Return the default extension of a Word file Get one of the 3 predefined list galleries CAWT User Manual Version 2 1 0 2015 09 01 Page 18 of
7. InsertImage Insert an image into a slide MoveSlide Move a slide to another position goss 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 SetTextboxFontSize Set the font size of the text in a text box SetViewType Set the view type of a presentation 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 8 CawtPpt Reference 2 9 CawtWord Automation for Microsoft Word The procedures of package CawtWord are implemented in namespace word The name of the controlled application is Word Application They provide functionality for the following domains CAWT User Manual Version 2 1 0 2015 09 01 Copyright 2008 2015 by Paul Obermeier All rights reserved Page 17 of 32 CAWT COM Automation With Tcl Domain Examples Application handling Open Quit GetVersion Document handling OpenDocument AddDocument SaveAs Close Table handling AddTable GetNumRows SetCellValue GetCellValue
8. 1 0 6 2014 04 21 Improved and extended test suite Updated Twapi version to 4 0653 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 e GetWorksheetAsMatrix e GetMaxRows GetMaxColumns e GetFirstUsedRow GetLastUsedRow e GetFirstUsedColumn GetLastUsedColumn 1 0 7 2014 06 14 Updated Twapi version to official 4 0 61 CawtExcel e Added support for reading and writing CSV files with multi line cells CawtPpt e Extended CopySlide to copy slides between presentations e Extended AddPres with optional parameter for template file e Extended AddSlide to supply a custom layout object as type parameter Extended test suite for changed and new procedures New procedures in CawtCore e ColorToRgb New procedures in CawtExcel e UselmgTransparency WorksheetTolmg ImgToWorksheet e SetRowHeight SetRowsHeight e GetRangeFillColor e SetHyperlinkToFile SetHyperlinkToCell SetLinkToCell e SetRangeTooltip New procedures in CawtPpt e MoveSlide e GetTemplateExtString e GetNumCustomLayouts e GetCustomLayoutName GetCustomLayoutld 1 1 0 2014 08 30 Compatibility issue e Incompatible changes in module CawtWord e Unified signatures of AddText AppendText and AddParagraph Appen
9. 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl GetListTemplatelId 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 GetNumRows Return the number of rows of a Word table GetNumTables Return the number of tables of a Word document GetRangeEndIndex Return the end index of a text range GetRangeInformation Get information about a text range GetRangeStartIndex Return the start index of a text range GetRowRange Return a row 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 GetTableIdByIndex Find a table by its index 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 Inse
10. Internet Options gt Security gt Trusted Sites Internet Options gt Security gt Internet Internet Options gt Security gt Restricted Sites Low Medium unchecked Enable Protected Mode unchecked Enable Protected Mode The following table lists all procedures available in namespace Explorer Procedure Short description Pah T Toggle the fullscreen mode of an Internet Explorer application areas window Go Go to a specific page IsBusy Check if an Internet Explorer instance is busy Navigate Navigate to a URL or local file ee Open an Internet Explorer instance Use an already running Geesen instance if available OpenNew Open a new Internet Explorer instance Quit Quit an Internet Explorer instance E Toggle the visibility of an Internet Explorer application Z window Table 4 CawtExplorer Reference CAWT User Manual Version 2 1 0 2015 09 01 Page 14 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl 2 5 CawtMatlab Automation for MathWorks Matlab The procedures of package CawtMatlab are implemented in namespace Matlab The name of the controlled application is Matlab Application 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 t
11. Manual Copyright 2008 2015 by Paul Obermeier All rights reserved Version 2 1 0 2015 09 01 Page 31 of 32 CAWT COM Automation With Tcl TclString procedure CawtPpt e Extended functionality of ExportPptFile and ExportSlides to take into account slide comments regarding export file names New procedures in CawtCore e TclString New procedures in CawtExcel e DeleteColumn DeleteRow e HideColumn GetHiddenColumns e GetDecimalSeparator replacing GetFloatSeparator e GetThousandsSeparator e GetNumberFormat replacing GetLangNumberFormat New procedures in CawtPpt e AddTextbox AddTextboxText SetTextboxFontSize e GetNumComments GetComments GetCommentKeyValue New procedures in CawtWord e AddContentControl e SetContentControlDropdown SetContentControlT ext e GetDocumentProperties GetDocumentProperty e SetDocumentProperty CAWT User Manual Version 2 1 0 2015 09 01 Page 32 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved
12. Microsoft PowerPoint The procedures of package CawtPpt are implemented in namespace Ppt The name of the controlled application is PowerPoint Application 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 UseSlideShow SlideShowFirst SlideShowNext SlideShow handling Custom layout handling GetNumCustomLayouts GetCustomLayoutName See the test programs Ppt tc1 for examples on how to use the procedures of this package The following table lists all procedures available in namespace Ppt Procedure Short description AddPres Add a new empty presentation AddSlide Add a new slide to a presentation AddTextbox Add a text box into a slide CAWT User Manual Version 2 1 0 2015 09 01 Copyright 2008 2015 by Paul Obermeier All rights reserved Page 16 of 32 CAWT COM Automation With Tcl AddTextboxText Add a text string to a text box Close Close a presentation without saving changes CloseAll Close all presentations of a PowerPoint instance CopySlide Copy the contents of a slide into another slide ExitSlideShow Exit specified slide show ExportPptFile Export a PowerPoint file to an image sequence Expo
13. cells identifier of a worksheet GetCellvalue Return the value of a cell GetColumnRange Return a numeric column range as an Excel range string GetColumnValues Return column values as a Tcl list GetCsvSeparatorChar Return the column separator character GetDecimalSeparator Return the decimal separator used by Excel GetEnum Return the numeric value of an enumeration GetEnumNames Return a list of names of a given enumeration type GetEnumTypes Return a list of available enumeration types GetEnumVal Return the 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 e Obsolete Replaced with GetDecimalSeparator in version GetFloatSeparator 210 GetHiddenColumns Return the hidden columns of a worksheet 9 Obsolete Replaced with GetNumberFormat in version GetLangNumberFormat 210 GetLastUsedColumn Return the index of the last used column of a worksheet GetLastUsedRow Return the index of the last used row of a worksheet 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 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
14. 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 Table 10 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 CawtExcel Windows XP Windows 7 Windows 8 Windows XP Windows 7 Windows 8 6 2 7 1 2 2003 2007 2010 2013 CAWT User Manual Version 2 1 0 2015 09 01 Page 25 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl CawtExplorer Windows XP Windows 7 Windows 8 IE 8 IE 9 IE 11 CawtMatlab Windows XP R2007b CawtOcr Windows XP Windows 7 Windows 8 2003 2007 2010 2013 CawtOutlook Windows 7 Windows 8 2010 2013 CawtPpt Windows XP Windows 7 Windows 8 2003 2007 2010 2013 CawtWord Windows XP Windows 7 Windows 8 2003 2007 2010 2013 See chapter 2 4 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 gt tclsh Excel 02 Misc tcl To execute all test programs of a
15. identifier CAWT User Manual Version 2 1 0 2015 09 01 Page 5 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl IsComObject Check if a COM object is valid IsValidId Obsolete Replaced with IsComObject in version 2 0 0 KillApp Kill all running instances of an application 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 RgbToColor Return a RGB color as an Office color number SetDocument Property Set the value of a document property SetDotsPerInch Set the dots per inch value used for conversions ShowAlerts Toggle the display of Office alerts TclBool Cast a value to a boolean TcliInt Cast a value to an integer with boolean range TelString Cast a value to a string Table 1 CawtCore Reference 2 2 CawtEarth Automation for Google Earth The procedures of package CawtEarth are implemented in namespace Earth The name of the controlled application is Googlekarth ApplicationGE 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 foll
16. sub package use the utility script RunTest tcl gt tclsh RunTest tcl Excel To execute all test programs of CAWT use the batch program RunTests bat gt 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 Excel Ppt Word Outlook Ocr Earth Matlab Explorer Use all as namespace name to run tests and checks for all namespaces 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 CAWT User Manual Version 2 1 0 2
17. 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 Word 01 Basic tcl Test basic functionality of the CawtWord package Word 02 Table tcl Test CawtWord procedures related to Word table management Word 03 Text tcl Test CawtWord procedures for handling text Word 04 Find tcl Test CawtWord procedures related to search and replace functionality Word 05 Report tcl Test CawtWord procedures needed for generating a test report It is assumed that the test data is read from an external data sink ex file there are images to be inserted that are in a format Word does not know about and a summary should be printed at the first page Word 06 Diff tcl Test CawtWord procedure for diff ing Word files Word 07 Link tcl Test CawtWord procedures
18. 015 09 01 Page 26 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl 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 the Ruff and textutil packages for generating the reference documentation out of the Tcl sources as well as some additional utility scripts Create or update Office enumeration values The files containing the enumeration values of the Office applications Excel excelConst tcl PowerPoint pptConst tcl1 Word wordConst tcl and Outlook outlookConst tc1 are automatically generated with script createConstFile tcl The enumeration values of the current CAWT distribution are based on Microsoft Office 2013 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 Note also that the enumeration files are created in the CAWT root directory so you have to copy them into the appropriate sub folders by hand but check and compare the differences to the existing files fir
19. CAWT COM Automation With Tcl CAWT COM Automation With Tcl T INTRODUCTION geseet ege 2 1 1 ArGHitSCtUre OVEIRVIOW Eden dee e Eed a Eent 2 1 2 Eege enee eege eege NEE 3 1 3 Installation ee Re 4 2 PACKAGES IN DET ANE iiien rereana e aeaa aise ee eee tend 5 2 1 CawtCore Basic automation functionality cccceeeeceeeeeneeee eter ee eeeeeeneeeeeeeeeeeeeeeeaaees 5 2 2 CawtEarth Automation for Google Eat 6 2 3 CawtExcel Automation for Microsoft Excel 6 Ard sMOdule CxGelCs TEE 7 KE EE ercel Tabeli EE 8 23 3 Module excel Maloo File sccsusscxccscsiees ssn la te EA cave ghee bn bake Casket deh dela ves ghee bon ba a Bi ab eadi dete 8 23 4 Module excel Word encare EAE A suahesedevarecdasvanececavennesaseancs 8 E EE 9 2 3 6 Module ecelMedioaWikt aaen nE e RS Tn ea DAI RoE TEO i Eana eeni Taata 9 2 357 Mogul ercel EE 9 23 8 Module E 10 2 4 CawtExplorer Automation for Internet Explorer ceeeeeeeeeeeeeeeeeeeeeeeenneeeeeeeeeeeteeee 14 2 5 CawtMatlab Automation for MathWorks Matlab 15 2 6 CawtOcr Automation for Microsoft Document Imaging ccceeeeeeeetteteeeeeeeeeeeee 15 2 7 CawtOutlook Automation for Microsoft Outlook ssssssssseeeseessserrerrnnressrrrrerrnneesee 16 2 8 CawtPpt Automation for Microsoft PowerPoint sssssssssseersnesssererrrrnnresserrrrrrnnnesee 16 2 9 CawtWord Automation for Microsoft Word 17 3 MISCELLANEOUS CAWT INFORMATION cccccceseeeeesesseeeeeseenee
20. SetHyperlinkToFile Insert a hyperlink to a file into a cell SetLinkToCell Insert an internal link to a cell into another cell SetMatrixValues Insert matrix values into a worksheet 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 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 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 SetRangeVerticalAlignment Set the vertical alignment 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 SetTablelistHeader Insert header values into a tablelist SetTablelistValues Insert m
21. atrix values into a tablelist SetWindowState Set the window state of an Excel application SetWorksheetFitToPages Adjust a worksheet to fit onto given number of pages SetWorksheetName Set the name of a worksheet SetWorksheetOrientation Set the orientation of a worksheet SetWorksheetTabColor Set the color of the tab of a worksheet SetWorksheetZoom Set the zoom factor for printing of a worksheet ShowCel1lByIndex Show a cell identified by its row column index 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 Toggle 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 CAWT User Manual Version 2 1 0 2015 09 01 Page 13 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl WorksheetToHtmlFile Write the values of a worksheet into a HTML table file WorksheetToImg Put worksheet background colors into a photo image WorksheetToMat
22. by Paul Obermeier All rights reserved CAWT COM Automation With Tcl 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 RgbToColor TclBool COM access via Twapi GetOrCreateApp IsValidId Destroy Common Office functionality GetApplicationName GetDocumentProperties Testing utilities CheckString CheckNumber CheckMatrix Image utilities ClipboardToImg ImgToClipboard The following table lists all procedures available in namespace Cawt Procedure Short description CentiMetersToPoints Convert centimeter value into points CheckComObjects Check if the number of COM objects fits expected value 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 ClipboardToImg Copy the clipboard content into a photo image ColorToRgb Retur
23. cel 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 SetChartObj Position Set the position of a chart object CAWT User Manual Version 2 1 0 2015 09 01 Page 12 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl SetChartObjSize Set the size of a chart object Set the minimum and maximum scale of both axes of a SetChartScale chart SetChartSize Obsolete Replaced with SetChartObjSize in version 1 0 1 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 SetCommentSiz Set the shape size of a comment SetCsvSeparatorChar Set the column separator character Insert row values from a Tcl list and format as a header SetHeaderRow row SetHyperlink Insert a hyperlink into a cell SetHyperlinkToCell Insert a hyperlink to a cell into another cell
24. cell range 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 GetRangeAs Index Get address of a cell range as list of row column indices ee ee Get address of acell range as Excel range string in A1 notation GetRangeCharacters Return characters of a cell range GetRangeFillColor Get the fill color of a cell 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 GetRangeHorizontalAlignment Get the horizontal alignment of a cell range GetRangeTextColor Get the text color of a cell range GetRangeVerticalAlignment Get the vrtical alignment of a cell range GetRowValues Return row values as a Tcl list 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 CAWT User Manual Version 2 1 0 2015 09 01 Page 11 of 32 Copyright 2008 2015 by Pa
25. change 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 tcl Test CawtExcel procedures to exchange data between Excel and RAW photo 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 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 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
26. dParagraph e Changed handling of text ranges New module CawtOutlook to control Microsoft Outlook applications e Currently only functionality for creating and sending mails is implemented Extended test suite for changed and new procedures New procedures in CawtExcel e FreezePanes ScreenUpdate New procedures in CawtWord e SelectRange GetRangelnformation CreateRange e SetRangeFontName SetRangeStyle SetRangeFontSize e InsertText AddText GetNumCharacters CAWT User Manual Copyright 2008 2015 by Paul Obermeier All rights reserved Version 2 1 0 2015 09 01 Page 30 of 32 CAWT COM Automation With Tcl e AddPageBreak ToggleSpellCheck 1 2 0 2014 12 14 Compatibility issue e Incompatible changes in module CawtWord Removed parameter docld from all procedures which had both docld and rangeld parameters e SetRangeStartIndex SetRangeEndIndex ExtendRange e AddText SetHyperlink AddTable CawtExcel e Added optional startRow parameter to TablelistT oWorksheet Extended test suite for changed and new procedures New procedures in CawtWord e GetDocumentid e SetRangeFontUnderline CreateRangeAfter e InsertCaption ConfigureCaption e AddBookmark GetBookmarkName SetLinkToBookmark e GetListGalleryld GetListTemplateld 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 has
27. eeeseseeseeseeneeeeeseeneeees 21 3 1 Een tee Lee EE 21 d CAWT APPLICATIONS era re rr eE stecens auch deta nesadeatheeadebecetanecsuetedetesedaeensoente 22 4 1 Application Ve e KEE E Le 22 4 2 Application EnumExplorer tel EE 22 Sr TEST PROG PAM ee a E T ee T es ices 24 5 1 TBST EE 24 5 2 KE re EE 26 INSIDE GAWD EE 27 T RELEASE SR dee eege ee tee ee ee le 29 CAWT User Manual Version 2 1 0 2015 09 01 Page 1 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl 1 Introduction 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 Outlook and Internet Explorer MathWorks Matlab and Google Earth are available Note Only Microsoft Office packages Excel Word and PowerPoint 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 http www poSoft de html extCawt html The CAWT user distribution contains the Tcl sources documentation this document and a reference manual several test programs showing the use of the CAWT functionality and the needed external libraries Twapi Tklmg Base64 and Tablelist see chapter 1 2 for details The CAWT developer distribution additionally contains scr
28. ge SetRangeFontBold SetRangeBackgroundColorByEnum Set the background color of a text range SetRangeEndIndex Set the end index of a text range Toggle the bold font style of a text range SetRangeFontItalic Toggle the italic font style of a text range SetRangeFontName Set the font name of a text range CAWT User Manual Version 2 1 0 2015 09 01 Copyright 2008 2015 by Paul Obermeier All rights reserved Page 19 of 32 CAWT COM Automation With Tcl RangeFontSize Set the font size of a text range RangeFontUnderline Toggle the underline font style of a text range RangeHighlightColorByEnum Set the highlight color of a text range RangeHorizontalAlignment Set the horizontal alignment of a text range RangestartIndex Set the start index of a text range Rangestyle Set the style of a text range Wel WU CT rr ir ct ict Wd RowValues Insert row values from a Tcl list SetTableBorderLineStyl Set the border line styles of a Word table SetTableBorderLineWidth Set the border line widths of a Word table 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 applicati
29. h 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 e Updated Twapi to version 4 1 27 e Updated Img 32 and 64 bit to version 1 4 3 e Updated Tablelist to version 5 13 CawtExcel e New implementation of Insertlimage based on Shapes AddPicture instead of Pictures Insert CawtWord e Extended procedure UpdateFields to additionally update TablesOfContents and TablesOfFigures of a document New procedures in CawtCore e GetApplicationVersion IsApplicationld e PushComObjects PopComObjects e PrintNumComObjects CheckComObjects e GetComObjects GetNumComObjects e Replaced procedure IsValidld with IsComObject New procedures in CawtExcel e GetRangeAsindex GetRangeAsString GetRangeTextColor New procedures in CawtWord e Scalelmage SetInternalHyperlink InsertFile DiffWordFile 2 1 0 2015 09 01 Updated Twapi to version 4 2 a1 because of new Twapi functionality tclcast betr and bug fix to retrieve document properties Added support to generate a CAWT starpack CawtExcel e Take hidden flag of both Excel and tablelist columns into account in procedures TablelistToWorksheet and WorksheetToTablelist e Fixed SetCellValue and SetRangeFormat using new CAWT User
30. he procedures of this package The following table lists all procedures available in namespace Mat lab Procedure Short description ExecCmd Execute a Matlab command Gen Open a Matlab instance Use an already running instance if EE available OpenNew Open a new Matlab instance Quit Quit a Matlab instance Visible Toggle the visibility of a Matlab application window Table 5 CawtMatlab Reference 2 6 CawtOcr Automation for Microsoft Document Imaging The procedures of package CawtOer are implemented in namespace ocr The name of the controlled application is MODI Document 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 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 f
31. iaWikiFileToWorksheet Insert the values of a MediaWiki table file into a worksheet Ben Open an Excel instance Use an already running instance Gees 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 RawImageFileToExcelFil Convert a raw photo image file to an Excel file ee ee 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 ReadMat labHeader 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 BEE T Replaced with SaveChartObjAslmage in version 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 ETT en ee Select a range by specifying an Ex
32. ile for OCR scanning Scan Scan an image Table 6 CawtOcr Reference CAWT User Manual Version 2 1 0 2015 09 01 Page 15 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl 2 7 CawtOutlook Automation for Microsoft Outlook The procedures of package CawtOutlook are implemented in namespace outlook The name of the controlled application is Out1look Application They provide functionality for the following domains Domain Examples Application handling Open Quit GetVersion Mail handling CreateMail SendMail See the test programs Outlook tcl1 for examples on how to use the procedures of this package The following table lists all procedures available in namespace Outlook Procedure Short description CreateMail Create a new Outlook mail GetEnum Return the numeric value of an enumeration GetEnumNames Return a list of names of a given enumeration type GetEnumTypes Return a list of available enumeration types GetEnumVal Return the numeric value of an enumeration name GetVersion Return the version of an Outlook application iced Open an Outlook instance Use an already running instance es if available OpenNew Open a new Outlook instance Quit Quit an Outlook instance SendMail Send an Outlook mail Table 7 CawtOutlook Reference 2 8 CawtPpt Automation for
33. ipts for generating the documentation the distribution packages and the CAWT Starkit and Starpack It also includes the external packages Ruff and textutil see chapter 1 2 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 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 CawtOutlook Automation functionality for Microsoft Outlook CawtPpt Automation functionality for Microsoft PowerPoint 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 CAWT User Manual Version 2 1 0 2015 09 01 Page 2 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl CAWT Overview of packages Microsoft Office
34. labFile Insert the values of a worksheet into a Matlab file WorksheetToMediaWikiFile Insert the values of a worksheet into a MediaWiki table file Worksheet ToRawImageFile Hi the values of a worksheet into a raw photo image 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 3 CawtExcel Reference 2 4 CawtExplorer Automation for Internet Explorer The procedures of package CawtExplorer are implemented in namespace Explorer The name of the controlled application is InternetExplorer Application 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
35. meier All rights reserved Page 23 of 32 CAWT COM Automation With Tcl 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 Earth 01 Basic tcl Test basic functionality of the CawtEarth package Barth 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 Clicking onto one of these buttons triggers Google Earth to fly to that position Excel 0O1 Basic tcl Test basic functionality of the CawtExcel package Excel 02 Misc tcl Test miscellaneous CawtExcel procedures like setting colors column width inserting formulas searching and page setup 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 08 Tablelist tcl Test CawtExcel procedures to ex
36. mespace Excel 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 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 EE E Replaced with ChartObjToClipboard in version ClipboardToMatrix Return the matrix values contained in the clipboard EE 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 CopyWorksheet Copy the contents of a worksheet into another worksheet CopyWorksheetAfter Copy the contents of a worksheet after another worksheet Peter Becbegg Copy the contents of a worksheet before another worksheet CreateChart Create a new empty chart in a worksheet CsvRowToList Return a CSV enc
37. n an Office color number as a RGB color list Destroy Destroy one or all COM objects 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 GetComObjects Return the COM objects currently in use as a list GetDocument Properties Get document property names as a list GetDocumentProperty Get the value of a document property GetDotsPerInch Return the dots per inch value used for conversions GetInstallationPath Get the Office installation pathname GetNumComObjects Return 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 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 HavePkg Check if a Cawt sub package is available ImgToClipboard Copy a photo image into the clipboard InchesToPoints Convert inch value into points IsApplicationId Check if Office object is an application
38. namespace Ppt Word Outlook Copyasenum Copyasstring Quit Excel 263 enumerations Excel XlAboveBelow 6 values Enumeration Name 1 Constants xlAboveAverage 0 ETS 3 XlActionType xlBelowAverage 1 4 XlAllocation xiBelowStdDev 5 XlAllocationMethod xlEqualAboveAverage 6 XlAllocationValue xlEqualBelowAverage XlApplicationInternational XlApplyNamesOrder XlArabicModes 10 XlArrangeStyle 11 XlArrowHeadLength 12 XlArrowHeadStyle 47 VA aene aa arta Copied to clipboard xlAboveStdDev Figure 10 Screenshot of EnumExplorer tcl If started with option he1p it prints out a usage message gt tclsh EnumExplorer tcl help Usage EnumExplorer tcl Namespace Start enumeration explorer and display specified namespac If no namespace is given the first namespace in this list is used Excel Ppt Word Outlook Pressing the Copy as enum button or the C key copies the currently selected enumeration as Tcl variable to the clipboard Example SExcel xlAboveStdDev Pressing the Copy as string button or the c key copies the currently selected enumeration name to the clipboard CAWT User Manual Version 2 1 0 2015 09 01 Page 22 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl Example xlAboveStdDev CAWT User Manual Version 2 1 0 2015 09 01 Copyright 2008 2015 by Paul Ober
39. ng with data exchange 2 3 1 Module excelCsv Module excelCsv Procedure overview ReadCsvFile WriteCsvFile OpenWorkbook SetMatrixValues GetMatrixValues Matrix List of lists CsvStringToMatrix MatrixToCsvString CSV File SaveAsCsv SS Figure 2 Module excelCsv CAWT User Manual Version 2 1 0 2015 09 01 Page 7 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl 2 3 2 Module excelTablelist Module excelTablelist Procedure overview GetTablelistValues SetMatrixValues Matrix SetTablelistValues List of lists GetMatrixValues TablelistfoWorksheet WorksheetToTablelist Figure 3 Module excelTablelist 2 3 3 Module excelMatlabFile Module excelMatlabFile Procedure overview ReadMatlabFile SetMatrixValues OpenWorkbook Matrix WriteMatlabFile List of lists GetMatrixValues MatlabFileToWorksheet WorksheetToMatlabFile MatlabFileToExcelFile ExcelFileToMatlabFile Figure 4 Module excelMatlabFile 2 3 4 Module excelWord Module excelWord Procedure overview Word GetMatrix Values SetMatrixValues Matrix Word SetMatrix Values List of lists GetMatrixValues WordTableToWorksheet WorksheetToWordTable Figure 5 Module excelWord CAWT User Manual Version 2 1 0 2015 09 01 Copyright 2008 2015 by Paul Obermeier All rights reserved Page 8 of 32
40. oded 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 DeleteWorksheetBy Index Delete a worksheet identified by its index DiffExcelFiles Compare two Excel files visually 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 CAWT User Manual Version 2 1 0 2015 09 01 Copyright 2008 2015 by Paul Obermeier All rights reserved Page 10 of 32 CAWT COM Automation With Tcl FormatHeaderRow Format a row as a header row Freeze a range in a worksheet identified by its row column FreezePanes i EE index GetActiveWorkbook Return the active workbook of an application GetCellIdByIndex Return a cell of a worksheet TT Return a numeric cell range as an Excel range string in A1 notation GetCellsiId Return the
41. on window Table 9 CawtWord Reference CAWT User Manual Version 2 1 0 2015 09 01 Page 20 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl 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 BSD license CAWT relies on several other Tcl packages See the table in chapter 1 2 for links to these packages to get their license information CAWT User Manual Version 2 1 0 2015 09 01 Page 21 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl 4 CAWT applications CAWT includes the following scripts which can be used as standalone applications e Word2Pdf tcl e EnumExplorer tcl 4 1 Application Word2Pdf tcl The application Word2Pdf tcl1 can be used to convert a Word file to a PDF file Note that PDF export is support by Word since version 2007 If started with option help it prints out a usage message gt tclsh Word2Pdf tcl help Usage Word2Pdf tcl Options WordFile PdfFile Options None at the moment 4 2 Application EnumExplorer tcl The application EnumExplorer tcl can be used to explore the enumerations of the Office applications Excel Outlook PowerPoint and Word Show
42. owing table lists all procedures available in namespace Earth Procedure Short description IsInitialized Check if a GoogleEarth instance is initialized Open a GoogleEarth instance Use an already running Open A h f SSC instance if available 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 2 CawtEarth Reference 2 3 CawtExcel Automation for Microsoft Excel The procedures of package CawtExcel are implemented in namespace Excel The name of the controlled application is Excel Application 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 CAWT User Manual Version 2 1 0 2015 09 01 Page 6 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl Chart handling ChartObjToClipboard CreateChart AddLineChart Insert values SetCellValue SetRowValues SetMatrixValues Retrieve values GetCellValue GetRowValues GetMatrixValues Formatting functionality SetColumnWidth SetHyperlink SetRangeTextColor Clipboard functionality Clipboa
43. packages CawtExcel CawtOutlook Microsoft Excel Microsoft Outlook CawtPpt CawtWord Microsoft PowerPoint Microsoft Word CawtEarth CawtExplorer CawtOcr Google Earth MS Internet Explorer MS Document Imaging CawtMatlab MathWorks Matlab CawtCore Basic Automation 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 from Tcllib textutil included in CAWT developer distribution Lib Version Comment URL Twapi gt 4 2 Mandatory Included in CAWT http twapi maqgicsplat com user distribution Tkimg gt 1 4 1 Optional Included in CAWT http sourceforge net projects tkimg user distribution http www poSoft de html extTkImg html Base64 Optional Included in CAWT http sourceforge net projects tcllib user distribution Tablelist gt 4 Optional Included in CAWT http www nemethi de user distribution Ruff 0 4 Included in CAWT developer http woof magicsplat com ruff_home distribution Tcllib Ruff needs the textutil module http sourceforge net projects tcllib TkImg Needed only for some functionalities See the CawtExcel package for further details Base64 Needed for photo image to clipboard functionality Tablelist Needed only for the excelTablelist module CAWT User Manual Copyright 2008 2015 by Paul Obermeier All rights reserved
44. rdToMatrix ClipboardToWorksheet External file handling Csv Raw Images MediaWiki Wikit Matlab files External table tools handling Tablelist Word tables The commands are grouped and implemented in the following modules Implementation file Description excel Const tel All Excel enumeration types excelBasic tcl Basic Excel commands excelUtil tel 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 http Avww mathworks com help pdf_doc matlab mattile_format pdf Raw images http docs activestate com activetcl 8 5 img doc img raw html MediaWiki https meta wikimedia org wiki Help Table Wikit http wiki tcl tk 14 See the test programs Excel tcl for examples on how to use the procedures of this package The next chapters explain the Excel modules deali
45. rtList Insert a Word list InsertText Insert text in a Word document geg 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 PrintRange Print the indices of a text range Quit Quit a Word instance ReplaceByProc Replace a string in a text range Generic case E 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 SelectRange Select a text range SetCellValue Set the value 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 N A SetContentControlText N A SetHeaderRow Insert row values into a Word table and format as a header row SetHyperlink Insert an external hyperlink into a Word document 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 SetRangeBackgroundColor Set the background color of a text ran
46. rtSlide Export a slide as an image ExportSlides Export a range of slides as image files GetActivePres Return the active presentation of an application GetCommentKeyValu Return the value of a key stored in a comment GetComments Get the comment texts of a slide as a Tcl list GetCustomLayoutId Get a custom layout by its index or name GetCustomLayoutName Return the name of a custom layout GetEnum Return the numeric value of an enumeration GetEnumNames Return a list of names of a given enumeration type GetEnumTypes Return a list of available enumeration types GetEnumVal Return the 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 GetNumSlides Return the number of slides of a presentation GetNumS1lideShows Return the number of slide shows of a presentation GetSlidelId Get slide identifier from slide index GetSlideIndex Return the index of a slide 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
47. st 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 Document s UserManual The final documentation is created by Tcl script genCawtDoc tc1 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 CAWT Source jl Tcl Files CAWT Reference if HTML Files CAWT User Manual Version 2 1 0 2015 09 01 Page 27 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl Figure 11 Documentation generation workflow If specifying the strings ref or user aS command line parameter for script genCaw
48. tDoc 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 tc1 and must be adapted to your local situation CAWT User Manual Version 2 1 0 2015 09 01 Page 28 of 32 Copyright 2008 2015 by Paul Obermeier All rights reserved CAWT COM Automation With Tcl 7 Release history The following table gives an overview of the release history of CAWT and it s predecessors TcomOffice and TcomExcel Version Date Release notes 2008 09 11 Initial release Support for Excel 2000 and 2003 2009 09 19 Extended functionality Added support for Excel 2007 2010 10 29 Bug fixes and extended test programs 2011 01 13 Extended functionality Added support for Excel 2010 2011 04 05 Extended functionality 2011 07 17 New module TcomWord for Word automation 2011 08 28 Extended functionality 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
49. ul Obermeier All rights reserved CAWT COM Automation With Tcl GetVersion Return the version of an Excel application GetWorkbookName Return the name of a workbook GetWorksheetAsMatrix Return worksheet table as a matrix GetWorksheet IdByIndex Find a worksheet by its index GetWorksheet IdByName Find a worksheet by its name GetWorksheet IndexByName Find a worksheet index by its name GetWorksheetName Return the name of a worksheet HideColumn Hide or unhide a column ImgToWorksheet Put a photo image into a worksheet InsertImage Insert an image into a worksheet IsWorkbookProtected Check if a workbook is protected IsWorksheetProtected Check if a worksheet is content protected IsWorksheetVisible Check if a worksheet is visible Return a list of column values as a CSV encoded row ListToCsvRow string 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 Med
Download Pdf Manuals
Related Search
Related Contents
Magnavox VRZ242AT Owner's Manual H-1635U (171.12 кб) 20-54-700 シングルカフ 新生児用 20-54-710 シングルカフ 小児用 20 Olympus WS-812 TH-K20/K40 Copyright © All rights reserved.
Failed to retrieve file