图像未在sql rdlc报告中显示

时间:2018-06-14 15:42:15

标签: c# .net sql-server rdlc reportviewer

我正在使用一个sql报告rdlc文件生成一个pdf,但图像根本没有显示在我使用file://属性但是图像仍然没有显示在打印机输出中。

if (headers.Count == 1 && items.Count == 1)
{

    QCObject obj = new QCObject();
    obj.ProductCode = headers.First.StockCode;
    obj.ProductDescription = headers.First.StockDescription;
    obj.ProductWeight = stockItems.First.Weight.ToString();
    obj.LogoURL = "file:///" + Properties.Settings.Default.LogoRepo + "";
    obj.DrawingURL = "@file:///C:\\xxxx\\Images\\" + headers.First.StockCode + ".jpg";
    obj.BarcodeValue = "*" + _selectedItem.ProductionPlanItemID.ToString() + "*";
    obj.BoxReference = items.First.StockCode;
    obj.DateOfPrint = DateTime.Now;

    List<QCObject> list = new List<QCObject>();
    list.Add(obj);

    for (int i = 1; i <= qtyToConfirm; i++)
    {
        using (var print = new PrintQC(list))
        {
            print.Run();
        }
}

我的上述

的打印命令

我想知道我是否需要在报告中以某种方式嵌入图像,这些是由第三方程序管理的图像,我正在使用代码来提取它。

    private void Print()
    {
        ProcessStartInfo info = new ProcessStartInfo();
        info.Verb = "print";
        var path = System.Windows.Forms.Application.StartupPath;
        info.FileName = Path.Combine(path, @"Reporting\BoxLabel.pdf");
        info.CreateNoWindow = true;
        info.WindowStyle = ProcessWindowStyle.Hidden;

        Process p = new Process();
        p.StartInfo = info;
        p.Start();

        p.WaitForInputIdle();
        System.Threading.Thread.Sleep(3000);
        if (false == p.CloseMainWindow())
            p.Kill();


    }


 // Create a local report for Report.rdlc, load the data,
 //    export the report to an .emf file, and print it.
 public void Run()
 {
        LocalReport report = new LocalReport();

        var path = System.Windows.Forms.Application.StartupPath;
        log.Info(Path.Combine(path, @"Reporting\QCLabelV2.rdlc"));
        report.ReportPath = Path.Combine(path, @"Reporting\QCLabelV2.rdlc"); 
        report.EnableExternalImages = true;

        report.DataSources.Clear();
        report.DataSources.Add(new ReportDataSource("dsList", LoadSalesData()));
        report.Refresh();
        log.Info("Finished Refresh");
        Export(report);
        log.Info("Export Complete");
        Print();
        log.Info("Print Complete");
    }

0 个答案:

没有答案