Friday, February 8, 2013

Column Alignment Issue – Crystal Reports


Recently, we have created a customized report for GP payroll system using Crystal Reports. We don’t find any problem while printing the report on the screen. However,  when we exported the report to MS Excel we faced a strange issue – columns and data were not aligned properly.   

The report appeared as shown below with mismatched columns and field alignments.



There are four main causes for the column alignment issue.

Cause 1:  Fields in the same column are not aligned with guidelines or snap-to grid.

Cause 2: Objects in the same column have different widths.

Cause 3: Fields and objects in the same column do not have the same text alignment. For example, the column heading text object is aligned to the right, while the database field is aligned to center.

Cause 4: Fields or objects with different font size and formatting (bold, italics) can cause blank columns.

To resolve the issue, follow the respective resolution and try to export the report to MS Excel.

Resolution 1:
To prevent fields from appearing in different rows, horizontally align fields with guidelines:        
  •  In Design view, click the vertical ruler to create a vertical guideline.
  • Click one of the fields in the section, and drag it to the vertical guideline.
  • The field should ‘snap’ to the guideline. When the corners are highlighted in red, this indicates the field is snapped to the guideline.
  • Repeat step 2 until all the fields in the section are snapped to the vertical guideline(s).
  • Set the object’s size and position by right-clicking the field, selecting Object Size and Position and then setting the XY coordinates.
  • Use the horizontal and vertical rulers as a reference when specifying height, width, and XY coordinates.
  • Export the report to Excel and all the fields in the section appear in the same column. Extra blank columns will not appear.

Resolution 2:
To ensure all the objects in the same column have the same width:
  • Select all the objects (such as database fields, column header text objects, and summary or subtotals) in the column by holding down the Shift key while clicking each field, until all the fields are highlighted.
  • Right-click any of the fields, click Size, and then select same width. This widens all the fields in the column until they are the same width as the widest object in the column.
  • Export the report to Excel and no extra blank columns will appear in the worksheet.

Resolution 3:
To ensure all objects have the same alignment:
  • Select all the objects (such as database fields, column header text objects, and summary or subtotals) in the column by holding down the Shift key while clicking each field, until all the fields are highlighted.
  • Right-click any of the fields, then click Format Objects. The Format Editor dialog box appears.
  • From the Common tab, specify an alignment in the Horizontal Alignment box.
  • Click OK to return to the report. All the objects in the same column now have the same alignment.
  • Export the report to Excel and there will be no extra blank columns in the worksheet.

Resolution 4:
To ensure the same font formatting for all objects in a column:
  • Select all the objects (such as database fields, column header text objects, and summary or subtotals)    in the column by holding down the Shift key while clicking each field, until all the fields are highlighted.
  • Right-click any of the fields, then click Format Objects. The Format Editor dialog box opens.
  • From the Font tab, specify a size and format for the object’s box.
  • Click OK to return to the report.
  • Export the report to Excel and there will be no extra blank columns in the worksheet.
       
      Hope this helps!!!

No comments:

Post a Comment