InsertContent - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


DocumentTools

  

InsertContent

  

insert content into a worksheet

 

Calling Sequence

Parameters

Returns

Options

Description

Examples

Compatibility

Calling Sequence

InsertContent(content)

InsertContent(content, opts)

Parameters

content

-

{string, XML tree} ; string or XML tree structure containing a valid XML description of a worksheet or task template

opts

-

(optional); one or more keyword options as described below

Returns

• 

A mapping of embedded component identities in the content, which may have been substituted upon insertion in order to avoid conflicting with identities of embedded components already existing in the currently open worksheet.

• 

The mapping will be in the form of either a two-column Array of strings or a table. The form is specified by the output option.

• 

In the case of a two-column Array the first column's entries are the identities as strings of the components in the input, and the second column's entries are the corresponding identities as strings of the inserted components.

• 

In the case of a returned table the indices are the identities as strings of the input components and the corresponding values are the identities as strings of the inserted components.

Options

• 

minimal : truefalse

  

Specifies whether to insert minimal content (true) or default content (false). The default is true.

• 

output : identical(Array,table)

  

Specifies whether to return the mapping of embedded component identity names as a two column Array or as a table. The default is Array. See the Returns section.

• 

state : string

  

Associates a "state" string with the inserted content.  The value can be any string, including the name of the "State" variable as set by DocumentTools:-Components:-State, or a serialized encoding of a data structure as given by sprintf("%m",data).  Use DocumentTools:-GetProperty("",'contentstate') before calling InsertContent to see if you are about to replace previously inserted content -- if you want to initialize the new content based on some of the settings of the old content.   

• 

replaceid : string

  

Instead of inserting the worksheet content at the next available cursor location, replace the previously inserted worksheet content that contains the component with the given identifier.  The identifier can be that of any component within the task grouping, such as, "Button0".  The entire task grouping will be replaced with the new worksheet content, not just the named component.

• 

validate : truefalse

  

Specifies whether to validate the XML against a schema. The default is false.

Description

• 

The InsertContent function inserts input worksheet content into the currently open Worksheet or Document at the next available cursor location.

• 

The input worksheet content is given as an XML string or tree structure.

• 

Embedded component's identities may be substituted upon insertion to avoid identity conflicts. Such substitutions are also done for any literal instances (as names or strings) of the identities of the renamed components in the action code of any embedded components in the content.

• 

The content may be generated using commands from the Component Constructors and Layout Constructors packages.

Examples

withDocumentTools:

withDocumentTools:-Layout:

InsertContentWorksheetGroupTextfieldInlinePlotplotsin

withDocumentTools:-Components:

xmlWorksheetGroupTextfieldButtonMy Caption,identity=Button0

xml_XML_Worksheet_XML_Groupview=presentation,hide-input=false,hide-output=false,inline-output=false,drawlabel=true,_XML_Text-fieldalignment=centred,style=Text,layout=Normal,_XML_EC-Buttonid=Button0,caption=My Caption,enabled=true,fillcolor=[255,255,255],fontcolor=[0,0,0],visible=true,show-border=true

(1)

firstInsertContentxml

first

(2)

The previous example inserted a component with identity "Button0", so a second insertion of that same content must involve a substitution for that string in order to avoid an identity conflict.

The table form of the returned identity mapping is a convenient mechanism for redirected references to the inserted components.

lookupInsertContentxml,output=table

lookuptableButton0=Button1

(3)

lookupButton0

Button1

(4)

SetPropertylookupButton0,caption,New Caption,refresh

Compatibility

• 

The DocumentTools[InsertContent] command was introduced in Maple 2015.

• 

For more information on Maple 2015 changes, see Updates in Maple 2015.

• 

The DocumentTools[InsertContent] command was updated in Maple 2016.

• 

The state and replaceid options were introduced in Maple 2016.

• 

For more information on Maple 2016 changes, see Updates in Maple 2016.

See Also

Component Constructors

ContentToString

DocumentTools

Embedded Components

Layout Constructors