Support > Forums > OpenBots Studio > Working with a Word predefined layout

Working with a Word predefined layout

David Santos

  • Reporter
  • Calender Icon December 08,2021 at 11:07 AM

Hi Openbots experts.�

Considering the following case:

  • a Word template exists to distribute the financial figures of a company every 15 days.
  • the Word file has always the same structure (page1:intro, page2:balance sheet screenshot + comments, page 3: P&L screenshot + comments)

If we'd need to build a bot to generate the predefined report for the current iteration (considering that the Bal and P&L screenshots are saved in a shared folder), is there a way to generate the following automatic operations in word?�

-�to replace� just the first paragraph of the page 1 without changing the content or structure of the rest of the page. -�to replace�only one of the screenshots included in the page2 and maintain the rest of the items as is. -�to replace�only one of the screenshots included in the page3 and maintain the rest of the items as is.

Can Openbots�allow to do these specific operations within a word file?

Kind regards

This forum has 314 topics, 681 replies, and was last updated 12 days ago by Support Agent

David Santos

  • Participant
  • Calender Icon December 11,2021 at 8:48 AM

That�s a smart way to cover this case. Thanks for sharing this approach!

Lakshmi Sukumar

  • Participant
  • Calender Icon December 10,2021 at 5:49 PM

Hi there DAVSAN001

I have been working on a similar use case. My project is designed to automate the creation of sales proposals using an existing document as a template and surgically replacing certain images and paragraphs.

Word is trickier to work with than Excel (with coordinates) or a website (with a DOM) but it can be done using bookmarks, which need to be added to the document first. After that you can target them like any link.

My solution was to:

  1. Create anchors (bookmarks) in the Word doc where the replacements need to occur
  2. Create a cover-page with links to the anchor points
  3. Use UI Automation to "CTRL + Click" the link, which takes you to the section in-question.
  4. From there, I used a combination of clicks and hotkeys* to edit the text or replace the image.

*You can find all the hotkeys/keyboard shortcuts in word by pressing "alt" and then experimenting with different keys to target commands in the ribbon. I'm sure you can find a keyboard shortcuts reference somewhere on the Web too.

Hope this helps.

Cheers

You are not authorized to reply, please click here to login and add your reply to this topic.