ReportDocument.SetCSSClass メソッド
さまざまなセクションやレポート オブジェクトのカスケード スタイル シート (CSS) を設定します。スタイル クラスを使用すると、レポートに含まれるオブジェクトとセクションの書式を上書きできます。Web 上でのレポートの書式設定の詳細については、「HTML クラスを使ったレポートの書式設定」を参照してください。
[Visual Basic]
public virtual void SetCSSClass (ObjectScopeobjectScope , String styleClass )
[C#]
public virtual void SetCSSClass (ObjectScopeobjectScope , string styleClass );
[C++]
public virtual void SetCSSClass (ObjectScopeobjectScope , String* styleClass );
[VJ#]
public void SetCSSClass (ObjectScopeobjectScope , string styleClass );
パラメータ
- objectScope
スタイル クラスを適用するレポートの 1 つまたは複数のセクションを示します。たとえば、レポート全体のスタイルを設定したり、レポート ヘッダー セクションのスタイルを設定します。 - styleClass
スタイル シートで定義されているスタイル クラスの名前です。
解説
Crystal Reports Web フォーム ビューアを介して表示されるレポートのスタイル クラスを設定します。スタイル クラスの詳細については、「HTML クラスを使ったレポートの書式設定」を参照してください。
例
次の例は、レポートの詳細セクションのスタイル クラスを設定します。
[Visual Basic]
Private Sub SetReportStyle _
(ByVal styleName As String, ByVal section As String)
Dim scope As New ObjectScope()
' スタイル クラスのスコープ値を設定します。
Select Case (section)
Case "GroupHeader"
scope = _
ObjectScope.AllReportObjectsInGroupHeaderSections
Case "GroupFooter"
scope = _
ObjectScope.AllReportObjectsInGroupFooterSections
Case "Detail"
scope = ObjectScope.AllReportObjectsInDetailSections
Case Else
scope = ObjectScope.AllSections
End Select
' スタイル クラスを設定します。
Report.SetCSSClass(scope, styleName)
End Sub
[C#]
private void SetReportStyle(string styleName, string section)
{
ObjectScope scope = new ObjectScope();
// スタイル クラスのスコープ値を設定します。
switch(section)
{
case "GroupHeader":
scope =
ObjectScope.AllReportObjectsInGroupHeaderSections;
break;
case "GroupFooter":
scope =
ObjectScope.AllReportObjectsInGroupFooterSections;
break;
case "Detail":
scope = ObjectScope.AllReportObjectsInDetailSections;
break;
default:
scope = ObjectScope.AllSections;
break;
}
// スタイル クラスを設定します。
Report.SetCSSClass(scope, styleName);
}
[C++]
void SetReportStyle(String* styleName, char section)
{
ObjectScope scope;
// スタイル クラスのスコープ値を設定します。
switch(section)
{
case 'R'
scope = ObjectScope::AllReportObjectsInReportHeaderSections;
break;
case 'G':
scope = ObjectScope::AllReportObjectsInGroupHeaderSections;
break;
case 'D':
scope = ObjectScope::AllReportObjectsInDetailSections;
break;
default:
scope = ObjectScope::AllSections;
break;
};
// スタイル クラスを設定します。
Report->SetCSSClass(scope, styleName);
};
[VJ#]
private void SetReportStyle(String styleName, String section)
{
ObjectScope scope = new ObjectScope();
// スタイル クラスのスコープ値を設定します。
if (section == "GroupHeader")
{
scope = ObjectScope.AllReportObjectsInGroupHeaderSections;
}
else if (section == "GroupFooter")
{
scope = ObjectScope.AllReportObjectsInGroupFooterSections;
}
else if (section == "Detail")
{
scope = ObjectScope.AllReportObjectsInDetailSections;
}
else
{
scope = ObjectScope.AllSections;
}
// スタイル クラスを設定します。
Report.SetCssClass(scope, styleName);
}
要件
名前空間 :CrystalDecisions.CrystalReports.Engine
プラットフォーム : Windows 98、Windows NT 4.0、Windows Millennium Edition、Windows 2000、Windows XP
関連項目
ReportDocument クラス | ReportDocument メンバ | CrystalDecisions.CrystalReports.Engine 名前空間