次の方法で共有


_Application2.FormatString メソッド

指定されたカテゴリとオプションのパラメータに従って、指定された文字列または XML ノードの書式を設定します。

このメソッドは、CLS に準拠していません。  

名前空間: Microsoft.Office.Interop.InfoPath.SemiTrust
アセンブリ: Microsoft.Office.Interop.InfoPath.SemiTrust (microsoft.office.interop.infopath.semitrust.dll 内)

構文

'宣言
<DispIdAttribute(7)> _
Function FormatString ( _
    varInput As Object, _
    bstrCategory As String, _
    bstrOptions As String _
) As String
'使用
Dim instance As _Application2
Dim varInput As Object
Dim bstrCategory As String
Dim bstrOptions As String
Dim returnValue As String

returnValue = instance.FormatString(varInput, bstrCategory, bstrOptions)
[DispIdAttribute(7)] 
string FormatString (
    Object varInput,
    string bstrCategory,
    string bstrOptions
)

パラメータ

  • varInput
    書式設定する値または XML ノード。
  • bstrCategory
    書式設定に使用するカテゴリを指定する値。値には、数値、パーセント、通貨、日付、時刻、および日時が含まれます。
  • bstrOptions
    書式設定に使用するオプションを指定する値。"optionName:value" の形式の文字列で、大文字と小文字が区別されます。

戻り値

指定されたカテゴリとオプションのパラメータに従って書式設定された string

コメント

どこでも必要な場所で FormatString メソッドを使用して、指定した文字列の書式を変更できます。アプリケーション名で修飾する必要があり、戻り値は、変数に代入するか、または文字列値が必要な式として使用する必要があります。

以下では、bstrCategory および bstrOptions に対して使用できる値を示します。

次の例では、Application オブジェクトの FormatString メソッドを使用して、指定した日付文字列を長い日付の書式に設定しています。

thisApplication.FormatString("2003-01-08", "date", "dateFormat:Long Date");

関連項目

参照

_Application2 インターフェイス
_Application2 のメンバ
Microsoft.Office.Interop.InfoPath.SemiTrust 名前空間