简体   繁体   English

SSRS报告服务器使用C#将报告发送到Web客户端

[英]SSRS Report Server sending report to web client using C#

https://msdn.microsoft.com/en-us/library/ms252172.aspx

I am using the render method from that article 我正在使用该文章中的render方法

public void Render(
    string format,
    string deviceInfo,
    CreateStreamCallback createStream,
    out Warning[] warnings
)

The render method calls the CreateStream 渲染方法调用CreateStream

private Stream CreateStream(string name, string fileNameExtension, 
      Encoding encoding, string mimeType, bool willSeek)
    {
        Stream stream = new FileStream(name + "." + fileNameExtension, 
          FileMode.Create);
        m_streams.Add(stream);
        return stream;
    }

m_streams = new List<Stream>();
report.Render("Image", deviceInfo, CreateStream, out warnings);

foreach (Stream stream in m_streams)
  stream.Position = 0;

If i want the CreateStream method to write a http response object using chunk's how can i achieve it ? 如果我希望CreateStream方法使用块的方式写一个http响应对象,我如何实现它?

what does the foreach method do here apart from iteration why does it set the stream.Position to 0 ? 除了迭代之外,这里的foreach方法还做什么?为什么将stream.Position设置为0?

Since the report.Render method returns a void and makes a callback to CreateStram and if the image is huge how do i loop over the chunks and return the binary chunks to http response object ? 由于report.Render方法返回一个void并向CreateStram进行回调,如果图像很大,我如何遍历这些块并将二进制块返回到http响应对象?

You can do anything with the results from RenderStream as byte[], right. 您可以使用RenderStream的结果作为byte []做任何事情,对。 I don't know why the position is set to 0 above however, you could write the image to a temp folder, for example: 我不知道为什么将位置设置为上面的0,但是,您可以将图像写入临时文件夹,例如:

var image = _service.RenderStream("HTML4.0", streamID, null, out imageEncoding, out mimeType);
File.WriteAllBytes(Path.Combine(_physicalTempFolder,streamID),image);

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

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