Wie Sie sehen können Ich exportiere Crystal Report in eine PDF-Datei aber mein Problem ist, dass der Pfad der Crystal Report RPT-Datei und Pfad zum Speichern der Out-Datei (PDF-Datei) seit dem Pfad zum Ordner auf dem Desktop wird seinwie eine Datei im Ordner auf dem Desktop speichern, egal was der Pfad ist?
C:\Users\Xuser\Desktop
zwischen PCs wie
PC1 Pfadcode geändert
und auf def mieten pc
C:\Users\XYPC\Desktop
so ist der Pfad ist kein statischer Weg .. sowieso Ausweg?
Update:
jetzt unter Code den Pfad zum Desktop erhalten, aber ich bin immer Ausnahme über Zugriffsrechte, die den Zugriff auf Pfad wird
verweigertprivate void ExportToPDF()
{
ReportDocument cryrpt = new ReportDocument();
try
{
cryrpt.Load("INVOICE_REP.rpt");
ExportOptions CrExportOptions;
DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
CrDiskFileDestinationOptions.DiskFileName = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
MessageBox.Show(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory));
CrExportOptions = cryrpt.ExportOptions;
{
CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
CrExportOptions.FormatOptions = CrFormatTypeOptions;
}
cryrpt.Export();
MessageBox.Show("Export Done");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
System.Environment.GetFolderPath (Environment.SpecialFolder.Desktop) – LaneL