次の方法で共有


_Application3.FormatString メソッド

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

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

構文

'宣言
<DispIdAttribute(7)> _
Function FormatString ( _
    <InAttribute> varInput As Object, _
    <InAttribute> bstrCategory As String, _
    <InAttribute> bstrOptions As String _
) As String
'使用
Dim instance As _Application3
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 (
    [InAttribute] Object varInput,
    [InAttribute] string bstrCategory,
    [InAttribute] string bstrOptions
)

パラメータ

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

戻り値

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

コメント

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

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

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

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

関連項目

参照

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