Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Page Header Bug Post Reply Post New Topic
Page  of 2 Next >>
Author Message
gurarpangill
Newbie
Newbie


Joined: 04 Jun 2008
Location: United States
Online Status: Offline
Posts: 6
Quote gurarpangill Replybullet Topic: Page Header Bug
    Posted: 16 Jun 2008 at 12:15pm
We have migrated from .net 2003 to .net 2005. In .net 2005 page header  name changes to Section2(Page Header).
 
 
We are exporting report to Excel.
Problem is Page Header is not repeating for each page in .net 2.0 . But it was working fine with .net 1.1.
 
I require page header to be repeated for each page.
 
Please help its urgent and i am in fix.
 
Thanks in advance


Edited by gurarpangill - 16 Jun 2008 at 12:16pm
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 16 Jun 2008 at 2:17pm
Unfortunately, you can't do it via the Export button. In the CR XI upgrade they have a full Options dialog box that lets you set this property.

However, you can export the report using code and programmatically set the property ExcelTabHasColumnHeadings property to true. This will force the column headings to appear on every page.

I have the full Crystal Reports object model documented in my CR.NET books. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
gurarpangill
Newbie
Newbie


Joined: 04 Jun 2008
Location: United States
Online Status: Offline
Posts: 6
Quote gurarpangill Replybullet Posted: 17 Jun 2008 at 5:44am

I could not find dialog box to set property.

Can u help me. I will be really thankful.
Because i found is the expert section which supress or perform other thing on page header. But does not repeat page header.


Edited by gurarpangill - 17 Jun 2008 at 5:46am
IP IP Logged
gurarpangill
Newbie
Newbie


Joined: 04 Jun 2008
Location: United States
Online Status: Offline
Posts: 6
Quote gurarpangill Replybullet Posted: 19 Jun 2008 at 7:08am
I tried option option programatically for excel . It didnt work. Please let me know some other solution.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 22 Oct 2008 at 11:15am
I too had this issue, but finally found that what is needed is to set the value for ExportPageHeadersAndFooters = ExportPageAreaKind.OnEachPage.  Setting ExcelTabHasColumnHeadings = true was not as crucial to getting the headers and footers to print in the file.
IP IP Logged
ayix
Newbie
Newbie
Avatar

Joined: 22 Aug 2010
Location: Indonesia
Online Status: Offline
Posts: 4
Quote ayix Replybullet Posted: 22 Aug 2010 at 10:26pm
I have a problem with header, footer, and page break when I export crystal report to excel using c#.Net. I try to use ExportPageHeadersAndFooters = ExportPageAreaKind.OnEachPage and ExportPageBreaksForEachPage = true. But Ican't use it, because that two method is unknown in program. I already type:
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
What should I do now? I really need to use that two method.
Thank you for your attention
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 23 Aug 2010 at 3:26am

