Skip to content

LoadText

Updates the document content. The previously created content will be lost.

1
myWriter.LoadText(text: string, type?: ( "html" | "rtf" | "txt" )):void

Parameters

string text
    The content.

( "html" | "rtf" | "txt" ) type optional
    The format of the content. When omitted, the text is inserted as plain text.

Remarks

With no type, text is inserted as plain document text. Only html, txt, and rtf are accepted when a type is supplied, case-insensitively; docx, pdf, and xml are load formats for LoadFromBase64, not text load options.

Examples

Create a Word document from HTML

1
2
3
4
5
var writer = new Writer();
writer.LoadText('<h1>Meeting Notes</h1><p>' + $Xml.Evaluate('Notes') + '</p>', 'html');

var docx = $Files.AddBase64(writer.SaveToBase64('.docx'), 'MeetingNotes.docx',
    'application/vnd.openxmlformats-officedocument.wordprocessingml.document');

See Also