-3
Crystal 보고서를 pdf로 내보내는 데 문제가 있습니다. 내 프로그램은 teleneUdaje.rpt의로드시에 충돌하고 나는 그것이 맞는 이름 인 shure입니다.Crystal 보고서 내보내기 충돌 C#
if (txtpath.Text == "") throw new Exception ("Prosím zvoľte cieľovú adresu");
DataSet dt = new DataSet();
string x = nastavenia.adresa_servera();
string y = nastavenia.nazov_databazy();
string z = nastavenia.ponechat_udaje();
string a = nastavenia.sql_meno();
string b = nastavenia.sql_heslo();
SqlConnection databaza = new SqlConnection();
databaza.ConnectionString = "Data Source=" + x + ";Initial Catalog=" + y + ";Persist Security Info=" + z + ";User ID=" + a + "; password=" + b + "";
da.SelectCommand = new SqlCommand("SELECT * FROM tblTepelneUdaje", databaza);
dt.Clear();
da.Fill(dt);
System.IO.FileInfo info = new System.IO.FileInfo(txtpath.Text.Trim());
string type = info.Extension;
CrystalDecisions.Shared.ExportFormatType tp = CrystalDecisions.Shared.ExportFormatType.Excel;
switch (type)
{
case ".pdf":
tp = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
break;
case ".doc":
tp = CrystalDecisions.Shared.ExportFormatType.WordForWindows; break;
case ".rtf":
tp = CrystalDecisions.Shared.ExportFormatType.RichText; break;
case ".xls":
tp = CrystalDecisions.Shared.ExportFormatType.Excel; break;
default: MessageBox.Show("Invalid File type you entered"); break;
}
ReportDocument doc = new ReportDocument();
doc.Load("TeleneUdaje.rpt");
doc.SetDataSource(dt);
doc.ExportToDisk(tp, txtpath.Text);
MessageBox.Show("Zostava bola úspešne exportovaná");
도와주세요.
** 편집
보고서로드가 실패한 Crystal Reports 예외가 발생합니다. 프로그램 내에서 보고서 뷰어 도구로 보고서를 표시 할 수 있기 때문에 파일이 정상입니다.
충돌 방법에 대한
이들으 : 그것은 .RPT의이 같은 파일의 전체 경로를 필요로하기 때문에 표현
잘못입니까? 예외가 발생합니까? 디스크에 아무것도 쓰지 않으십니까? –
@AdamV 크리스탈 보고서 예외가 발생했습니다. 보고서로드 실패 – MichalCh
보고서에 문제가있는 것 같습니다. 필자는 Crystal Reports에 대한 경험이 없지만 수동으로 열어보고 파일의 오류가 있는지 확인하려고합니다. –