- Home /
Plugging game results into Microsoft Word template
In my game, I record the users starting health, number of deaths, length of play, XP gain, and number of kills. I want to be able to put these data values into a word template and then email that to myself. How would I go about doing this? Here is a rough template. link text
Answer by TreyH · Sep 14, 2018 at 07:32 PM
Word documents themselves are deflate-compressed folders whose contents you can examine by renaming *.docx
to *.zip
. The document's meat itself (especially for a purely-text document like this) can be found in /word/document.xml
.
As for the process itself, it's fairly straightforward, if a little involved due to the annoyance of unzipping and re-zipping the document's components. You'll need to:
1- Copy your template
2- Unzip and access contents of your copied template
3- Modify the document's /word/document.xml file *
4- Re-zip it
* As for the modification step, the simplest way would be to set short placeholder strings for those values that are unlikely to appear elsewhere in the document. Something like __ND__
for Number of Deaths. You'd then replace all instances of __ND__
with that value, and proceed similarly for the other fields you want written.
It's debatable whether this is related to Unity at all, so do be sure to ask Unity-relevant questions to this forum.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Initialising List array for use in a custom Editor 1 Answer
Illuminating a 3D object's edges OnMouseOver (script in c#)? 1 Answer
When to use a factory? 0 Answers