0
の編集日付フォーマットは、2008年のCrystal Reports 2008:C#:クリスタルを使用してC#.NETで、私は、実行時にレポートを変更していますフライ
私はトラブル日付フィールドの書式を変更することを抱えているレポートします。 DateFieldFormatオブジェクトにアクセスしてプロパティを変更しましたが、SystemDefaultTypeプロパティだけが影響を受けるようです。
Visual Report Designerで日付形式を設定した場合、DateFieldObjectの形式の詳細がわかりますが、これらの値を編集しても表示されたレポートには何の影響もありません。
使用してステートメント:ここで
は、私が使用しているコードのサンプルですusing CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.ReportAppServer.Controllers;
using CrystalDecisions.ReportAppServer.DataDefModel;
using CrystalDecisions.ReportAppServer.ReportDefModel;
using CrystalDecisions.ReportAppServer.CommonObjectModel;
using CrystalDecisions.ReportAppServer.ObjectFactory;
コード:私はについて何かを欠けていると仮定してい
public Form1()
{
InitializeComponent();
CrystalDecisions.CrystalReports.Engine.ReportDocument reportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
ISCDReportClientDocument reportClientDocument;
// Load Report
reportDocument.Load(@"C:\myReport.rpt");
reportClientDocument = reportDocument.ReportClientDocument;
// Access Field
FieldObject fieldObject = (FieldObject)reportClientDocument.ReportDefinition.DetailArea.Sections[0].ReportObjects["DateField1"];
// These work, if I want to use one of the default formats
// fieldObject.FieldFormat.DateFormat.SystemDefaultType = CrDateSystemDefaultTypeEnum.crDateSystemDefaultTypeUseLongDate;
// fieldObject.FieldFormat.DateFormat.SystemDefaultType = CrDateSystemDefaultTypeEnum.crDateSystemDefaultTypeUseShortDate;
// I don't want to use one of the defaults.
fieldObject.FieldFormat.DateFormat.SystemDefaultType = CrDateSystemDefaultTypeEnum.crDateSystemDefaultTypeNotUsingDefaults;
// I want to change the order of the values
fieldObject.FieldFormat.DateFormat.DateOrder = CrDateOrderEnum.crDateOrderDayMonthYear;
// Display the report in the viewer
crystalViewer.ReportSource = rpt.rcd.ReportSource;
}
オブジェクトモデルはここにありますが、私はそれに対する良い参照を見つけることができません。誰かが私を助けることができますか?
ありがとうございます!
これを使用して、修正されたフィールドをレポートに適用する必要があります。私はこれを持っていたと思いますが、上記のコードにそれを含めるのを忘れてしまいました。私はそれを解決したが、他にも欠けているものがあったと思う。 - ありがとう! – theo