中文化ReportViewer Toolbar

我都用ReportViewer在網頁上替客戶產生報表,他的好處是可以輸出Excel,pdf.

又可以在網頁上即時預覽,雖然是ActiveX,但它是應付客戶的最佳方法

但客戶才沒那麼好搞定,今天客戶說他看不懂上面的”select export format…”

所以我就去研究中文化了,以下就是中文化的三種方法.

1. ReportViewer 2005版

MS已經有提供語言包,在你的server安裝就可以

2. ReportViewer 2008手動部署

MS還沒提供語言包,所以方法就是在安裝有VS2008的電腦裡,把語言資源copy到伺服器

到%WINDOWS%\assembly裡面找下面兩個東西

Microsoft.ReportViewer.WebForms.resources.dll

Microsoft.ReportViewer.Common.resources.dll

在console用這個命令把他copy出來

xcopy %WINDOWS%\assembly\GAC_msil x:\GAC_MSIL /E /c

這樣檔案就會copy到x:\GAC_MSIL\

然後把兩個資源檔copy到你網頁專案的bin\裡面就可以

3. ReportViewer 2008寫程式修改
以下程式碼在MSDN有

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Microsoft.Reporting.WebForms;
namespace WebReport
{
public class ReportViewerMessagesZhtw : IReportViewerMessages
{
IReportViewerMessages Members#region IReportViewerMessages Members
public string BackButtonToolTip
{
get { return ("後退"); }
}
public string ChangeCredentialsText
{
get {return ("更改"); }
}
public string ChangeCredentialsToolTip
{
get { return ("ChangeCredentialsToolTip."); }
}
public string CurrentPageTextBoxToolTip
{
get { return ("當前頁"); }
}
public string DocumentMap
{
get { return ("文件地圖"); }
}
public string DocumentMapButtonToolTip
{
get { return ("文件地圖"); }
}
public string ExportButtonText
{
get { return ("匯出"); }
}
public string ExportButtonToolTip
{
get { return ("匯出"); }
}
public string ExportFormatsToolTip
{
get { return ("選擇匯出格式"); }
}
public string FalseValueText
{
get { return ("不正確的值"); }
}
public string FindButtonText
{
get { return ("尋找"); }
}
public string FindButtonToolTip
{
get { return ("尋找"); }
}
public string FindNextButtonText
{
get { return ("尋找下一筆"); }
}
public string FindNextButtonToolTip
{
get { return ("尋找下一筆"); }
}
public string FirstPageButtonToolTip
{
get { return ("第一頁"); }
}
public string InvalidPageNumber
{
get { return ("無效的頁數"); }
}
public string LastPageButtonToolTip
{
get { return ("最後一頁"); }
}
public string NextPageButtonToolTip
{
get { return ("下一頁"); }
}
public string NoMoreMatches
{
get { return ("沒有匹配"); }
}
public string NullCheckBoxText
{
get { return ("空值"); }
}
public string NullValueText
{
get { return ("空值"); }
}
public string PageOf
{
get { return ("/"); }
}
public string ParameterAreaButtonToolTip
{
get { return ("參數設定"); }
}
public string PasswordPrompt
{
get { return ("PasswordPrompt"); }
}
public string PreviousPageButtonToolTip
{
get { return ("上一頁"); }
}
public string PrintButtonToolTip
{
get { return ("列印"); }
}
public string ProgressText
{
get { return ("正在生成報表"); }
}
public string RefreshButtonToolTip
{
get { return ("刷新"); }
}
public string SearchTextBoxToolTip
{
get { return ("尋找"); }
}
public string SelectAValue
{
get { return ("SelectAValue"); }
}
public string SelectAll
{
get { return ("全選"); }
}
public string SelectFormat
{
get { return ("選擇格式"); }
}
public string TextNotFound
{
get { return ("未找到"); }
}
public string TodayIs
{
get { return ("TodayIs"); }
}
public string TrueValueText
{
get { return ("TrueValueText"); }
}
public string UserNamePrompt
{
get { return ("UserNamePrompt"); }
}
public string ViewReportButtonText
{
get { return ("查看報表"); }
}
public string ZoomControlToolTip
{
get { return ("縮放"); }
}
public string ZoomToPageWidth
{
get { return ("頁寬"); }
}
public string ZoomToWholePage
{
get { return ("整頁"); }
}
#endregion
}
}

然後要修改web.config的設定


因為我只有用到方法2就搞定了,方法3沒試過,有試過的人就說一下行不行吧

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s