2013-03-23 13 views
0

我需要獲取ReportViewer上顯示的當前RDLC的文件名。有沒有像獲取當前RDLC報告的文件名

Dim filename As String = Me.ReportViewer1.LocalReport.GetFilename? 

因爲我不想做以下事情。

Dim path As String() = Me.ReportViewer1.LocalReport.ReportPath.Split("\") 
Dim filename As String = path(path.Length - 1) 

回答

0

似乎有不被在ReportViewer或其LocalReport財產的任何成員,使您能夠做到這一點。

但是,您可能能夠使用像Path.GetFileName的方法做這樣的事情:

Dim filename As String = Path.GetFileName(Me.ReportViewer1.LocalReport.ReportPath) 

所以你沒有做字符串分割操作等

0

NKVU's answer,另外完全一致,如果你想得到沒有extensionfilename,你可以使用this,

Path.GetFileNameWithoutExtension(Me.ReportViewer1.LocalReport.ReportPath)