-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.xaml
214 lines (214 loc) · 14.9 KB
/
Main.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<Activity mc:Ignorable="sap sap2010" x:Class="Main" this:Main.Word_template_filepath="SampleFiles/SampleTemplate.docx" this:Main.CSV_input_filepath="SampleFiles/SampleCSV.csv" this:Main.Output_folderpath="TempOutput" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:p="http://schemas.uipath.com/workflow/activities/word" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System.Private.CoreLib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data.Common" xmlns:this="clr-namespace:" xmlns:ui="http://schemas.uipath.com/workflow/activities" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<x:Members>
<x:Property Name="Word_template_filepath" Type="InArgument(x:String)">
<x:Property.Attributes>
<RequiredArgumentAttribute />
</x:Property.Attributes>
</x:Property>
<x:Property Name="CSV_input_filepath" Type="InArgument(x:String)">
<x:Property.Attributes>
<RequiredArgumentAttribute />
</x:Property.Attributes>
</x:Property>
<x:Property Name="Output_folderpath" Type="InArgument(x:String)">
<x:Property.Attributes>
<RequiredArgumentAttribute />
</x:Property.Attributes>
</x:Property>
</x:Members>
<VisualBasic.Settings>
<x:Null />
</VisualBasic.Settings>
<sap:VirtualizedContainerService.HintSize>977,2477</sap:VirtualizedContainerService.HintSize>
<sap2010:WorkflowViewState.IdRef>ActivityBuilder_1</sap2010:WorkflowViewState.IdRef>
<TextExpression.NamespacesForImplementation>
<scg:List x:TypeArguments="x:String" Capacity="30">
<x:String>System.Activities</x:String>
<x:String>System.Activities.Statements</x:String>
<x:String>System.Activities.Expressions</x:String>
<x:String>System.Activities.Validation</x:String>
<x:String>System.Activities.XamlIntegration</x:String>
<x:String>Microsoft.VisualBasic</x:String>
<x:String>Microsoft.VisualBasic.Activities</x:String>
<x:String>System</x:String>
<x:String>System.Collections</x:String>
<x:String>System.Collections.Generic</x:String>
<x:String>System.Data</x:String>
<x:String>System.Diagnostics</x:String>
<x:String>System.Drawing</x:String>
<x:String>System.IO</x:String>
<x:String>System.Linq</x:String>
<x:String>System.Net.Mail</x:String>
<x:String>System.Xml</x:String>
<x:String>System.Xml.Linq</x:String>
<x:String>UiPath.Core</x:String>
<x:String>UiPath.Core.Activities</x:String>
<x:String>System.Windows.Markup</x:String>
<x:String>System.Reflection</x:String>
<x:String>System.Collections.ObjectModel</x:String>
<x:String>System.ComponentModel</x:String>
<x:String>System.Runtime.Serialization</x:String>
<x:String>System.Xml.Serialization</x:String>
<x:String>UiPath.CSV</x:String>
<x:String>UiPath.CSV.Activities</x:String>
<x:String>UiPath.Word.Activities</x:String>
<x:String>UiPath.DataTableUtilities</x:String>
</scg:List>
</TextExpression.NamespacesForImplementation>
<TextExpression.ReferencesForImplementation>
<scg:List x:TypeArguments="AssemblyReference" Capacity="46">
<AssemblyReference>System.Activities</AssemblyReference>
<AssemblyReference>Microsoft.VisualBasic</AssemblyReference>
<AssemblyReference>mscorlib</AssemblyReference>
<AssemblyReference>System.Data</AssemblyReference>
<AssemblyReference>System</AssemblyReference>
<AssemblyReference>System.Drawing</AssemblyReference>
<AssemblyReference>System.Core</AssemblyReference>
<AssemblyReference>System.Xml</AssemblyReference>
<AssemblyReference>System.Xml.Linq</AssemblyReference>
<AssemblyReference>PresentationFramework</AssemblyReference>
<AssemblyReference>WindowsBase</AssemblyReference>
<AssemblyReference>PresentationCore</AssemblyReference>
<AssemblyReference>System.Xaml</AssemblyReference>
<AssemblyReference>UiPath.System.Activities</AssemblyReference>
<AssemblyReference>UiPath.UiAutomation.Activities</AssemblyReference>
<AssemblyReference>System.Data.DataSetExtensions</AssemblyReference>
<AssemblyReference>System.Private.CoreLib</AssemblyReference>
<AssemblyReference>System.ObjectModel</AssemblyReference>
<AssemblyReference>System.Reflection.Metadata</AssemblyReference>
<AssemblyReference>System.Reflection.DispatchProxy</AssemblyReference>
<AssemblyReference>System.ComponentModel.TypeConverter</AssemblyReference>
<AssemblyReference>System.ComponentModel.Primitives</AssemblyReference>
<AssemblyReference>System.ComponentModel</AssemblyReference>
<AssemblyReference>System.Runtime.Serialization.Formatters</AssemblyReference>
<AssemblyReference>System.Runtime.Serialization.Primitives</AssemblyReference>
<AssemblyReference>System.Private.ServiceModel</AssemblyReference>
<AssemblyReference>System.Private.DataContractSerialization</AssemblyReference>
<AssemblyReference>System.Private.Xml</AssemblyReference>
<AssemblyReference>UiPath.Excel</AssemblyReference>
<AssemblyReference>UiPath.Excel.Activities</AssemblyReference>
<AssemblyReference>UiPath.Workflow</AssemblyReference>
<AssemblyReference>System.Data.Common</AssemblyReference>
<AssemblyReference>UiPath.Word.Activities</AssemblyReference>
<AssemblyReference>UiPath.System.Activities.Design</AssemblyReference>
<AssemblyReference>System.Console</AssemblyReference>
<AssemblyReference>System.Memory</AssemblyReference>
<AssemblyReference>System.Private.Uri</AssemblyReference>
<AssemblyReference>System.Configuration.ConfigurationManager</AssemblyReference>
<AssemblyReference>System.Security.Permissions</AssemblyReference>
<AssemblyReference>NPOI</AssemblyReference>
<AssemblyReference>System.IO.FileSystem</AssemblyReference>
<AssemblyReference>System.IO.FileSystem.Watcher</AssemblyReference>
<AssemblyReference>System.IO.Packaging</AssemblyReference>
<AssemblyReference>System.IO.FileSystem.DriveInfo</AssemblyReference>
<AssemblyReference>System.IO.FileSystem.AccessControl</AssemblyReference>
<AssemblyReference>System.Data.SqlClient</AssemblyReference>
</scg:List>
</TextExpression.ReferencesForImplementation>
<Sequence sap2010:Annotation.AnnotationText="Description: This Mac-compatible automation creates Word documents from a template using information from a CSV file.

