TextObject 類別
代表報表中出現的文字物件。這個物件提供屬性與方法,以擷取資訊並設定報表中文字物件的選項。
如需這個類型所有成員的清單,請參閱 TextObject 成員。
TextObject
[Visual Basic]
Public Class TextObject
Inherits ReportObject
[C#]
public class TextObject : ReportObject
[C++]
__gc public class TextObject : public ReportObject
[VJ#]
public class TextObject extends ReportObject
註解
透過 ReportObjects 集合的 Item 屬性依索引或名稱來擷取 ReportObject 物件,並將 ReportObject 轉換為 TextObject。
範例
下列範例會傳回 TextObject 物件。
[Visual Basic]
Private Function GetTextObject _
(ByVal reportObjectName As String) As TextObject
Dim text As TextObject
' 依名稱取得 ReportObject,將之轉換為 TextObject,
' 然後將它傳回來。
If TypeOf _
(Report.ReportDefinition.ReportObjects. _
Item(reportObjectName)) Is TextObject Then
text = _
Report.ReportDefinition.ReportObjects. _
Item(reportObjectName)
GetTextObject = text
Else : GetTextObject = Nothing
End If
End Function
[C#]
private TextObject GetTextObject
(string reportObjectName)
{
TextObject text;
// 依名稱取得 ReportObject,將之轉換為 TextObject,
// 然後將它傳回來。
text = Report.ReportDefinition.ReportObjects[reportObjectName]
as TextObject;
if (text != null) return text;
else return null;
}
[C++]
TextObject* GetTextObject(String* reportObjectName)
{
TextObject* text;
// 依名稱取得 TextObject,將之轉換為 TextObject,
// 然後將它傳回來。
try
{
text = __try_cast<TextObject*>
(Report->ReportDefinition->
ReportObjects->Item[reportObjectName]);
return text;
}
catch(System::InvalidCastException*)
{
return 0;
}
};
[VJ#]
private TextObject GetTextObject
(String reportObjectName)
{
TextObject text;
// 依名稱取得 ReportObject,將之轉換為 TextObject,
// 然後將它傳回來。
text = (TextObject) Report.get_ReportDefinition().get_ReportObjects().get_Item(reportObjectName);
if (text != null) return text;
else return null;
}
需求
命名空間:CrystalDecisions.CrystalReports.Engine
**平台:**Windows 98、Windows NT 4.0、Windows Millennium Edition、Windows 2000
**組件:**CrystalDecisions.Crystalreports.Engine (CrystalDecisions.Crystalreports.Engine.dll)