在C#中动态更改Crystal Report的横向方向

时间:2019-05-22 10:06:21

标签: c# visual-studio crystal-reports

如何在c#中将水晶报表的方向更改为“横向”?我使用的是纵向的水晶报表。

我已安装“ CRforVS_13_0_21.exe”,并且使用Visual Studio 2017社区。 我有以下代码:

ReportDocument cryRpt = new ReportDocument();
string path = "../../crClientes.rpt"; // Is in portrait orientation
cryRpt.Load(path);
cryRpt.SetParameterValue("txtNombreCli", oCliente.sNombre); // Name of parameter field and value of it by variable
cRVClientes2.ReportSource = cryRpt;

我尝试了在论坛上看到的许多代码,例如:

ReportDocument cryRpt = new ReportDocument();
string path = "../../crClientes.rpt"; // Is in portrait orientation
cryRpt.Load(path);
cryRpt.SetParameterValue("txtNombreCli", oCliente.sNombre); // Name of parameter field and value of it by variable
cryRpt.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
cRVClientes2.ReportSource = cryRpt;

ReportDocument cryRpt = new ReportDocument();
string path = "../../crClientes.rpt"; // Is in portrait orientation
cryRpt.Load(path);
cryRpt.SetParameterValue("txtNombreCli", oCliente.sNombre); // Name of parameter field and value of it by variable
cryRpt.PrintOptions.PaperSource = PaperSource.Auto;
cryRpt.PrintOptions.PaperSize = PaperSize.DefaultPaperSize;
cryRpt.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
cRVClientes2.ReportSource = cryRpt;

但是没有人可以使用,仅当我在报表设计中更改方向时才可以使用。右键单击--->设计--->页面设置--->方向-> LandScape格式。 但是我需要知道如何通过代码动态更改它。 谢谢。

0 个答案:

没有答案
相关问题