I am trying to Export A Crystal Report using C#.Net, but unfortunately I'm having and Error that I specified few lines per page. Even though I already specified a large amount of lines. Can You help me regarding this? Please see my code below for reference.
Thank you.
void XportZ()
{
try
{
cryRpt.Load(@"D:\Arnie Files\Projects\BIR E-journal\ZTapeReport_PwdAdj_v2.1.rpt");
cryRpt.DataSourceConnections[0].SetConnection("FA17083", "MyDB", "sa", "qwerty");
cryRpt.SetParameterValue(0, dt_BusinessDate.Value.ToString("MM/dd/yyyy"));
cryRpt.SetParameterValue(1, "☺" + txt_PosID.Text + "☺");
ExportOptions.CreateTextFormatOptions().CharactersPerInch = 60;
ExportOptions.CreateTextFormatOptions().LinesPerPage = 100;
cryRpt.ExportToDisk(ExportFormatType.Text, @"D:\_AAAAAA\Zreading" + txt_PosID.Text + dt_BusinessDate.Value.ToString("MMddyyyy") + ".txt");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
hasError = true;
}
finally
{
cryRpt.Dispose();
cryRpt.Close();
}
}
It seems to me the ExportToDisk option automatically overrides the linesPerPage. Try doing Report.Export and that should work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.