Clipping region - Take screenshot

Hi, I have a scenario where, I need to take a specific region of the excel sheet as image…

How to use the clipping region property in take screenshot activity for this?

Hi @MEGHA_cs

Check out this once:

Hope it helps.

Hi

  1. Read the Excel file using the Read Range activity and store the data in a DataTable variable (e.g., excelData).
  2. Add an Invoke Code activity to the workflow.
  3. In the Invoke Code activity, use the following code to take a screenshot of a specific region in the Excel sheet:
    using System.Drawing;
    using System.Drawing.Imaging;

// Get the specific range of the Excel sheet that you want to capture
int startX = 100; // starting X-coordinate of the region
int startY = 100; // starting Y-coordinate of the region
int width = 300; // width of the region
int height = 200; // height of the region

// Capture the screen
Bitmap screenshot = new Bitmap(width, height);
using (Graphics graphics = Graphics.FromImage(screenshot))
{
graphics.CopyFromScreen(startX, startY, 0, 0, screenshot.Size);
}

// Save the screenshot as an image file
screenshot.Save(“path_to_save_image.png”, ImageFormat.Png);
4. Replace startX, startY, width, and height with the appropriate coordinates and dimensions of the region you want to capture.
5. Replace "path_to_save_image.png" with the desired file path and name where you want to save the screenshot image.

Note that you will need to add the required namespaces for System.Drawing and System.Drawing.Imaging at the top of the Invoke Code activity window.

After executing the workflow, you will have a screenshot image file of the specified region in the Excel sheet.

Thank you

Thanks,

But the range is dynamic… After reading Excel sheet i need to filter the excel then select the data and copy to pdf…

Thanks…
can you please give the proper code for invoke code activity… Also I want the region to be dynamic

@MEGHA_cs

Are you using excel activities for this process.

To read the data and to apply the filter using excel

@MEGHA_cs

After filtering the data you can directly save the sheet as pdf.

I need to paste this data into an existing pdf…

@MEGHA_cs

You can get the range by following thread

After getting the range follow the above mentioned thread to take screenshot.

@MEGHA_cs

You can save the excel as pdf and then save the pdf as image and use it…both activities are readily available to you

Cheers

Hi

To get the dynamic range in UiPath use the following syntax in select range

“A1:”+Chr(64+Dt_data.Columns.Count)+(Dt_data.Rows.Count+1).ToString

I hope this will help you,

Thank you