如何在stimulsoft mvc core中将图像大小设置为动态?

问题描述 投票:0回答:1

我向 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,
        },
  

})
asp.net-core-mvc stimulsoft
1个回答
0
投票

我用以下代码解决了这个问题:

 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;
© www.soinside.com 2019 - 2024. All rights reserved.