Question

I am having an issue is that while exporting a report to excel sheet, there are lots of spaces and empty cells between the data, as well as, the cells are merged.

Is there is a way to export the report and each field will be in a cell or to control that exportation, suppose my report looks like this:

No  Trans_No 
1    123
2    333

In my excel sheet, I would like

A    B
No  Trans_No 
1    123
2    333

, But currently it is showing a merging of the cells and spaces , so instead of Trans_No will be in CELL B, it is in D.

So, is there is a way to control o export that?

Was it helpful?

Solution

mohs, welcome to StackOverflow.

Crystal Reports and Excel have very different methods and data structures. When exporting a .rpt into .xls format, Crystal has to make many compromises and judgement calls. Here are some suggestions:

  1. Do you absolutely need to use Crystal in this process?

    A. You can import data directly from your data source into Excel (without using Crystal) using Data->Import External Data.
    B. You can export from Crystal into CSV format. If the Excel file is being made just for a machine to read it, CSV is a better option.

  2. Keep your Crystal Report very simple.

    A. After you drag & drop fields onto your design, do not resize or overlap them.
    B. Make sure in your options, you have snap to grid checked.
    C. Are your fields horizontally aligned? If not, they will probably be put on different rows.
    D. If you are grouping data, you may want to suppress the group headers & footers.

OTHER TIPS

If you are finding empty rows between your data, you can filter these out in Excel:

  • Select column
  • Data > Filter (Excel 2010)
  • Dropdown > uncheck 'Blanks'

I don't use Crystal Reports, but could you export to a CSV file, then import into Excel. The import will allow you to specify the delimiters and should format your data better.

From experience with exporting from older versions of Crystal to Excel, a couple of options:

(1) Export to CSV and open the CSV file in Excel.

This had the disadvantage that instead of appearing at the top of the report above the data values, the column headings would appear on every line of the output before the column values - like so:

No   Trans_No   1   123
No   Trans_No   2   333

This issue may have been resolved in CR XI - if not, the workround we used for this was to suppress column headings (so that only the values were included in the output), then copy and paste a standard spreadsheet heading for the report into the output in Excel.

(2) Consistently format all fields to the same, minimum size (typically, two grid widths), with columns aligned by snapping the left edge of fields to guidelines.

This produces output which is almost unreadable in the standard report viewer, but which should align correctly in Excel.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top