Compiled Modules

From Pengower
Jump to: navigation, search


Word Manager

Extract Keywords

Method Name:

• “WordManager_ExtractKeywords”

Purpose:

• Extract all Keywords tagged in the document

Parameters:

• docName* – String – Full name of the docx file • start* – String – Starting characters of the Tag • end* – String – Ending characters of the Tag

Output:

• Array – Array containing all keywords found

Insert Table

Method Name:

• “WordManager_InsertTable”

Purpose:

• To Insert a table of data into a document

Parameters:

• docName* – String – Full name of the docx file to insert table into • tagName* – String – Text that exists somewhere in the document in a separate paragraph to be replaced with a table. o Not a Content Control • heading* – Array – Array of strings containing column headings • data* – Array – Array of row arrays containing strings of the cell data o { row1{cell1, cell2, cell3}, row2{cell1, cell2, cell3}} • font – String – Name of font to use • cellWidth – String – Size of cells (units?) • size – String – Font Size (units?)

Output:

• String – “Ok” – N.B. Inserts into an existing document

Merge Documents

Method Name:

• “WordManager_MergeDocuments”

Purpose:

• Combine multiple documents into one document

Parameters:

• newDocument* – String – path to save new document • documents* – Array – Array of document paths

Output:

• String – “Ok”

Read

Method Name:

• “WordManager_Read”

Purpose:

• Reads a single content control from a docx file

Parameters:

• docName* – String – Full name of the docx file • tagName* – String – Tag name of the content control (or several content controls in the case of checkboxes)

Output:

• String - Contents of the Content Control as Text

Read Table

Method Name:

• “WordManager_ReadTable”

Purpose:

• Reading values from a table (previously inserted into a document using Insert_Table?)

Parameters:

• docName* – String – Full name of the docx file to read table from • tagName* – Name of the Tag as used in ‘Insert_Table’

Output:

• Array – 2 dimensional array containing the values in the table.

Replace

Method Name:

• “WordManager_Replace”

Purpose:

• Create a new document based on a template and replacements

Parameters:

• docName* – String – Full name of the templatedocx file to uses as bases for replacement(s) • replacement* – String – string of replacements and tag pairs to be used in the replacements o ##[Tag Name1]|[Replacement Value1]##[Tag Name2]|Replacement Value2] • newPathName* – String – Full name of the path for newdocx file to be stored after replacements have been completed

Output

• String – “Ok”, File saved at location of ‘newPathName’

Replace Picture

Method Name:

• “WordManager_ReplacePicture”

Purpose:

• Inserting a Picture into a Document

Parameters:

• docName* – String – Full name of the docx file • replacementArray* – Array – Array of Arrays, The inner arrays are pairs of a Content Control Tag Name and an Image Path o e.g. { {“imageTag1”, “C:\Logo.png”}, {“imageTag2”,”C:\Icon.png”} }

Output:

• String – “Ok”, additionally file is updated with image o N.B. Inserts into an existing document

Replace with New Lines

Method Name:

• “WordManager_ReplaceWithNewLines”

Purpose:

• Replacing tags with a value that requires carriage returns

Parameters:

• docName* – String – Full name of the docx file • replacement* – String – String of replacements and tag pairs, where newlines in the replacements are denoted by a ‘#’ o [tag1]|[line1#line2]|[tag2]|[line3#line4#line5]

Output:

• String – “Ok”, additional file is updated with new line replacements o N.B. Inserts into an existing document


Distance Eval

Added ability to perform route distance calculations

Method Name:

• “Distance_Route_Eval”

Purpose:

• Calculate Distance following roads instead of as the crow flies. (uses the mapquestapi)

Parameters:

• postcode1* – String – starting postcode • postcode2* – String – destination postcode • units – String – m or k for Miles or Kilometers. Defaults to miles.

Output:

• Number – distance in units

History Manager

Added ability to read and write a history record to a supporting database.

Method Name:

• “Random_Number”

Purpose:

• To generate a series of random numbers between two values.

Parameters:

• lower* – Number – Lowest possible number • upper* – Number – Highest possible number • array – Number – Number of random numbers to generate. Defaults to 1 • decimals – Number – Number of decimal points to be included. Defaults to 0

Output:

• Array – Array of random numbers

Random Number

Method Name:

• “Random_Number”

Purpose:

• To generate a series of random numbers between two values.

Parameters:

• lower* – Number – Lowest possible number • upper* – Number – Highest possible number • array – Number – Number of random numbers to generate. Defaults to 1 • decimals – Number – Number of decimal points to be included. Defaults to 0

Output:

• Array – Array of random numbers

Ability to specify non-repeating still to be added.

Random Password

Method Name:

• “Random_Password”

Purpose:

• To generate a string of random number and letters.

Parameters:

• length – Number – Number of characters. Defaults to 8

Output:

• String – String of random numbers and letters

Spreadsheet Manager

OpenSpreadsheet in Template

Method Name:

• “Open_Spreadsheet_In_Template”

Purpose:

• Copy values from a CSV into a XLS/XLSX Template, retaining any styling in template.

Parameters:

• input* – String – Path of the input CSV • template* – String – Path of the template XLS/XLSX • output* – String – Path of the output XLS/XLSX

Output:

• String – “Ok”

Combine Spreadsheets

Method Name:

• “Combine_Spreadsheets”

Purpose:

• Combines a series of XLS/XLSX files into a single file.

Parameters:

• files* – Array– Array of paths to the additional CSV/XLX/XLSX files • original* – String – Path of the original CSV/XLS/XLSX (this filename will be retained) • output* – String – Path of the output XLS/XLSX

Output:

• String – “Ok”

Postcode DB

Added ability to choose between Matisse or MySQL database.

DocxToPDF

Method Name:

• “Convert_Docx_To_Pdf”

Purpose:

• Convert DOCX to PDF.

Parameters:

• original* – String – Path of the original DOCX • path* – String – Path of the output PDF

Output:

• String – “Ok”

To be moved to a script command in the near future

XMLReader

Method Name:

• “XML_Reader”

Purpose:

• Extract a single value from an XML file

Parameters:

• Path* – String – Path of the XML file • tagName* – String – tag to extract value from • attributeName – String – Name of attribute to extrat value from. If present will not get value for the tag itself, only the attribute.

Output:

• String – Value requested from XML file.

UnzipFile

Method Name:

• “Unzip_File”

Purpose:

• Convert DOCX to PDF.

Parameters:

• currentPath* – String – Path of zip file • newPath*– String – Path to extract the zip file to.

Output:

• String – “Ok”