Integrating with Other Products > API Guide > PTC Mathcad Prime Objects > Object: Worksheet
  
Object: Worksheet
This object represents the PTC Mathcad PrimeWorksheet COM interface Ptc.MathcadPrime.Automation.IMathcadPrimeWorksheet3.
Methods
Activate()—Sets the worksheet tab to be active (activates the worksheet tab) in the PTC Mathcad Prime Open Worksheets Bar.
Close(SaveOption)—Closes the worksheet if it is open in PTC Mathcad Prime.
SaveOption
SpSaveChanges—Force to save changes, without prompting the user, before the worksheet is closed.
spPromptToSaveChanges—Prompt the user to save changes before the worksheet is closed.
spDiscardChanges—Discard all changes and close the worksheet.
The special behavior for a new and non-modified worksheet:
The worksheet is closed without prompting the user, even if saveOptionArg is set to spPromptToSaveChanges.
The worksheet is closed without prompting the user, even if saveOptionArg is set to spSaveChanges.
DefaultCalculationTimeout(arg as integer)—Gets/Sets the DefaultCalculationTimeOut value of the worksheet. It defines the default time that the application waits for the engine to recalculate the whole document, and affects different types of Get/SetValue APIs except APIs whose time out is passed as a parameter.
arg is defined in seconds
0 means do not wait
–1 means wait no matter how long
The default time-out is 60 seconds
CreateMatrix(rowsArg as integer, colsArg as integer)—Creates a matrix of given size filled by NaNs.
rowsArg is the number of rows.
colsArg is the number of columns.
Returns:
The created matrix or Null if an error occurs.
CreateValuesSetter()—Creates a collection of double or matrix scaled values to set to the input item by alias.
Returns:
The ValuesSetter created or Null if an error occurs.
GetWorkSheetReadOnlyOptionValue(WorksheetReadonlyOptionNames)—Gets the worksheet read-only option value.
WorksheetReadonlyOptionNames is the worksheet option name.
Returns:
The worksheet option value or Null if option does not exist or its value is invalid.
InputGetMatrixValue(aliasArg as string)—Extracts input matrix results as InputMatrixResult object for the specified input alias.
aliasArg is the alias of the input.
Returns:
The InputMatrixResult or Null if an error occurs while retrieving the matrix input results.
InputGetRealValue(aliasArg as string)—Extracts input results as InputResult object for the specified input alias.
aliasArg is the alias of the input.
Returns:
The InputResult or Null if an error occurs while retrieving the input results.
InputGetSExprValue(aliasArg as string)—Gets the SExpression value of input for the specified input alias.
aliasArg is the alias of the input.
Returns:
The SExpression value as a string, or Null if an error occurs while retrieving the value.
InputGetValue(aliasArg as string)—Gets the value result of input as ValueResult object for the specified input alias.
aliasArg is the alias of the input.
Returns:
The value result of input as ValueResult, or Null if an error occurs while retrieving the object instance.
IsOpen()—Checks if the worksheet is open in PTC Mathcad Prime.
Returns:
True if the worksheet is open.
FALSE if the worksheet is not open.
OutputGetMatrixValue(aliasArg as string)—Extracts output matrix results as OutputMatrixResult object for the specified output alias.
aliasArg is the alias of the output.
Returns:
The OutputMatrixResult or Null if an error occurs while retrieving the matrix output results.
OutputGetMatrixValueAs(aliasArg as string, unitsArg as string)—Extracts output matrix results as OutputMatrixResult object for the specified output alias.
aliasArg is the alias of the output.
unitsArg is the units of the output.
Returns:
The OutputMatrixResult or Null if an error occurs while retrieving the matrix output results.
OutputGetRealValue(aliasArg as string)—Extracts output results as OutputResult object for the specified output alias.
aliasArg is the alias of the output.
Returns:
The real value specified by the alias.
OutputGetRealValueAs(aliasArg as string, unitsArg as string)—Extracts output results as OutputResult object for the specified output alias in the specified units.
aliasArg is the alias of the output.
unitsArg is the units of the output.
Returns:
The real value in the specified units.
OutputGetValue(aliasArg as string)—Gets the value result of the output as ValueResult object.
aliasArg is the alias of the output.
Returns:
The value result of output as ValueResult, or Null if an error occurs while retrieving the object instance.
PauseCalculation()—Pauses the calculation.
ResumeCalculation()—Resumes the calculation.
SaveAs(newDocumentPathArg as string)—Save the worksheet with a new name.
newDocumentPathArg is the save destination.
The worksheet can be saved as a standard worksheet using the file extension .mcdx or as a template using the file extension .mctx.
SetMatrixValue(aliasArg as string, valueArg as Matrix, unitsArg as string)—Sets the matrix value and units to input with specified alias.
aliasArg is the alias of the input.
valueArg is the matrix value to be set to input.
unitsArg is the units of be set to input.
Returns:
–1
An unknown error occurred when performing this function. It can also occur if the worksheet is not open.
0
No error. The function was successful.
1
An alias of input/output item was not found.
2
Input/Output has been disabled.
3
Units incompatible.
4
Input is invalid.
5
Calculation error.
6
Result type incompatible.
7
Matrix result is invalid.
8
Calculation time out.
9
Calculation disabled.
SetRealValue(aliasArg as string, valueArg as double, unitsArg as string)—Sets the double value and units to input with specified alias.
aliasArg is the alias of the input.
valueArg is the double value to be set to input.
unitsArg is the units of be set to input.
Returns:
–1
An unknown error occurred when performing this function. It can also occur if the worksheet is not open.
0
No error. The function was successful.
1
An alias of input/output item was not found.
2
Input/Output has been disabled.
3
Units incompatible.
4
Input is invalid.
5
Calculation error.
6
Result type incompatible.
7
Matrix result is invalid.
8
Calculation time out.
9
Calculation disabled.
SetSExprValue(aliasArg as string, sexpressionArg as string)—Sets the SExpression value to input with specified alias.
aliasArg is the alias of the input.
sexpressionArg is the SExpression value to be set to input.
Returns:
–1
An unknown error occurred when performing this function. It can also occur if the worksheet is not open.
0
No error. The function was successful.
1
An alias of input/output item was not found.
2
Input/Output has been disabled.
3
Units incompatible.
4
Input is invalid.
5
Calculation error.
6
Result type incompatible.
7
Matrix result is invalid.
8
Calculation time out.
9
Calculation disabled.
SetStringValue(aliasArg as string, valueArg as string)—Sets the string value to input with specified alias.
aliasArg is the alias of the input.
valueArg is the string value to be set to input.
Returns:
–1
An unknown error occurred when performing this function. It can also occur if the worksheet is not open.
0
No error. The function was successful.
1
An alias of input/output item was not found.
2
Input/Output has been disabled.
3
Units incompatible.
4
Input is invalid.
5
Calculation error.
6
Result type incompatible.
7
Matrix result is invalid.
8
Calculation time out.
9
Calculation disabled.
SetTitle(titleArg as string)—Sets the PTC Mathcad Prime Window Title for the worksheet.
titleArg is the title to be set for the worksheet.
Synchronize()—Synchronizes, or recalculates, the worksheet.
Properties
FullName—Gets the full path and name of the worksheet.
Returns:
The full path and name of the worksheet, or an empty string if the worksheet is new.
Inputs—Gets the worksheet inputs.
Returns:
The worksheet inputs, or a Null if an error occurs while retrieving the inputs.
Modified—Gets/Sets the modified attribute value of the worksheet.
Returns:
True if the worksheet is modified.
FALSE if the worksheet is not modified.
Name—Gets the name of the worksheet.
Outputs—Gets the worksheet outputs.
WorksheetClosingPrompt=TextArg as string. Sets the Worksheet Closing Prompt Text.
WorksheetDisplayedFilePath=filePathArg as string. Sets the worksheet CustomizedFilePath. The customized file path to the file storing the worksheet. Passing a Null or an empty string clears the previously set display path.
WorksheetTabIcon=iconFullPathArg as string. Sets the Worksheet Tab Icon iconFullPathArg—the full path to the icon.
WorksheetTabName=tabNameArg as string. Sets the Worksheet Tab Name tabNameArg—the worksheet tab name.
WorksheetWorkingDirectory=workingDirArg as string. Sets the worksheet CWD.