static internal void ImportWordDoc(string strRepositoryFullPath, string strPathToFile, string strFileName, string strXSLTFullPath) { UCRepoClassLibrary.EAImporter theEAImporter; UCRepoClassLibrary.EAImporter.LogMsgCallbackType myLogMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(Program.FormLogMsg); UCRepoClassLibrary.EAImporter.LogMsgCallbackType myErrorMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(Program.FormLogError); theEAImporter = new UCRepoClassLibrary.EAImporter(myLogMsgCallback, myErrorMsgCallback); if (theEAImporter.Open(strRepositoryFullPath) != 0) { Console.WriteLine("."); Console.WriteLine("Import failed."); return; } int iErrorCount = theEAImporter.ImportWordDoc(strPathToFile, strFileName, strXSLTFullPath); Console.WriteLine("."); if (iErrorCount == 0) { Console.WriteLine("Import completed successfully"); } else { Console.WriteLine("Import ABORTED. Errors found. Error count=" + iErrorCount.ToString()); } theEAImporter.Close(); }
private void ImportWordDoc_Click(object sender, EventArgs e) { UCRepoClassLibrary.EAImporter theEAImporter; string strPathtoWordDoc; string strFileName; richTextBox1.Clear(); richTextBoxErrors.Clear(); UCRepoClassLibrary.EAImporter.LogMsgCallbackType myLogMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(this.FormLogMsg); UCRepoClassLibrary.EAImporter.LogMsgCallbackType myErrorMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(this.FormLogError); theEAImporter = new UCRepoClassLibrary.EAImporter(myLogMsgCallback, myErrorMsgCallback); string strRepositoryFullPath = textBoxEAFile.Text; if (theEAImporter.Open(strRepositoryFullPath) != 0) { // failed return; } strPathtoWordDoc = _strUserResourcesFolder + @"\FilledInTemplates"; strFileName = strPathtoWordDoc + "\\" + listBox1.Text; string strXSLTFullPath = _strBaseRsourcesFolder + @"\Translators\EUToIntermediate.xslt"; int iErrorCount = theEAImporter.ImportWordDoc(strPathtoWordDoc, listBox1.Text, strXSLTFullPath); if (iErrorCount == 0) { UCRepoClassLibrary.EAImporter.LogMsg(UCRepoClassLibrary.EAImporter.LogMsgType.Info, "Import completed successfully"); } else { UCRepoClassLibrary.EAImporter.LogMsg(UCRepoClassLibrary.EAImporter.LogMsgType.Info, "Import ABORTED. Errors found. Error count=" + iErrorCount.ToString()); } theEAImporter.Close(); Form1_Load(sender, e); // refresh screen }