Copy Formatted Text From Web Page to Existing Word Document

Hi friends,

I have a very simple task to do.

Example Copy Formatted Text from Wikipedia to an Open Word Document

I selected the first paragraph only.

Next I have made the Get Text to a variable myText set to Clipboard

Then I paste this formatted Text into my word document

Miserably failed this simple task.

The Error
image

Please do advise thank you

Hai @Dan77…
Use Hot keys Like Ctrl+C to Copy the Text and Ctrl+V to paste the text . Ensure that the paragraph is within the given limit or change it as u want…
Example Work flow👇
BlankProcess3 - Copy.zip (942.5 KB)

Hi Nandhuba,

Thanks for your help.

I should explain what I am trying to do better.

Goal

Go to a Web Page - Example Wikipedia Page

Copy the FORMATTED TEXT from a SPECIFIC Selector Class

Paste into Word

I can use get text but it pastes it as plain text.

I really want the original format as it is displayed on the web page.

The problem is because I want the formatted text from a specific element only.

I have tried for the past 2 days but no luck yet.

Please Find attached my workflow so far

Bear_Forum.xaml (8.1 KB)

As you can see the differece between the 2 types of text

image

Formatted Text has hyperlinks and other formatting that I may need.

If you go to a web page and do CTRL C and paste into word you get the formatted text.

I only want the formatted text from a specific selector class.

Thank you for your help

@Dan77… if the text is an UiElement, use get attribute activity with the attribute as “href”. The output would be the url which you can navigate to… Example Work flow :point_down:
HtmlCopyTest.xaml (6.9 KB)

HI Nandhuba,

I extracted the inner html. Now the Pasted Text has text and html mixed.

image

Is there no way to simply get the original Formatted text as displayed.

Whenever you copy something from a webpage and paste into word, you get the original formatted text.

I tried to use an invoke method with clipboard rtf, but that didnt work.
I dont understand how to use the invoke method with formatted clipboard.

thanks

1 Like

@bcorrea
@Anthony_Humphries
@supermanPunch any idea regarding this?

@Dan77 I was able to use Get Text Activity and use Type Into Activity to Write the Text into the Word Document, It takes a lot of time to type the Information. Is that fine?

Hi all, thanks for the input on this rather basic situation that has become complex.

@supermanPunch - I would be intrested to see if this works.

If it types the formatted text as displayed on the web page, then thats suffice for now.

I am starting to learn ui path again and just wanted to do some basics.

Hi @supermanPunch

It only types in the plain text.

The formatting and hyperlinks are all missing.

I have no problem extracting plain text or inner html.

The formatted original text I cant seem to find a way to get.

1 Like

This seams the way to go, but if you are taking from html formatted text and pasting into Word, then Word must accept the same…

Hi all,

Still no easy solution to this problem.
I have found that you can triple click on the text and it will select the paragraph.

image

In simple test cases I have sent the click activity 3 times.
It has worked to select the text.

When combined in full automation it often fails.

I have tried all combinations of single clicks, double clicks.

This is not an ideal solution at all.

Alternative is to use vbnet

I read that VB.net script can click mouse.

I wanted to click the mouse using vb.net, to send 3 mouse clicks.

if any one can show me how to use vbnet to click the mouse 3 times that would be appreciated.

I have searched for vb mouse click on forum, I couldnt get it to work.

I hope UI path can remedy this situation in future, as its such a fundamnetal basic task that we do every day copy and paste selected text.

Did you try 3 click with all delays set to 0?