API Guide > PTC Mathcad Prime Objects > Object: Worksheet
Object: Worksheet
This object represents the PTC Mathcad Prime Worksheet 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)—Defines the default time that the application waits for the engine to recalculate the document. The method affects different types of Get/SetValue APIs, excluding APIs that use a parameter for passing the time-out value.
arg (integer) is the number of seconds to wait, 0 do not wait, or –1 to wait indefinitely.
The default time-out value is 60 seconds.
CreateMatrix(rowsArg, colsArg)—Creates a matrix of given size filled by NaNs.
rowsArg (integer) is the number of rows.
colsArg (integer) 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)—Extracts input matrix results as InputMatrixResult object for the specified input alias.
aliasArg (string) is the alias of the input.
Returns:
The InputMatrixResult or Null if an error occurs while retrieving the matrix input results.
InputGetRealValue(aliasArg)—Extracts input results as InputResult object for the specified input alias.
aliasArg (string) is the alias of the input.
Returns:
The InputResult or Null if an error occurs while retrieving the input results.
InputGetSExprValue—Gets the SExpression value of input for the specified input alias.
aliasArg (string) 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)—Gets the value result of input as ValueResult object for the specified input alias.
aliasArg (string) 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)—Extracts output matrix results as OutputMatrixResult object for the specified output alias.
aliasArg (string) is the alias of the output.
All values in the matrix must be of the same dimension. For example, one matrix can contain values in meters and feet – different units of length, but cannot contain meters and kilograms – units of length and weight.
If the values do not have units of same dimension, such as, inches and seconds, the function returns an error.
You can use values without units. In this case, all values in the matrix must be unitless.
Strings are not supported.
Returns:
The OutputMatrixResult or Null if an error occurs while retrieving the matrix output results.
OutputGetMatrixValueAs(aliasArg, unitsArg)—Extracts output matrix results as OutputMatrixResult object for the specified output alias.
aliasArg (string) is the alias of the output.
unitsArg (string) is the units of the output.
All values in the matrix must be of the same dimension. For example, one matrix can contain values in meters and feet – different units of length, but cannot contain meters and kilograms – units of length and weight.
If the values do not have units of same dimension, such as, inches and seconds, the function returns an error.
You can use values without units. In this case, all values in the matrix must be unitless.
Strings are not supported.
Returns:
The OutputMatrixResult or Null if an error occurs while retrieving the matrix output results.
OutputGetRealValue(aliasArg)—Extracts output results as OutputResult object for the specified output alias.
aliasArg (string) is the alias of the output.
Returns:
The real value specified by the alias.
OutputGetRealValueAs(aliasArg, unitsArg)—Extracts output results as OutputResult object for the specified output alias in the specified units.
aliasArg (string) is the alias of the output.
unitsArg (string) is the units of the output.
Returns:
The real value in the specified units.
OutputGetValue(aliasArg)—Gets the value result of the output as ValueResult object.
aliasArg (string) 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)—Save the worksheet with a new name.
newDocumentPathArg (string) 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, valueArg, unitsArg)—Sets the matrix value and units to input with specified alias.
aliasArg (string) is the alias of the input.
valueArg (matrix) is the matrix value to be set to input.
unitsArg (string) 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, valueArg, unitsArg)—Sets the double value and units to input with specified alias.
aliasArg (string) is the alias of the input.
valueArg (double) is the double value to be set to input.
unitsArg (string) 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, sexpressionArg)—Sets the SExpression value to input with specified alias.
aliasArg (string) is the alias of the input.
sexpressionArg (string) 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, valueArg)—Sets the string value to input with specified alias.
aliasArg (string) is the alias of the input.
valueArg (string) 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)—Sets the PTC Mathcad Prime Window Title for the worksheet.
titleArg (string) 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.
Was this helpful?