Imports CrystalDecisions.Shared

 

            Dim strFileName As String = String.Empty
            Dim exportOpts As New ExportOptions
            Dim diskOpts As New DiskFileDestinationOptions
            Dim excelFormatOpts As ExcelFormatOptions = ExportOptions.CreateExcelFormatOptions
            Dim rpt As CrystalDecisions.CrystalReports.Engine.ReportDocument = CType(Me.crvReport.ReportSource, CrystalDecisions.CrystalReports.Engine.ReportDocument)

            'stuff about the creating the excel file on the user's computer
            sfdSaveFile.DefaultExt = "xls"
            sfdSaveFile.AddExtension = True

            'If mstrDefaultFileName <> String.Empty Then
            '    sfdSaveFile.InitialDirectory = Application.StartupPath  'Default directory
            '    strFileName = sfdSaveFile.InitialDirectory & "\" & mstrDefaultFileName.Replace(" ", "") & "_" & mstrUserID & "_" & Date.Now.ToString.Replace("/", ".").Replace(":", ".")
            '    sfdSaveFile.FileName = strFileName
            'End If
            sfdSaveFile.Title = "Select a location to save the Excel File"
            sfdSaveFile.Filter = "All Files (*.*)|*.*|Excel 97-2003 (*.xls)|*.xls"
            sfdSaveFile.FilterIndex = 2
            boolCancel = (sfdSaveFile.ShowDialog(Me) = Windows.Forms.DialogResult.Cancel)

            diskOpts.DiskFileName = sfdSaveFile.FileName
            excelFormatOpts.ExcelTabHasColumnHeadings = True
            excelFormatOpts.ExcelUseConstantColumnWidth = True          'each field in its own column--no merge
            excelFormatOpts.ExcelConstantColumnWidth = 60
            excelFormatOpts.ConvertDateValuesToString = True
            excelFormatOpts.ExportPageHeadersAndFooters = ExportPageAreaKind.OnEachPage
            excelFormatOpts.ShowGridLines = True

            exportOpts.FormatOptions = excelFormatOpts
            exportOpts.ExportDestinationType = ExportDestinationType.DiskFile
            exportOpts.ExportDestinationOptions = diskOpts
            exportOpts.ExportFormatType = ExportFormatType.Excel
            exportOpts.ExportFormatOptions = excelFormatOpts

99% of this came from Brian's code on how to export to Excel that was answered in a post.
IP IP Logged
ayix
Newbie
Newbie
Avatar

Joined: 22 Aug 2010
Location: Indonesia
Online Status: Offline
Posts: 4
Quote ayix Replybullet Posted: 23 Aug 2010 at 3:24pm
I already write the code like this:
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;

SaveFileDialog savedialog = new SaveFileDialog();
savedialog.InitialDirectory = "c:\\";
savedialog.Filter = "Excel Files (*.xls)|*.xls|All files (*.*)|*.*";
savedialog.FilterIndex = 1;
savedialog.RestoreDirectory = true;
if (savedialog.ShowDialog() == DialogResult.OK)
{
    ExportOptions exportOpts = new ExportOptions();
        DiskFileDestinationOptions DestinationOpts = new DiskFileDestinationOptions();
        DestinationOpts.DiskFileName = savedialog.FileName;
        exportOpts.ExportFormatType = ExportFormatType.Excel;
        ExcelFormatOptions exportFormatOptions = ExportOptions.CreateExcelFormatOptions();
        exportFormatOptions.ExportPageBreaksForEachPage = true;
        exportFormatOptions.ExportPageHeadersAndFooters = ExportPageAreaKind.OnEachPage;

        exportFormatOptions.ExcelAreaType = AreaSectionKind.WholeReport;
        exportFormatOptions.ExcelUseConstantColumnWidth = false;
        exportOpts.ExportFormatOptions = exportFormatOptions;
        exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
        exportOpts.ExportDestinationOptions = DestinationOpts;
        report3.Export(exportOpts);
}

I already type using CrystalDecisions.Shared, but the method for the bold text still not recognize. Is there  any wrong code in my code? or maybe I forget something?

Edited by ayix - 23 Aug 2010 at 5:52pm
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 23 Aug 2010 at 8:44pm
Where did you get this code?

exportFormatOptions.ExportPageBreaksForEachPage = true;
exportFormatOptions.ExportPageHeadersAndFooters = ExportPageAreaKind.OnEachPage;

I don't have it in my book, nor do I see it in the object model.

Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
ayix
Newbie
Newbie
Avatar

Joined: 22 Aug 2010
Location: Indonesia
Online Status: Offline
Posts: 4
Quote ayix Replybullet Posted: 23 Aug 2010 at 8:58pm
I get this code from http://msdn.microsoft.com/en-us/library/ms226409(v=VS.90).aspx
Beside that code, is there any other way for me to export crystal report to excel with the header, footer, and also page break just like in crystal report?
IP IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.