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

Online Help

All Products    Maple    MapleSim


DocumentTools

  

ContentToString

  

convert XML content to a worksheet string

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

ContentToString(content)

ContentToString(content, v)

Parameters

content

-

{specfunc(_XML_Worksheet)} ; XML tree structure containing a valid XML representation of a complete worksheet

v

-

(optional) identical(validate)=truefalse; Whether to validate the XML against a schema. The default is false.

Description

• 

The ContentToString command converts an XML tree structure (content) to the string form of a worksheet file.

• 

The content can be generated using commands from the Component Constructors and Layout Constructors packages. Such content can be inserted directly into the current window using the InsertContent command. The ContentToString command converts the content to a worksheet string.

• 

The resulting worksheet string can be saved directly as a .mw format file, launched in a new window using the Worksheet:-Display command, or used with the CreateTask command.

Examples

withDocumentTools:withDocumentTools:-Layout

Cell,Column,DocumentBlock,Equation,Font,Group,Image,InlinePlot,Input,Output,Row,Section,Table,Textfield,Title,Worksheet

(1)

Using commands from the Layout Constructors package an XML tree representation of a full worksheet can be generated.

xmlWorksheetGroupInputTableRowSome text.

xml_XML_Worksheet_XML_Groupview=presentation,hide-input=false,hide-output=false,inline-output=false,drawlabel=true,_XML_Input_XML_Tableinterior=all,id=_Table_,hiddenborderdisplay=worksheet,showinput=true,alignment=left,exterior=all,width=100%,showlabel=false,captionalignment=0,title=,drawtitle=false,order=row,drawcaption=false,randomized=false,captionposition=1,showgroup=false,plotalignlists=,pagebreak=none,postexecute=advance,_XML_Table-Columnseparator=true,weight=100,_XML_Table-Rowalign=top,separator=true,_XML_Table-Cellcolumnspan=1,backgroundstyle=0,rowspan=1,fillcolor=[255,255,255],visible=true,_XML_Text-fieldalignment=centred,style=Text,layout=Normal,Some text.

(2)

The content xml could be inserted directly into the current window using the InsertContent command. It is also possible to save the generated content into a worksheet file or to open it in a new window, as the following examples illustrate.

The ContentToString command converts the content xml into the string form of a mw format file.

strContentToStringxml

str<?xml version="1.0" encoding="UTF-8"?><Worksheet><Group view='presentation' hide-input='false' hide-output='false' inline-output='false' drawlabel='true'><Input><Table interior='all' id='_Table_' hiddenborderdisplay='worksheet' showinput='true' alignment='left' exterior='all' width='100%' showlabel='false' captionalignment='0' title='' drawtitle='false' order='row' drawcaption='false' randomized='false' captionposition='1' showgroup='false' plotalignlists='' pagebreak='none' postexecute='advance'><Table-Column separator='true' weight='100'/><Table-Row align='top' separator='true'><Table-Cell columnspan='1' backgroundstyle='0' rowspan='1' fillcolor='[255,255,255]' visible='true'><Text-field alignment='centred' style='Text' layout='Normal'>Some text.</Text-field></Table-Cell></Table-Row></Table></Input></Group></Worksheet>

(3)

The string representation of the worksheet can be opened in a new window using the Display command from the Worksheet package. Note that this package is referenced below using the global name :-Worksheet, since that name is also an export of the loaded DocumentTools:-Layout package.

:-Worksheet:-Displaystr

The worksheet string can also be saved directly as a new worksheet file. In the following example a temporary filename is generated.

fnameFileTools:-TemporaryFilenamecatFileTools:-TemporaryDirectory&comma;/&comma;.mw&colon;FileTools:-Text:-WriteFilefname&comma;str&colon;

That new worksheet file can also be opened directly.

:-Worksheet:-DisplayFilefname

Compatibility

• 

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

• 

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

See Also

Component Constructors

CreateTask

DocumentTools

Embedded Components

FileTools

InsertContent

Layout Constructors

Worksheet