0

アプリケーションに rdlcレポートがあり、ペルシャの日付を表示する式を使用したいのですが、式が見つからないという問題がありrdlcます。ファイル内のレポートにペルシャの日付を表示する方法はありますか?

4

3 に答える 3

3

rdlc レポートの [レポート] メニューで [レポート プロパティ] を選択し、[コード] タブに移動して、VB でグルジアの日付をペルシャ (ジャラリ) カレンダーに変換するカスタム メソッドの作成を開始します。(カスタム コードでは、VB でしかコードを記述できないことに注意してください!) その後、レポートにテキスト ボックスを追加し、次のような式を記述します: =Code.GetPersianDate(Fields!Date.Value)

which Date はデータセット内の列であり、明らかに GetPersianDate はメソッドの名前です。

http://ilood.com/?i=ObwcXTETQTY=のおかげ
で本当に助かりました。

于 2015-12-26T17:42:12.467 に答える
2

このコードを [レポート プロパティ] の [コード] タブにコピーします

Public Function   GetPersianDate(dtGeorgian as DateTime) as string
    dim  strPersianDate  as string
    dim  strYear as string
    dim strMonth as string
    dim strDay as string
    dim objPersiancal as System.Globalization.PersianCalendar
    objPersiancal = new System.Globalization.PersianCalendar()
    if(dtGeorgian =Nothing) then
    return string.empty
    end if

    strYear = objPersiancal.GetYear(dtGeorgian).ToString()
    strMonth = objPersiancal.GetMonth(dtGeorgian).ToString()
    strDay = objPersiancal.GetDayOfMonth(dtGeorgian).ToString()
    if (strDay.Length < 2) then strDay = "0" + strDay
    if (strMonth.Length < 2)  then strMonth = "0" + strMonth
    strPersianDate = strYear + "/" + strMonth + "/" + strDay
    return strPersianDate
End Function

必要なテキストボックスで右クリックして式を選択し、このコードをその式の前に追加します。 =Code.GetPersianDate()

注: 前の式は括弧内にある必要があります。

于 2017-02-22T08:56:43.343 に答える