private static void PerformTemplateExport(ConnectionManager connection) { var wordFolderManager = new WordTemplateFolderManager(options.TemplateFolder); var executor = new TemplateExecutor(wordFolderManager); //now we need to ask user parameter value Dictionary <string, Object> parameters = new Dictionary <string, object>(); foreach (var parameterName in wordFolderManager.TemplateDefinition.Parameters.ParameterNames) { Console.Write($"Parameter {parameterName}:"); parameters[parameterName] = Console.ReadLine(); } var tempFileName = Path.GetTempPath() + Guid.NewGuid().ToString() + ".docx"; executor.GenerateWordFile(tempFileName, connection, options.TeamProject, parameters); System.Diagnostics.Process.Start(tempFileName); }
private void InnerExecuteExport() { var fileName = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()) + ".docx"; if (SelectedTemplate.IsScriptTemplate) { var executor = new TemplateExecutor(SelectedTemplate.WordTemplateFolderManager); //now we need to ask user parameter value Dictionary <string, Object> parameters = new Dictionary <string, object>(); foreach (var parameter in Parameters) { parameters[parameter.Name] = parameter.Value; } List <String> iterations = Iterations.Where(i => i.Selected).Select(i => i.Path).ToList(); parameters["iterations"] = iterations; executor.GenerateWordFile(fileName, ConnectionManager.Instance, SelectedTeamProject.Name, parameters); } else { var selected = SelectedQuery?.Results?.Where(q => q.Selected).ToList(); if (selected == null || selected.Count == 0) { return; } var template = SelectedTemplate.WordTemplateFolderManager; using (WordManipulator manipulator = new WordManipulator(fileName, true)) { foreach (var workItemResult in selected) { var workItem = workItemResult.WorkItem; manipulator.InsertWorkItem(workItem, template.GetTemplateFor(workItem.Type.Name), true); } } } System.Diagnostics.Process.Start(fileName); }