Create a word document from Text Entry fields

Mar 09, 2023


I'm looking at creating an activity where learners will be building/writing up a CV through a number of slides in an activity.

Does anyone know how you would code it so that heading 1 in the document is collected from a text entry field? For example - the heading I want to use in the document is a text entry variable called first_name 

At the moment my code looks like this for having the document header 

// ENTER YOUR HTML/CONTENT HERE - use strings for tags and player.GetVar for the Storyline variables
var html = HtmlHead +
"<div style='font-size:20px;font-weight:bold; <H1>"+first_name+"</H1>";

but when the word document opens - it just gives me an empty document

I also have this code to write up the body of the CV document: 

contents+="<div style='font-size:16px;font-weight:bold;
+ player.GetVar("ContactDetails")
+ player.GetVar("PersonalStatement") 
+ player.GetVar("Education") 

however, I'm not seeing any of the other headers or the other variables Personal statement or Education in the document

And is it possible that the document they download also uses a text entry variable or do I have to use a generic name that will be the same for everyone that downloads the document?

Thank you

Be the first to reply