Question

How to past/append/import excel range into Microsoft Word file using Pega Robotics/OpenSpan

Hello Team,

Can any one help me to past/append/import the excel range into MS Word file.

I have added a microsoftWord component in Global Container and set the Document/Path property to access the file.

Unable to find the Text/Append properties under Object Inspector nor any relevant Event or Method found for the microsoftWord component.

Thanks

Correct Answer
December 24, 2019 - 1:22pm

The Microsoft Word component is a very powerful tool since it gives you complete access to the Word object model. To understand the full capabilities of the Word object model you will need to do a little research but anything you want to do is possible. The best place to look is on MSDN at the Microsoft.Office.Interop.Word namespace site. When searching for an answer i usually Google "C# Word Interop {question}" and find the answer quickly.

The magic in automation to access the Word object model is to use a proxy. The MicrosoftWord component has a property named WordDocument - extract a proxy from that.

Now select the proxy and go to the Object Inspector and you will have over a hundred properties and methods available. Using the documentation on MSDN you can then proceed to build an automation. If a property of your proxy is a complex object you will again need to extract a proxy of it to see all of the properties and methods.

Here is a simple automation to append text at the end of your document. Notice that the _Document proxy has a property named Content which is a Range. A Range object has an InsertAfter method.

Comments

Keep up to date on this post and subscribe to comments

Pega
December 13, 2019 - 4:14pm

The Word component is pretty basic. You need to define Bookmarks in your document and then those are exposed as properties of the document to be populated with text. Filling out a table as you seem to be wanting to do with Excel will require at least some C# code.

http://help.openspan.com/191/Components/How_to_use_the_Document_component.htm

http://help.openspan.com/191/Components/Microsoft_Word.htm

December 24, 2019 - 3:31am
Response to tsasnett

Seems there are very limited functionalities available with MicrosoftWord Component.  

Is this only a Solution of this requirement ? Can any one help ?

Pega
December 24, 2019 - 1:22pm

The Microsoft Word component is a very powerful tool since it gives you complete access to the Word object model. To understand the full capabilities of the Word object model you will need to do a little research but anything you want to do is possible. The best place to look is on MSDN at the Microsoft.Office.Interop.Word namespace site. When searching for an answer i usually Google "C# Word Interop {question}" and find the answer quickly.

The magic in automation to access the Word object model is to use a proxy. The MicrosoftWord component has a property named WordDocument - extract a proxy from that.

Now select the proxy and go to the Object Inspector and you will have over a hundred properties and methods available. Using the documentation on MSDN you can then proceed to build an automation. If a property of your proxy is a complex object you will again need to extract a proxy of it to see all of the properties and methods.

Here is a simple automation to append text at the end of your document. Notice that the _Document proxy has a property named Content which is a Range. A Range object has an InsertAfter method.

December 26, 2019 - 1:20am
Response to jeffbadger

Thank you so much Jeff Badger, Based on your reply I found number of properties for MicrosoftWord component.