I have a word template with some characters and keywords and when trying to replace a text, it failed because is more than 255 characters, any workaround on this issue? any update in the packages?
in order to test
create a sequence
add assign activity name: sample, value: “Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum”
add word application scope and add a sample word document with a keyword of ##text## or any keyword
Do a replace text Word activity like “##text##” : sample
run it and it will fail, then, cut the sample text to fit 250 chars and will work.
Why not split the string on something common like full stops, commas or new lines? Then you can replace the text for each item in the array and eventually piece it all back together?
Here is a sample workflow that replace a pattern in a Word document with a text larger than 255 characters. It does that by using multiple Test Replace with chunks of 255 or less characters. WordReplaceLargeText.xaml (10.2 KB)
Hello Silviu. Could you please re-post this workflow? I am unable to see most of it due to an error message (Activity could not be loaded because of errors in the XAML).
I am also interested in using the Word replace activity with long strings.
The dependencies are stored in the project configuration file (project.json) and restored when you open the project. But because I’ve only added the xaml file to the forum, when you opened the file in Studio it doesn’t know about dependencies and you have to added them manually.
Hey, I had almost the same issue as you and came up with a solution that you may like.
Split the text and save it into an array of strings, you can use “,” as a parameter and then edit it to eliminate the " " at the beginning of each item. The point is that you can have an array of texts, each item containing text less than 250 characters.
Then you can play with a counter and a guide inside a for each loop.
Let’s say that in your word file you have a key word that works as a pivot for replacing, let’s call it “(KEY)”.
In the for each loop, use an IF activity, and if the counter equals length of the array just use a normal replace, with “(KEY)” and item (the default value in the for each loop). BUT…if the condition is not met, you can replace “(KEY)” with item+" (KEY)“. so that the loop of replacing continues until the last aarray element, on which the +” (KEY)" will not be added.
I hope I explained myself correctly.
It worked for me since i’m playing with a list of elements, in my case, work functions.