on 11-19-2014 4:41 PM
Hi, we recently upgraded to Crystal 2011 from Crystal XI... Our new product uses the CrystalDecisions.Windows.Forms.CrystalReportViewer to display the final report and allow users to export out the report to other formats such as Excel. In the old version, we used the CrystalActiveXReportViewer to achieve the same functionality. The problem is that the old version, when exporting to Excel, gave more formatting options such as "Export page header and page footers", but the new version doesn't seem to have any of those options and our customers had gotten used to having that flexibility. Is there any way to access that additional functionality in 2011?
Thanks,
Kent
Hi,
The options you said "Export Page Header and Page Footer" and other options are there under "Microsoft Excel (97-2003)Data-Only" format and I think it was the same in XI R2 too.
Microsoft Excel(97-2003) format don't have those options
Thanks,
Raghavendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for the reply. The options for export to Excel provided in the old version does not seem to appear in the new version of the CrystalDecisions.Windows.Forms.CrystalReportViewer. When exporting in Crystal XI, the standard file save dialog allowed us to choose "Microsoft Excel 97-2000 (xls)" and then when you pressed okay, it would display a secondary dialog allowing the user further options for formating the excel report. We want to be able to format the rexported excel file to have header, footer, page break, etc.... Please see attached screenshot for export differences between Crystal XI and Crystal 2011 options.
Thank you,
Kent
Hi,
Thanks,
The buttom image is not match what we want to do, we acturally want to export to Excell, sorry for the confusion. We use CrystalDecisions.Windows.Forms.CrystalReportViewer to view the report. We try to export to Excel by setting the ShowExportButton to true. But when we click on the export button, then standard file save dialog comes up, not the Export dialog you gave in your image. The dialogs shown in your image are the dialogs we want to show to the user. If these dialogs come up with the CR2013, I think they should show in CR 2011 too. How do you make these dialogs showing up in the CrystalDecisions.Windows.Forms.CrystalReportViewer? Your help will be greately appreciated.
Thank you again.
Kent
Hi Kent,
There are 2 ways to handle this.
#1. Open the report in CR Designer and click on the Export Menu option:
Select Excel and set the default properties you want to use then you get that UI:
In code you can now get those SavedExport options:
NOTE: not all formats can be saved:
private void getSavedExportOptions(CrystalDecisions.CrystalReports.Engine.ReportDocument rpt)
{
Array valArray1 = Enum.GetValues(typeof(CrReportExportFormatEnum));
foreach (object obj in valArray1)
{
lstExportFormatType.Items.Add(obj);
}
CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions RASexportOpts = new CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions();
CrystalDecisions.ReportAppServer.ReportDefModel.DataOnlyExcelExportFormatOptions RasExcelDataOnlyExpOpts = new DataOnlyExcelExportFormatOptions();
CrystalDecisions.ReportAppServer.ReportDefModel.ExcelExportFormatOptions RasXLSExpOpts = new ExcelExportFormatOptions();
//CrystalDecisions.ReportAppServer.ReportDefModel.CrReportExportFormatEnum.crReportExportFormatPaginatedTxt
string textBox1 = String.Empty;
string MyObjectType = ReportObjectComboBox1.SelectedItem.ToString();
btnReportObjects.Text = "";
foreach (CrystalDecisions.ReportAppServer.ReportDefModel.CrReportExportFormatEnum SavedExpType in valArray1)
{
switch (SavedExpType.ToString())
{
case "crReportExportFormatMSExcel":
try
{
RasXLSExpOpts = rptClientDoc.get_SavedExportOptions(CrReportExportFormatEnum.crReportExportFormatMSExcel);
}
catch (Exception ex)
{
textBox1 += "MSExcel or Record Style - Not saved\n 'End' \n\n";
break;
}
textBox1 += "\nMSExcel or Record Style : \n";
if (RasXLSExpOpts != null)
{
textBox1 += "BaseAreaGroupNumber: " + RasXLSExpOpts.BaseAreaGroupNumber.ToString() + "\n";
textBox1 += "BaseAreaType: " + RasXLSExpOpts.BaseAreaType.ToString() + "\n";
textBox1 += "FormulaExportPageAreaType: " + RasXLSExpOpts.ExportPageAreaPairType.ToString() + "\n";
textBox1 += "ExportPageBreaks: " + RasXLSExpOpts.ExportPageBreaks.ToString() + "\n";
textBox1 += "ConstantColWidth: " + RasXLSExpOpts.ConstantColWidth.ToString() + "\n";
textBox1 += "ConvertDatesToStrings: " + RasXLSExpOpts.ConvertDatesToStrings.ToString() + "\n";
textBox1 += "StartPageNumber: " + RasXLSExpOpts.StartPageNumber.ToString() + "\n";
textBox1 += "EndPageNumber: " + RasXLSExpOpts.EndPageNumber.ToString() + "\n";
textBox1 += "ExportPageBreaks: " + RasXLSExpOpts.ExportPageBreaks.ToString() + "\n";
textBox1 += "MRelativeObjectPosition: " + RasXLSExpOpts.MaintainRelativeObjectPosition.ToString() + "\n";
textBox1 += "ShowGridlines: " + RasXLSExpOpts.ShowGridlines.ToString() + "\n";
textBox1 += "UseConstantColWidth: " + RasXLSExpOpts.UseConstantColWidth.ToString() + "\n";
}
btnReportObjects.Text += textBox1;
btnReportObjects.AppendText(" 'End' \n\n");
textBox1 = "";
break;
If this doesn't work for you then you can replace the viewers export button with your own and handle the values yourself with your own UI.
See this KBA with a sample app attached:
PS - link will not work for you so search for the number in the upper right corner.
Thanks
Don
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.