This forum article will show an example of how we can create a Word document in LiquidUI. We will take some text from a notification in IW22 and create a document with it. In order for this to work, you must load wsoffice.dll in the ESESSIONS.SJS file.
LiquidUI Code:
//SAPLIQS0.E7200.sjs
// Pushbutton that will trigger our function
pushbutton([TOOLBAR],"Create Word Document", "?", {"process":createDoc});
// This function will create a Word document
function createDoc(){
onscreen 'SAPLIQS0.7200'
set("V[notification_num]", "&F[Notification]");
copytext({"fromscreen":"X[TEXT]", "totext":"z_text"});
// Create MS Object for Word
var wordObj = new ActiveXObject('word.application');
// Do not show the Microsoft Word window
wordObj.Visible = false;
docx = wordObj.Documents.Add();
objSelection = wordObj.Selection
// Set the Font
objSelection.Font.Name ="Arial";
// Set the Font Size
objSelection.Font.Size = "18";
objSelection.TypeText(z_text);
objSelection.TypeParagraph()
// Create the file as Notification_NotifNumber_User.docx
docx.SaveAs("C:\\GuiXT\\Tutorials\\Forum\\Notification_"+notification_num+"_"+_user+".docx");
wordObj.Quit();
enter("?");
}
// ESESSION.SJS
load("wsoffice");
See attachments..