as I want to change values in word doc using excel value which are in columns instead of rows
But how do I implement it to change the word doc values to values in dictionary
In my screenshot the first column is key and second is value, I have a word document that has the key which i want to change it to value, e.g. first row, in word doc has so I want to change it to ABC PTE LTD. usually datatable is for first row as header but now my header is in first column. Do help me out Thank You!
- Read the datatable
- Use lookup datatable…depending on the first column and look p for what key you want to replace…which gives the valued from column2
- Now use the same key again in replace text activity in word to replace the tag with actual value
cheers
is it possible to use dictionary if so how? as my teacher said to use datatable to dictionary is more efficient do help me out Thank You!
- For Each Row in Data Table
** Assign yourDict(CurrentRow(“key column name”).ToString) = CurrentRow(“value column name”).ToString
Maybe the following is fitting
Prepare the Word File / Template with dedicated Placeholders e.g. #CompanyName#
Bring DataTable to Dictionary / or iterate over the DataTable
Use one column for the placeholder
Use other column for the value
Then with the help of Search / Replace within the word you can set values by using the Placeholder for the search
DT - to Dictionary:
Assign Activity:
dictLK | Dictionary(Of String, String) =
dtData.AsEnumerable.ToDictionary(Function (x) x(ColNameOrIndexKey).toString.Trim,Function (x) x(ColNameOrIndexValue).toString.Trim)
Also have a look here: