Report Design - Item with image file

Top  Previous  Next

The following steps show you how to design your report format to display item image/graphic when applicable...

 

First of all assign image file to few items (Stock Item Maintenance). Please be reminded that you do not paste the real image but just a path (to link to respective image file).

 

faqa35

 

 

To show the image in Invoice, go to Report Designer of Invoice, (go to Sales > Invoice, click on Report > Design Document Style Report )

 

 

faqa36

 

 

First of all, drag and drop the control of PictureBox from Tool Box onto an empty place of  ppDetailBand1, below item description...

Secondly, click to highlight the PictureBox control, look into Property Grid,  go to (DataBindings) > ImageUrl > Binding.... and select: 1 Main Data:Invoice Master > Invoice Detail > Item Image File Path.

Thirdly, scroll down along Property Grid, change the Sizing property to StrecthImage (to strecth according to the box size)
 
faqa37

 

 

Preview the Invoice, it will look like this:

 

faqa38

 

 

You may adjust the size and position of PictureBox control several times until you are happy with the layout.

 

The problem now is, if you have some items without image file, it will show the empty space also … just like item no.2.

Though you may solve this by setting the Sizing property to AutoSize (means towards right and downwards according to original size) …. the best solution is using script that can be copied from your AutoCount installer DVD.

 
 

 

Steps of using the scripts to clear space of items without image file:
 

Step 1: browse into AutoCount installer DVD, look into a PDF file at  E:\Accounting\Technical Documents\Learning AutoCount Accounting Report Designer.pdf  … look into page 73, copy the content of the following script.
 
  faqa39

 

 

Step 2: Go to Invoice report designer, highlight the PictureBox control, and look into Property Grid, go to Scripts > OnBeforePrint ..... click on the ellipsis button... and paste the scripts to replace the original scripts...

 
faqa40
 
faqa41
 

The above script will extract the ImageFileName property of Invoice Detail, and check whether the image file is exist or not, if it exists, then it will load the image file into a System.Drawing.Image object, and then assign this object to xrPictureBox.Image. If the image file is not found or error occurs during loading, it will set the size of the xrPictureBox to 0, and minimize the height of the ppDetailBand1.
 

Click OK.

 

 

Step 3: Change the (Name) to: xrPictureBox  (to match the scripts)
 
  faqa42

 

 

Step 4: Preview
 
 
faqa43

 

 

Finally, save the report format.

 

 

 

____________________________________________________________

Send feedback about this topic to AutoCount. peter@autocountSoft.com

© 2010 Auto Count Sdn Bhd - Peter Tan. All rights reserved.