Skip to Content
avatar image
Former Member

Crystal Reports, export to paginated text in landscape mode?

Our winForms application offers the same export options as CR for VS. Even in Visual Studio, using report preview, I can't seem to get the report exported as a text file in landscape orientation (the report orientation). Export to Word or PDF does create a file in landscape orientation.

The customer wants a text file to provide to a third party. important fields are cut off on created text file.

Can we create the text file in landscape orientation?

Add comment
10|10000 characters needed characters exceeded

  • Former Member

    'Just an update. I based my earlier statement that the text file was in portrait orientation based on the shape of a page of text in the paginated text file created. However, the text file has up to 127 columns, while another report, in portrait orientation, has 100 columns. So the text file may be created in landscape orientation after all. Now if Crystal decided there were 150 columns, maybe paginated text export wouldn't truncate various fields. Is any configuration possible?

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 25 at 09:38 PM

    Hi Don!

    Thanks for your input.

    I believe all our reports have No Printer checkmarked and "Dissociate..." not checked.The implementation below worked with "Dissociate..." checkmarked as well. I don't see that Crystal pays attention to the printer settings when exporting to text.

    'Handling this in our code. Setting CharactersPerInch = 16 (default is 12) indirectly caused Crystal to create the text file with 170+ columns rather than ~125. This prevented cut off for the most part. These settings can also be keyed in when exporting from CR for VS. CR Viewer does not appear to support export to text.

    'Found this example helpful:

    https://social.msdn.microsoft.com/Forums/en-US/d13064ab-2813-49bc-a405-5d0619a0ba31/export-to-textcrystal-reports-linesperpagecharactersperinch-in-c?forum=vscrystalreports

    My implementation:

                        if (saveFileDialog1.FilterIndex == 1 && // if export to text and
                            rpt.PrintOptions.PaperOrientation != PaperOrientation.Portrait) //Landscape
                        {
                            DiskFileDestinationOptions diskFileDestinationOptions = new DiskFileDestinationOptions
                            {
                                DiskFileName = saveFileDialog1.FileName
                            };
                            TextFormatOptions textFormatOptions = new TextFormatOptions
                            {
                                CharactersPerInch = 16, //more (8 to 16, default of 12) Indirectly caused Crystal to create the text file with 170+ columns rather than ~125.
                                LinesPerPage = 45 //less. Initially 60. Export as Word (landscape) gives about 45 lines
                            };
                            ExportOptions exportOptions = new ExportOptions
                            {
                                ExportDestinationOptions = diskFileDestinationOptions,
                                ExportDestinationType = ExportDestinationType.DiskFile,
                                ExportFormatOptions = textFormatOptions,
                                ExportFormatType = ExportFormatType.Text
                            };
                            rpt.Export(exportOptions);
                        }
                        else
                            rpt.ExportToDisk(formats[saveFileDialog1.FilterIndex - 1].formatType, saveFileDialog1.FileName);
    
    
    
    Add comment
    10|10000 characters needed characters exceeded

  • Jan 25 at 06:28 PM

    Export is based on the printer driver used. If you want wide format use a printer capable of wide paper and set that as the printer when exporting.

    Or try No Printer, Dissociate checked on and a custom paper size.

    Don

    Add comment
    10|10000 characters needed characters exceeded