Arguments:
CSV_input_filepath - Complete file path of the CSV file
Word_template_filepath - Complete file path of the word template file
Output_folderpath - folder path for the generated word documents" DisplayName="Main" sap:VirtualizedContainerService.HintSize="588,2412" sap2010:WorkflowViewState.IdRef="Sequence_1">
<Sequence.Variables>
<Variable x:TypeArguments="sd:DataTable" Name="InputDT" />
<Variable x:TypeArguments="x:Int32" Name="columnCount" />
</Sequence.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
<x:Boolean x:Key="IsAnnotationDocked">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<ui:InvokeWorkflowFile ArgumentsVariable="{x:Null}" ContinueOnError="{x:Null}" DisplayName="Invoke Validation workflow" sap:VirtualizedContainerService.HintSize="546,112" sap2010:WorkflowViewState.IdRef="InvokeWorkflowFile_1" UnSafe="False" WorkflowFileName="Validation.xaml">
<ui:InvokeWorkflowFile.Arguments>
<InArgument x:TypeArguments="x:String" x:Key="in_wordTemplateFilePath">[Word_template_filepath]</InArgument>
<InArgument x:TypeArguments="x:String" x:Key="in_CSVFilePath">[CSV_input_filepath]</InArgument>
<InArgument x:TypeArguments="x:String" x:Key="in_outputFolderPath">[Output_folderpath]</InArgument>
</ui:InvokeWorkflowFile.Arguments>
</ui:InvokeWorkflowFile>
<ui:ReadCsvFile DataTable="[InputDT]" Delimitator="Comma" DisplayName="Read Input CSV" FilePath="[CSV_input_filepath]" sap:VirtualizedContainerService.HintSize="546,153" sap2010:WorkflowViewState.IdRef="ReadCsvFile_1" />
<Assign DisplayName="Assign Column Count" sap:VirtualizedContainerService.HintSize="546,60" sap2010:WorkflowViewState.IdRef="Assign_2">
<Assign.To>
<OutArgument x:TypeArguments="x:Int32">[columnCount]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Int32">[InputDT.Columns.Count]</InArgument>
</Assign.Value>
</Assign>
<ui:ForEachRow ColumnNames="{x:Null}" CurrentIndex="{x:Null}" DataTable="[InputDT]" DisplayName="For Each Row in CSV" sap:VirtualizedContainerService.HintSize="546,1758" sap2010:WorkflowViewState.IdRef="ForEachRow_1">
<ui:ForEachRow.Body>
<ActivityAction x:TypeArguments="sd:DataRow">
<ActivityAction.Argument>
<DelegateInArgument x:TypeArguments="sd:DataRow" Name="CurrentRow" />
</ActivityAction.Argument>
<Sequence DisplayName="Generate New Word File" sap:VirtualizedContainerService.HintSize="512,1638" sap2010:WorkflowViewState.IdRef="Sequence_2">
<Sequence.Variables>
<Variable x:TypeArguments="x:String" Name="currentFilePath" />
<Variable x:TypeArguments="x:Boolean" Name="foundExistingFile" />
<Variable x:TypeArguments="x:Int32" Name="fileNameIdx" />
</Sequence.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Assign DisplayName="Assign File Name" sap:VirtualizedContainerService.HintSize="470,60" sap2010:WorkflowViewState.IdRef="Assign_1">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[currentFilePath]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[Path.Combine(Output_folderpath,CurrentRow("Filename").ToString+".docx")]</InArgument>
</Assign.Value>
</Assign>
<ui:FileExistsX DisplayName="Check if File Name Exists" Exists="[foundExistingFile]" sap:VirtualizedContainerService.HintSize="470,132" sap2010:WorkflowViewState.IdRef="FileExistsX_1" Path="[currentFilePath]" />
<Assign DisplayName="Reset File Name Index" sap:VirtualizedContainerService.HintSize="470,60" sap2010:WorkflowViewState.IdRef="Assign_3">
<Assign.To>
<OutArgument x:TypeArguments="x:Int32">[fileNameIdx]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Int32">0</InArgument>
</Assign.Value>
</Assign>
<ui:InterruptibleWhile Condition="[foundExistingFile]" DisplayName="While File Name Existed" sap:VirtualizedContainerService.HintSize="470,589" sap2010:WorkflowViewState.IdRef="InterruptibleWhile_1">
<ui:InterruptibleWhile.Body>
<Sequence DisplayName="Check File Name with Index" sap:VirtualizedContainerService.HintSize="426,424" sap2010:WorkflowViewState.IdRef="Sequence_3">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Assign DisplayName="Incease File Name Index" sap:VirtualizedContainerService.HintSize="384,60" sap2010:WorkflowViewState.IdRef="Assign_4">
<Assign.To>
<OutArgument x:TypeArguments="x:Int32">[fileNameIdx]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Int32">[fileNameIdx+1]</InArgument>
</Assign.Value>
</Assign>
<Assign DisplayName="Assign File Name with Index" sap:VirtualizedContainerService.HintSize="384,60" sap2010:WorkflowViewState.IdRef="Assign_5">
<Assign.To>
<OutArgument x:TypeArguments="x:String">[currentFilePath]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:String">[Path.Combine(Output_folderpath,CurrentRow("Filename").ToString+"("+fileNameIdx.ToString+").docx")]</InArgument>
</Assign.Value>
</Assign>
<ui:FileExistsX DisplayName="Check if New File Name Exists" Exists="[foundExistingFile]" sap:VirtualizedContainerService.HintSize="384,132" sap2010:WorkflowViewState.IdRef="FileExistsX_2" Path="[currentFilePath]" />
</Sequence>
</ui:InterruptibleWhile.Body>
</ui:InterruptibleWhile>
<ui:CopyFile ContinueOnError="{x:Null}" Destination="[currentFilePath]" DisplayName="Create New File Based On Template" sap:VirtualizedContainerService.HintSize="470,158" sap2010:WorkflowViewState.IdRef="CopyFile_1" Overwrite="False" Path="[Word_template_filepath]" />
<ui:ForEach x:TypeArguments="x:Int32" CurrentIndex="{x:Null}" DisplayName="For Each Column" sap:VirtualizedContainerService.HintSize="470,216" sap2010:WorkflowViewState.IdRef="ForEach`1_2" Values="[Enumerable.Range(0,columnCount)]">
<ui:ForEach.Body>
<ActivityAction x:TypeArguments="x:Int32">
<ActivityAction.Argument>
<DelegateInArgument x:TypeArguments="x:Int32" Name="columnIndex" />
</ActivityAction.Argument>
<p:DocumentReplaceText Found="{x:Null}" DisplayName="Replace Keywords in Template Document" FilePath="[currentFilePath]" sap:VirtualizedContainerService.HintSize="434,92" sap2010:WorkflowViewState.IdRef="DocumentReplaceText_1" Replace="[CurrentRow(columnIndex).ToString]" Search="["{{"+InputDT.Columns(columnIndex).ColumnName+"}}"]" />
</ActivityAction>
</ui:ForEach.Body>
</ui:ForEach>
<ui:LogMessage DisplayName="Log Message" sap:VirtualizedContainerService.HintSize="470,91" sap2010:WorkflowViewState.IdRef="LogMessage_1" Message="["File generated: "+currentFilePath]" />
</Sequence>
</ActivityAction>
</ui:ForEachRow.Body>
</ui:ForEachRow>
</Sequence>
</Activity>