简体   繁体   English

水晶报表Blob栏位原始大小

[英]Crystal reports blob field original size

I am inserting an image in the crystal report by dragging a field of type picture from the database fields. 我正在通过从数据库字段中拖动图片类型的字段来在Crystal报表中插入图像。 The image is inserted as a blob field with a default (original) size even though in the database the image can have different sizes. 即使在数据库中图像可以具有不同的大小,也将以默认(原始)大小的斑点字段插入图像。 The problem is that the image does not preserve its original size. 问题在于图像不能保留其原始大小。 Is there a way how specify the original size of the image in crystal reports? 有没有一种方法可以在Crystal报表中指定图像的原始大小?

Crystal report will not auto- re-size the image. Crystal Reports不会自动调整图像大小。 So better to set the original size in Crystal report 因此最好在Crystal报表中设置原始大小

try this code in c#: 在C#中尝试以下代码:

        CRAXDRT.Report report1 = new CRAXDRT.Report();
        CRAXDRT.Application app = new CRAXDRT.Application();
        report1 = app.OpenReport("YorReport.rpt", OpenReportMethod.OpenReportByDefault);
        for (int i = 1; i < report1.Sections.Count + 1; i++)
        {
            for (int j = 1; j < report1.Sections[i].ReportObjects.Count + 1; j++)
            {
                try
                {
                    CRAXDRT.BlobFieldObject t1 = (CRAXDRT.BlobFieldObject)report1.Sections[i].ReportObjects[j];
                    if (t1.Name == "YourBlobFieldName")
                    {
                        t1.Height = 200;
                        t1.Width = 200;
                    }
                }
                catch (Exception) { }
            }
        }

Check the Can Grow checkbox for the BLOB field. 选中BLOB字段的Can Grow复选框。 That will auto size the field by image's original size. 这将根据图像的原始大小自动调整字段大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM