Local report line return appended problem RRS feed

  • Question

  • Hi,
    We have a rendering problem when rendering in Word format using a local report (calling Microsoft.Reporting.WinForms.LocalReport.Render). The problem occurs when the HTML markup type is specified inside a Textbox: an extra line return is appended to the text that’s displayed. This creates vertical alignment problems inside tables. When rendering PDF the problem does not occur.
    We also encountered this problem (but not in all cases) when remote processing on SQL Server 2008, but it does not seem to occur for remote processing on SQL Server 2008 R2. 
    Is there any way we can stop this rendering bug from occurring, without using remote processing? We would really prefer not to use remote processing  as we have everything already set up for local processing using object data sources;  it would mean significant work to expose the object data sources we’ve developed for our reports as web services. 
    Is there any way we could have the local report render to Word using the same Word rendering engine as used by Reporting Service 2008 R2 servers?
    I wondered which forum to post this to query to. I wondered about “SQL Server Reporting Services”, but decided to try “Visual Studio Report Controls”.  Please move this post if it isn’t in the correct forum.
    Instructions follow for a test case in VS 2010 which replicates the bug. 
    1. Create a new Reports Application project in VS 2010 (New Project, Installed Templates, Visual C#, Reporting)
    2. Cancel the wizard that’s launched, and delete all project files except Program.cs and Report1.rdlc.
    3. Replace the code in Program.cs with the C# code below.
    4. Replace the XML in Report1.rdlc with the report definition below.
    5. Run the project (Ctrl F5 for instance). The project will render the test case as a PDF and as a Word document. The box surrounding the text in the PDF document surrounds one line of text (correct) whereas in the Word document the box surrounds two lines (bug).
    Thanks for any help.
    Code for Program.cs:
    using System;
    namespace ReportsApplication1
        static class Program
            static void Main()
    		public static byte[] RenderWordBugTestCase(string format)
    			var localReport = new Microsoft.Reporting.WinForms.LocalReport();
    			string mimeType, encoding, fileNameExtension;
    			string[] streams;
    			Microsoft.Reporting.WinForms.Warning[] warnings;
    			return localReport.Render(format, null, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
    	public static class Extensions {
    		internal static void CallWord(this byte[] bytes)
    			var path = System.IO.Path.Combine(
    			System.IO.File.WriteAllBytes(path, bytes);
    		internal static void CallAcrobat(this byte[] bytes)
    			var path = System.IO.Path.Combine(
    			System.IO.File.WriteAllBytes(path, bytes);

    Code for Report1.rdlc:
    <?xml version="1.0" encoding="utf-8"?>
    <Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition">
        <DataSource Name="DataSource">
            <ConnectString>/* Local Connection */</ConnectString>
          <Textbox Name="Textbox1">
                    <Value>="&lt;span style=""font-weight:bold""&gt;test&lt;/span&gt; case"</Value>
                    <Style />
                <Style />
        <Style />
        <Style />

    Don't code: play go instead.
    Monday, October 3, 2011 2:37 PM