 To Maple Text - Maple Help

Worksheet

 WorksheetToMapleText
 convert a worksheet into a 1-D Maple text string Calling Sequence WorksheetToMapleText( worksheet ) WorksheetToMapleText( worksheet, includeoutput ) Parameters

 worksheet - string or XML tree data structure Description

 • The command WorksheetToMapleText converts a Maple worksheet in .mw format into a string containing the equivalent commands as 1-D Maple text.  It is similar in functionality to the Maple Text format in the File > Export As menu.
 • If the first argument worksheet is a string then it is treated as a filename. Otherwise, a worksheet as an XML tree data structure is expected. Notes

 • This command only fully supports worksheets.  It may not work properly for Maple documents with tables or components. Examples

 > $\mathrm{with}\left(\mathrm{Worksheet}\right):$
 > $\mathrm{slash}≔\mathrm{kernelopts}\left(\mathrm{dirsep}\right)$
 ${\mathrm{slash}}{≔}{"/"}$ (1)
 > $\mathrm{filename}≔\mathrm{cat}\left(\mathrm{kernelopts}\left(\mathrm{datadir}\right),\mathrm{slash},"example",\mathrm{slash},"MatrixExample.mw"\right)$
 ${\mathrm{filename}}{≔}{"/maple/cbat/active/234548/data/example/MatrixExample.mw"}$ (2)
 > $\mathrm{printf}\left(\mathrm{WorksheetToMapleText}\left(\mathrm{filename}\right)\right)$
 m := Matrix(2,2,[[-4, sqrt(17)], [ln(45), 61/4]]); m[1,1]*m[2,2]-m[1,2]*m[2,1];
 > $\mathrm{printf}\left(\mathrm{WorksheetToMapleText}\left(\mathrm{filename},'\mathrm{includeoutput}'\right)\right)$
 m := Matrix(2,2,[[-4, sqrt(17)], [ln(45), 61/4]]); # out_1> Matrix(2,2,[[-4, sqrt(17)], [ln(45), 61/4]]) m[1,1]*m[2,2]-m[1,2]*m[2,1]; # out_2> -61-sqrt(17)*ln(45)
 > $\mathrm{with}\left(\mathrm{DocumentTools}\right):$
 > $\mathrm{with}\left(\mathrm{DocumentTools}:-\mathrm{Layout}\right):$
 > $E≔\frac{\sqrt{x}}{\mathrm{Pi}}$
 ${E}{≔}\frac{\sqrt{{x}}}{{\mathrm{\pi }}}$ (3)
 > $W≔\mathrm{Worksheet}\left(\mathrm{Group}\left(\mathrm{Input}\left(\mathrm{Textfield}\left(\mathrm{Equation}\left(E,\mathrm{executable}=\mathrm{true},\mathrm{style}=\mathrm{TwoDimInput}\right),\mathrm{style}=\mathrm{MapleInput}\right)\right)\right)\right):$
 > $\mathrm{printf}\left(\mathrm{WorksheetToMapleText}\left(W\right)\right)$
 sqrt(x)/Pi; Compatibility

 • The Worksheet:-WorksheetToMapleText command was introduced in Maple 2017.