Question: Some of my company consultants created multiple jasper reports (using iReports) which will be filled up programmatically using a Custom JRDataSource.

The problem is that I need to know which Elements are present in the report so that I can invoke the corresponding WebServices, so my question is: *How can I programmatically, in Java, read the report so that I can identify every Element that needs to be filled up?*

The reports can't be made all programmatically because there will be constant changes to their layout, and we can't be updating our software every time one of this changes occurs.

Answer: 
Depends on what you actually want to do, if your intent is to check the contents of the "folder" and "subfolders" before and after the sort operation, I will suggest you use the command prompt to generate the list of contents in a text file. you can use the dir command for this like so:

```
DIR /S /B "Path\To\Folder" > "Path\to\text\File.txt"

```
You could position the folder window outside of the bounds of his/her screen. Then take a screenshot of that window region.

You can determine the screen width and height and position (if you position a second screen to the left of your primary screen you start position of your screen is negative) using the following code:

```
System.Windows.SystemParameters.VirtualScreenWidth;  //Total width of screen
System.Windows.SystemParameters.VirtualScreenHeight; //Total height of screen
System.Windows.SystemParameters.VirtualScreenLeft;   //Start x location of screen
System.Windows.SystemParameters.VirtualScreenTop;    //Start y location of screen

```

And by placing your folder window outside of this region and then take a screen shot of that folder should do the trick. (Not sure not tested)

```
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(folderWidth, folderHeight);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap);
g.CopyFromScreen(folderX, folderY, 0, 0, folderSize);
bitmap.Save(aRandomFileStream, System.Drawing.Imaging.ImageFormat.Jpeg);

```

Code provided as is... No warrenties if it works.