English 中文(简体)
SSRS2008:向超文本/碎块出口当地报告
原标题:SSRS2008: LocalReport export to HTML / fragment
  • 时间:2010-01-27 10:37:26
  •  标签:
  • ssrs-2008
问题回答

I found a way, but it s not very good. Export report to mhtml (it s supported by SSRS2008) Then use System.Windows.Forms.WebBrowser for render mhtml. In wb.DocumentText property will be full html page.

It s not very good, because you need a file (as url for WebBrowser). And also, if I use WebBrowser in ASP.NET application, I need to process it in another thread, with STA ApartmentState.

寻找同样的东西。 我恳请我相信,我们会试图以某种反思的方式抓住报告已取得的成果?

我也许会同它一道,看看我可以做些什么。

如果你能够拿到 m,你可以将其内容摘到MIMER

There is a nu-get package here (MIMER will require .NET Framework 3.5):
https://www.nuget.org/packages/MIMER/

using System;
using System.Collections.Generic;
using System.Windows.Forms;


using MIMER;


namespace MimerTest
{


    // https://github.com/smithimage/MIMER/blob/master/MIMERTests/MHT/MhtTests.cs
    // https://github.com/smithimage/MIMER/
    static class Program
    {



        /// <summary>
        /// Der Haupteinstiegspunkt für die Anwendung.
        /// </summary>
        [STAThread]
        static void Main()
        {
            if (false)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            }


            System.IO.Stream m_Stream;
            string path = @"d:USERNAMEdocumentsvisual studio 2013ProjectsMimerTestMimerTestwhatismht.mht";

            System.IO.FileInfo finf = new System.IO.FileInfo(path);
            m_Stream = new System.IO.FileStream(path, System.IO.FileMode.Open, System.IO.FileAccess.Read);

            var reader = new MIMER.RFC2045.MailReader();
            MIMER.IEndCriteriaStrategy endofmessage = new MIMER.RFC2045.BasicEndOfMessageStrategy();
            var message = reader.ReadMimeMessage(ref m_Stream, endofmessage);

            System.Collections.Generic.IDictionary<string,string> allContents = message.Body;

            string strFile = allContents["text/html"];


            foreach (System.Collections.Generic.KeyValuePair<string,string> kvp in allContents)
            {
                System.Console.WriteLine(kvp.Key);
                System.Console.WriteLine(kvp.Value);
            }



            System.Console.WriteLine(" --- Press any key to continue --- ");
            System.Console.ReadKey();
        }
    }
}

在2005年报告《意见书》中,可以通过思考实现超文本:

private static void EnableFormat(ReportViewer viewer, string formatName)
{
     const BindingFlags Flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance;

     FieldInfo m_previewService = viewer.LocalReport.GetType().GetField
     (
         "m_previewService",
         Flags
     );

     MethodInfo ListRenderingExtensions = m_previewService.FieldType.GetMethod
     (
         "ListRenderingExtensions",
         Flags
     );

     object previewServiceInstance = m_previewService.GetValue(viewer.LocalReport);

     IList extensions = ListRenderingExtensions.Invoke(previewServiceInstance, null) as IList;

     PropertyInfo name = extensions[0].GetType().GetProperty("Name", Flags);

     foreach (object extension in extensions)
     {
         if (string.Compare(name.GetValue(extension, null).ToString(), formatName, true) == 0)
         {
             FieldInfo m_isVisible = extension.GetType().GetField("m_isVisible", BindingFlags.NonPublic | BindingFlags.Instance);
             FieldInfo m_isExposedExternally = extension.GetType().GetField("m_isExposedExternally", BindingFlags.NonPublic | BindingFlags.Instance);
             m_isVisible.SetValue(extension, true);
             m_isExposedExternally.SetValue(extension, true);
             break;
         }
     }
 }

使用:

var Viewer = new Microsoft.Reporting.WebForms.ReportViewer();
EnableFormat(Viewer, "HTML4.0");

您也可以认为这一点令人感兴趣:

http://www.codeproject.com/Articles/239Report-Viewer-generate-reports-MS-Word-formats





相关问题
Splitting flat data row into groupings

I have a stored procedure that returns hierarchical data in a single long row, for example: ContractID | ContractName | AssetID | AssetName | UnitID -----------+--------------+---------+-----------+--...

SSRS 2008 Access from Desktop PC

I have an instance of SQL Server 2008 and SSRS 2008 running on a desktop PC for to be used for development. This PC is registered under my user id and I can remote desktop into it and connect to SSRS ...

Reporting Services - get data into subreports

I m tasked with reporting on survey data using Reporting Services 2008. My challenge is this: a survey has any number of questions a question is one of three types (a numerical eval, a yes/no ...

热门标签