我向 Stimulsoft 设计器添加了图像。我想设置动态调整大小和cangrow。还将页面报告的大小更改为 a5 或 a4。我该如何解决这个问题?
@Html.StiNetCoreViewer(new StiNetCoreViewerOptions()
{
//Width = Unit.Pixel(794),
//Height = Unit.Pixel(1123),
//setPageFormat(200, 500, PageOrientation.PORTRAIT),
Theme = Stimulsoft.Report.Web.StiViewerTheme.Office2013WhiteBlue,
Localization = "Localization/fa.xml",
Actions =
{
GetReport = "Print",
ViewerEvent = "ViewerEvent",
},
Appearance =
{
RightToLeft=true,
PageAlignment=Stimulsoft.Report.Web.StiContentAlignment.Center,
BackgroundColor = System.Drawing.Color.White,
PageBorderColor = System.Drawing.Color.Blue,
ShowPageShadow = true,
ScrollbarsMode = true,
// InterfaceType = Stimulsoft.Report.Web.StiInterfaceType.Auto
},
Exports =
{
ShowExportToDbf = false,
ShowExportToDif = false,
ShowExportToHtml= false,
ShowExportToPowerPoint=false,
ShowExportToCsv=false,
ShowExportToDocument = false,
ShowExportToExcel2007= false,
ShowExportToImageBmp=false,
ShowExportToRtf=false,
ShowExportToImageSvgz=false,
},
})
我用以下代码解决了这个问题:
foreach (StiPage page in report.Pages)
{
page.Orientation = StiPageOrientation.Portrait;
page.Margins.Top = 0;
page.Margins.Bottom = 0;
page.Margins.Left = 0;
page.Margins.Right = 0;
page.PaperSize = System.Drawing.Printing.PaperKind.A4;
}
StiReport report = new StiReport();
var image = report.GetComponentByName("Image1") as StiImage;
image.CanGrow = false ;
image.Width = 120;