DECS Word Add-Ins 1.2.0.1
Creates custom buttons in Word to automate DECS tasks.
Loading...
Searching...
No Matches
DecsWordAddIns.Utilities Class Reference

Useful methods. More...

Static Package Functions

static string AllText (Document doc)
 Pull together ALL the Document's text.
 
static string CleanText (string text)
 Convert/remove stuff so later Regexs don't have to allow for them.
 
static string CleanNameForSql (string condition_name)
 Turn a free-text description of a condition (like "Interstitial lung disease") into a string suitable for use as a SQL column name ("Interstitial_Lung_Disease").
 
static string GetUserName ()
 Uses system utility to get the name of the user.
 
static string FormOutputFilename (string filename, string filetype=".sql", bool short_version=false)
 Turn the statement of work filename into a .sql filename.
 
static bool IsJustListOfCodes (string name, MatchCollection matches)
 Detects when a name (which should be like "Hypertension") is actually just a list of codes ("J42", "J43", "J44").
 
static StreamWriter string openedFilename OpenOutput (string input_filename, string filetype=".sql")
 
static string PrependWithHypens (string conditionName, string separator="")
 If condition name isn't empty, return it prepended with "---".
 
static Dictionary< string, string > ReadUserNamesFile ()
 From a text file, build a dictionary of login names, nice names. Example: gwashington, George Washington.
 
static string ReplaceUntilNoMore (string text, string pattern, string replacement, bool isRegex=false)
 Run a string replacement again & again until it stops matching. Can be either straight string .Replace or Regex.
 
static string SalutationFromName (string name)
 Turn a name like "Prof. Able Baker Charlie, MD" into "Prof. Charlie".
 
static List< string > SelectedText (Document doc)
 Returns the user-selected portion of the document.
 

Static Package Attributes

static StreamWriter writer
 Open the output StreamWriter object, understanding that we might have to substitute a shorter version of the output filename if the default filename is too long.
 

Static Private Member Functions

static List< string > SplitAtBlankLines (string text)
 Splits text into List<string>, split at blank lines.
 

Detailed Description

Useful methods.

Member Function Documentation

◆ AllText()

static string DecsWordAddIns.Utilities.AllText ( Document doc)
staticpackage

Pull together ALL the Document's text.

Parameters
docWord Document object
Returns
string

◆ CleanNameForSql()

static string DecsWordAddIns.Utilities.CleanNameForSql ( string condition_name)
staticpackage

Turn a free-text description of a condition (like "Interstitial lung disease") into a string suitable for use as a SQL column name ("Interstitial_Lung_Disease").

Parameters
condition_namestring
Returns
string

◆ CleanText()

static string DecsWordAddIns.Utilities.CleanText ( string text)
staticpackage

Convert/remove stuff so later Regexs don't have to allow for them.

Parameters
textinput text
Returns
string

◆ FormOutputFilename()

static string DecsWordAddIns.Utilities.FormOutputFilename ( string filename,
string filetype = ".sql",
bool short_version = false )
staticpackage

Turn the statement of work filename into a .sql filename.

Parameters
filenameSoW filename
filetypetype of file to create (default = ".sql")
short_versionbool: Just filename.type? (default = false)
Returns

◆ GetUserName()

static string DecsWordAddIns.Utilities.GetUserName ( )
staticpackage

Uses system utility to get the name of the user.

Returns
string

◆ IsJustListOfCodes()

static bool DecsWordAddIns.Utilities.IsJustListOfCodes ( string name,
MatchCollection matches )
staticpackage

Detects when a name (which should be like "Hypertension") is actually just a list of codes ("J42", "J43", "J44").

Parameters
namestring to parse
matchesMatchColllection object
Returns
bool

◆ PrependWithHypens()

static string DecsWordAddIns.Utilities.PrependWithHypens ( string conditionName,
string separator = "" )
staticpackage

If condition name isn't empty, return it prepended with "---".

Parameters
conditionNamestring to process
separatorstring between previous text & hyphens (default = "")
Returns
string

◆ ReadUserNamesFile()

static Dictionary< string, string > DecsWordAddIns.Utilities.ReadUserNamesFile ( )
staticpackage

From a text file, build a dictionary of login names, nice names. Example: gwashington, George Washington.

Returns
Dictionary<string, string>

◆ ReplaceUntilNoMore()

static string DecsWordAddIns.Utilities.ReplaceUntilNoMore ( string text,
string pattern,
string replacement,
bool isRegex = false )
staticpackage

Run a string replacement again & again until it stops matching. Can be either straight string .Replace or Regex.

Parameters
textstring to process
patternstring: Regex pattern
replacementstring: what to replace matches with
isRegexbool: is this a Regex? (default = false)
Returns
string

◆ SalutationFromName()

static string DecsWordAddIns.Utilities.SalutationFromName ( string name)
staticpackage

Turn a name like "Prof. Able Baker Charlie, MD" into "Prof. Charlie".

Parameters
namestring to parse
Returns
string

◆ SelectedText()

static List< string > DecsWordAddIns.Utilities.SelectedText ( Document doc)
staticpackage

Returns the user-selected portion of the document.

Parameters
docWord Document object
Returns
List<string>

◆ SplitAtBlankLines()

static List< string > DecsWordAddIns.Utilities.SplitAtBlankLines ( string text)
staticprivate

Splits text into List<string>, split at blank lines.

Parameters
textstring to parse
Returns
List<string>

Member Data Documentation

◆ writer

StreamWriter DecsWordAddIns.Utilities.writer
staticpackage

Open the output StreamWriter object, understanding that we might have to substitute a shorter version of the output filename if the default filename is too long.

Parameters
input_filenameSoW filename
filetypetype of file to create (default = ".sql")
Returns
Tuple(StreamWriter, string)

The documentation for this class was generated from the following file: