Here is the function I'm currently using that simply takes an HTML file and saves it as a .doc. I just need to either create the title page before adding the HTML or use the HTML to create the doc and go to the beginning of the document and add a new page with the text I want to include.
void createWordDoc() {
OleAutoObj objWord;
OleAutoObj objDocs, objDoc;
OleAutoArgs autoArgs = create;
OleAutoArgs macroArgs = create;
string nameOfMacro = "printHTMLtoDOC";
string sHTMLFileName;
string s_fileName;
sHTMLFileName = CMG_USER_DESKTOP "\\DLDUpdates.html";
s_fileName = sFileNameDOC;
string sErrorMess = copyFile(CMG_VBA_FORMATTER_DIR sFormatterFileName, s_fileName);
if(!null sErrorMess) infoBox "Couldn't copy formatter file"
if(!canOpenFile(s_fileName, false)) {
infoBox "CSV formatter not configured or cannot be accessed. \n Data HTML is in a file on your desktop."
return;
}
objWord = oleCreateAutoObject("Word.Application");
if(null objWord)
errorBox("Unable to open word application");
olePut(objWord, "Visible", true);
oleGet(objWord, "Documents", objDocs);
put(autoArgs, sHTMLFileName);
oleMethod(objDocs, "Open", autoArgs, objDoc);
put(macroArgs, nameOfMacro);
put(macroArgs, sHTMLFileName);
put(macroArgs, sFileNameDOC);
oleMethod(objWord, "Run", macroArgs);
infoBox("Document saved.");
}
#Sustainability#Support#DOORS#SupportMigration#EngineeringRequirementsManagement