none
Programmatically Set ReportViewer Page Size RRS feed

  • Question

  • After spending hours with the ReportViewer (VS Standard 2008) and the forums it seems that there is no way to programmatically change a report's default page size and margins.  Suppose the program will be used worldwide.  Is the only solution for the user to have to reselect the paper size, orientation and margins every time they want to print a report if those items differ from the default?  There has to be a way to do this.  I see some talk about a fix.  Has anything been done?  Alternatively, is there another option to ReportViewer besides writing a custom report?
    Tuesday, March 10, 2009 8:53 PM

Answers

  • Usage:


    PrintDocument printDoc;     
        
        
    SizeF sizePAge = new SizeF((float)printDoc.DefaultPageSettings.Bounds.Width,     
                                float)printDoc.DefaultPageSettings.Bounds.Height);     
    PointF pointMarginsLT = new PointF((float)printDoc.DefaultPageSettings.Margins.Left,     
                                       (float)printDoc.DefaultPageSettings.Margins.Top);     
        
    PointF pointMarginsRB = new PointF((float)printDoc.DefaultPageSettings.Margins.Right,     
                                       (float)printDoc.DefaultPageSettings.Margins.Bottom);     
        
        
    ReportViewerHelper reportHelper = new ReportViewerHelper(sXMLData);     
        
    reportHelper.SetPageSize(sizePage, pointMarginsLT, pointMarginsRB);     
        
    //Change the report here with the helper     
        
    oReportView.LocalReport.LoadReportDefinition(reportHelper).GetReport();     
        
        
    //For sub reports     
        
    ReportViewerHelper reportsubHelper = new ReportViewerHelper(sXMLDataSub);     
        
    //Change the report here with the helper     
        
    oReportView.LocalReport.LoadSubreportDefinition(sReportName, reportsubHelper.GetReport());  
    • Marked as answer by randywheeler Wednesday, March 11, 2009 11:23 PM
    Wednesday, March 11, 2009 2:23 AM

All replies

  • I started thinking since the rdlc is simply an Xml file is it feasible to update the file with data entered in a regular page setup dialog?
    Tuesday, March 10, 2009 10:07 PM
  • I have done this with my own helper class to update the xml of the report.  It can also resize all the report items.

    I can post it if you like.
    Wednesday, March 11, 2009 12:54 AM
  • Please and thank you.  I can update the xml but am having trouble getting the report update to use the change.
    Wednesday, March 11, 2009 1:00 AM
  • Usage:


    PrintDocument printDoc;     
        
        
    SizeF sizePAge = new SizeF((float)printDoc.DefaultPageSettings.Bounds.Width,     
                                float)printDoc.DefaultPageSettings.Bounds.Height);     
    PointF pointMarginsLT = new PointF((float)printDoc.DefaultPageSettings.Margins.Left,     
                                       (float)printDoc.DefaultPageSettings.Margins.Top);     
        
    PointF pointMarginsRB = new PointF((float)printDoc.DefaultPageSettings.Margins.Right,     
                                       (float)printDoc.DefaultPageSettings.Margins.Bottom);     
        
        
    ReportViewerHelper reportHelper = new ReportViewerHelper(sXMLData);     
        
    reportHelper.SetPageSize(sizePage, pointMarginsLT, pointMarginsRB);     
        
    //Change the report here with the helper     
        
    oReportView.LocalReport.LoadReportDefinition(reportHelper).GetReport();     
        
        
    //For sub reports     
        
    ReportViewerHelper reportsubHelper = new ReportViewerHelper(sXMLDataSub);     
        
    //Change the report here with the helper     
        
    oReportView.LocalReport.LoadSubreportDefinition(sReportName, reportsubHelper.GetReport());  
    • Marked as answer by randywheeler Wednesday, March 11, 2009 11:23 PM
    Wednesday, March 11, 2009 2:23 AM
  •  It can change the page size and resize all the controls, you can control the way the control resize by adding ScaleLeft, ScaleTop, ScaleHeight and/or HeightFull in the Label field of a report item.  Also you can change the font on all items and replace sections like the header, footer and emdedded images.

    Helper Class Part 1

    using System;     
    using System.IO;     
    using System.Drawing;     
    using System.Xml;     
    using System.Globalization;     
        
        
    namespace trustorm     
    {     
        //NOTE: Unit of measure is cm     
             
        public class ReportViewerHelper     
        {     
            private XmlDocument oXmlDoc;     
        
            const double dCM2Inches = 2.54000000d;     
        
        
            private SizeF sizePage;     
            private SizeF sizeReport;     
            private PointF pointMarginsLT;     
            private PointF pointMarginsRB;     
        
        
            private SizeF sizePageOld;     
            private PointF pointMarginsLTOld;     
            private PointF pointMarginsRBOld;     
            private SizeF sizeReportOld;     
                       
        
            private NumberFormatInfo oNumInfo;     
        
        
            public SizeF PageSize     
            {     
                get { return sizePage; }     
                set { sizePage = value; }     
            }     
        
            public SizeF ReportSize     
            {     
                get { return sizeReport; }     
                set { sizeReport = value; }     
            }     
        
            public PointF MarginsLT     
            {     
                get { return pointMarginsLT; }     
                set { pointMarginsLT = value; }     
            }     
        
            public PointF MarginsRB     
            {     
                get { return pointMarginsRB; }     
                set { pointMarginsRB = value; }     
            }     
        
        
            public ReportViewerHelper(string sXMLData)     
            {     
                oXmlDoc = new XmlDocument();     
        
                oXmlDoc.LoadXml(sXMLData);     
        
                //Need to create a custom format due to other cultures      
                this.oNumInfo = new NumberFormatInfo();     
        
                this.oNumInfo.NumberDecimalSeparator = ".";     
                this.oNumInfo.CurrencyDecimalDigits = 2;     
                this.oNumInfo.CurrencyDecimalSeparator = ".";     
                this.oNumInfo.NegativeSign = "-";     
                this.oNumInfo.PositiveSign = "";     
        
        
                this.PageSize = new SizeF(0, 0);     
                this.MarginsLT = new PointF(0, 0);     
                this.MarginsRB = new PointF(0, 0);     
        
                this.sizePageOld = new SizeF(0, 0);     
        
                this.pointMarginsLTOld = new PointF(0, 0);     
                this.pointMarginsRBOld = new PointF(0, 0);     
                     
                this.sizeReport = new SizeF(0, 0);     
                this.sizeReportOld = new SizeF(0, 0);     
            }     
        
            public void SetPageSize(SizeF page, PointF marginLT, PointF marginRB)     
            {     
                //Page and Margin are PrinterSettings and in 100th of inch     
                     
                //Convert 100th of inch to cm     
                this.PageSize = new SizeF((float)Math.Round(((double)page.Width / 100) * dCM2Inches, 1),      
                                          (float)Math.Round(((double)page.Height / 100) * dCM2Inches, 1));     
        
        
                this.MarginsLT = new PointF((float)Math.Round(((double)marginLT.X / 100) * dCM2Inches, 2),     
                                                (float)Math.Round(((double)marginLT.Y / 100) * dCM2Inches, 2));     
        
                this.MarginsRB = new PointF((float)Math.Round(((double)marginRB.X / 100) * dCM2Inches, 2),     
                                                (float)Math.Round(((double)marginRB.Y / 100) * dCM2Inches, 2));     
        
                this.ReportSize = new SizeF(this.PageSize.Width - this.MarginsLT.X - this.MarginsRB.X, this.PageSize.Height - this.MarginsLT.Y - this.MarginsRB.Y);     
                    
        
                XmlNode oRoot = oXmlDoc.DocumentElement;     
        
                XmlNode oNode;     
        
                CultureInfo ci = CultureInfo.CurrentCulture;     
        
                //Save the current values for the PageWidht, PageHeight and Margins     
                //Only supports values in CM     
                oNode = GetNode("PageWidth", oRoot);     
                this.sizePageOld.Width = float.Parse(oNode.InnerText.Replace("cm", ""), this.oNumInfo);     
        
                oNode.InnerText = this.PageSize.Width.ToString(".0", this.oNumInfo) + "cm";     
                     
        
                oNode = GetNode("PageHeight", oRoot);     
                this.sizePageOld.Height = float.Parse(oNode.InnerText.Replace("cm", ""), this.oNumInfo);     
        
                oNode.InnerText =  this.PageSize.Height.ToString(".0", this.oNumInfo) + "cm";     
                     
                oNode = GetNode("LeftMargin", oRoot);     
                     
                this.pointMarginsLTOld.X = float.Parse(oNode.InnerText.Replace("cm", ""), this.oNumInfo);     
        
                oNode.InnerText = this.MarginsLT.X.ToString(".0", this.oNumInfo) + "cm";     
                     
                oNode = GetNode("RightMargin", oRoot);     
        
                this.pointMarginsRBOld.X = float.Parse(oNode.InnerText.Replace("cm", ""), this.oNumInfo);     
        
                oNode.InnerText = this.MarginsRB.X.ToString(".0", this.oNumInfo) + "cm";     
                     
        
                oNode = GetNode("TopMargin", oRoot);     
        
                this.pointMarginsLTOld.Y = float.Parse(oNode.InnerText.Replace("cm", ""), this.oNumInfo);     
        
                oNode.InnerText = this.MarginsLT.Y.ToString(".0", this.oNumInfo) + "cm";     
                     
        
                oNode = GetNode("BottomMargin", oRoot);     
                this.pointMarginsRBOld.Y = float.Parse(oNode.InnerText.Replace("cm", ""), this.oNumInfo);     
        
                oNode.InnerText = this.MarginsRB.Y.ToString(".0", this.oNumInfo) + "cm";     
                     
        
                oNode = GetNode("Width", oRoot);     
        
                this.sizeReportOld.Width = float.Parse(oNode.InnerText.Replace("cm", ""), this.oNumInfo);      
                     
                   
                oNode = GetNode("Body", oRoot);     
        
                if (oNode != null)     
                {     
                    oNode = GetNode("Height", oNode);     
        
                    if (oNode != null)     
                    {     
                        this.sizeReportOld.Height = float.Parse(oNode.InnerText.Replace("cm", ""), this.oNumInfo);     
                    }     
                }     
        
            }     
        
            public void SetAllFieldWidth(bool bFixHeight)     
            {     
                XmlNode oRoot = oXmlDoc.DocumentElement;     
                     
        
                XmlNode oNode = GetNode("ReportItems", oRoot, true);     
        
                //Only change items in ReportItems     
                if (oNode != null)     
                {     
                    FixNodeWidth(oNode);     
                }     
        
                if (bFixHeight)     
                {     
                    //Change the design area     
                    SetWidthHeight(GetNode("Width", oRoot), GetNode("Height", oRoot));     
                }     
                else     
                {     
                    //Change the design area     
                    SetWidthHeight(GetNode("Width", oRoot), null);     
                }     
            }     
        
            private void FixNodeWidth(XmlNode oRoot)     
            {     
                //check all nodes for a Width element     
                foreach (XmlNode oNode in oRoot.ChildNodes)     
                {     
                    //Hack to able to also scale item in the middle of the page on the same line     
                    //Set in the Label field to ScaleLeft     
                    XmlNode oNodeLabel = GetNode("Label", oNode);     
        
        
                    if ((oNodeLabel != null) && (oNodeLabel.InnerText.IndexOf("ScaleHeight") != -1))     
                    {     
                        //Change the width and height as a percentage of the orginal     
                        SetWidthHeight(GetNode("Width", oNode), GetNode("Height", oNode));     
                    }     
                    else     
                    {     
                        SetWidthHeight(GetNode("Width", oNode), null);     
                    }     
        
        
                    if ((oNodeLabel != null) && (oNodeLabel.InnerText.IndexOf("ScaleLeft") != -1))     
                    {     
                        //Change the Left as a percentage of the orginal     
                        SetLeft(GetNode("Left", oNode));     
                    }     
        
                    if ((oNodeLabel != null) && (oNodeLabel.InnerText.IndexOf("ScaleTop") != -1))     
                    {     
                        //Change the Left as a percentage of the orginal     
                        SetTop(GetNode("Top", oNode));     
                    }     
        
                    if ((oNodeLabel != null) && (oNodeLabel.InnerText.IndexOf("HeightFull") != -1))     
                    {     
                        //Change the Left as a percentage of the orginal     
                        SetHeightFullPage(GetNode("Top", oNode), GetNode("Height", oNode));     
                    }     
        
        
                    if (oNode.HasChildNodes)     
                    {     
                        FixNodeWidth(oNode);     
                    }     
                }     
            }     
        
            private void SetLeft(XmlNode oNodeWidth)     
            {     
                if (oNodeWidth != null)     
                {     
                    float fNewWidth = GetNewWidth(float.Parse(oNodeWidth.InnerText.Replace("cm", ""), this.oNumInfo));     
        
                    if (fNewWidth > 0)     
                    {     
                        oNodeWidth.InnerText = fNewWidth.ToString(".0", this.oNumInfo) + "cm";         
                    }     
                }     
            }     
        
            private void SetTop(XmlNode oNodeHeight)     
            {     
                if (oNodeHeight != null)     
                {     
                    float fNewHeight = GetNewHeight(float.Parse(oNodeHeight.InnerText.Replace("cm", ""), this.oNumInfo));     
        
        
                    if (fNewHeight > 0)     
                    {     
                        oNodeHeight.InnerText = fNewHeight.ToString(".0", this.oNumInfo) + "cm";     
                    }     
        
                         
                }     
            }    


    Wednesday, March 11, 2009 2:30 AM
  • Part 2
    private void SetWidthHeight(XmlNode oNodeWidth, XmlNode oNodeHeight)     
            {     
                SetLeft(oNodeWidth);     
                SetTop(oNodeHeight);     
            }     
        
            private void SetHeightFullPage(XmlNode oNode, XmlNode oNodeHeight)     
            {     
                if (oNode != null)     
                {     
                    float fCurrent = float.Parse(oNode.InnerText.Replace("cm", ""), this.oNumInfo);     
                         
        
                    float fNew = this.PageSize.Height - fCurrent - this.MarginsLT.Y - this.MarginsRB.Y;     
        
                    if (fNew > 0)     
                    {     
                        oNodeHeight.InnerText = fNew.ToString(".0", this.oNumInfo) + "cm";         
                    }     
                }     
            }     
        
            public SizeF GetItemSize(string sName)     
            {     
                SizeF oSize = new SizeF();     
        
                XmlNode oNode = FindNodeName(sName, GetNode("ReportItems", oXmlDoc.DocumentElement, true));     
        
                XmlNode oNodeWidth = GetNode("Width", oNode);     
                XmlNode oNodeHeight = GetNode("Height", oNode);     
        
                if (oNodeWidth != null)     
                {     
                    oSize.Width = float.Parse(oNodeWidth.InnerText.Replace("cm", ""), this.oNumInfo);     
                }     
        
                if (oNodeHeight != null)     
                {     
                    oSize.Height = float.Parse(oNodeHeight.InnerText.Replace("cm", ""), this.oNumInfo);     
                }     
        
                return oSize;     
            }     
        
            public SizeF GetItemPos(string sName)     
            {     
                SizeF oSize = new SizeF();     
        
                XmlNode oNode = FindNodeName(sName, GetNode("ReportItems", oXmlDoc.DocumentElement, true));     
        
                XmlNode oNodeWidth = GetNode("Left", oNode);     
                XmlNode oNodeHeight = GetNode("Top", oNode);     
        
                if (oNodeWidth != null)     
                {     
                    oSize.Width = float.Parse(oNodeWidth.InnerText.Replace("cm", ""), this.oNumInfo);     
                }     
        
                if (oNodeHeight != null)     
                {     
                    oSize.Height = float.Parse(oNodeHeight.InnerText.Replace("cm", ""), this.oNumInfo);     
                         
                }     
        
                return oSize;     
            }     
        
            public void SetItemSize(string sName, SizeF oSize)     
            {     
                XmlNode oNode = FindNodeName(sName, GetNode("ReportItems", oXmlDoc.DocumentElement, true));     
        
                XmlNode oNodeWidth = GetNode("Width", oNode);     
                XmlNode oNodeHeight = GetNode("Height", oNode);     
        
                if (oNodeWidth != null)     
                {     
                    oNodeWidth.InnerText = oSize.Width.ToString(".0", this.oNumInfo) + "cm";     
                }     
        
                if (oNodeHeight != null)     
                {     
                    oNodeHeight.InnerText = oSize.Height.ToString(".0", this.oNumInfo) + "cm";     
                }     
            }     
        
            public void SetItemPos(string sName, SizeF oPos)     
            {     
                XmlNode oNode = FindNodeName(sName, GetNode("ReportItems", oXmlDoc.DocumentElement, true));     
        
                XmlNode oNodeLeft = GetNode("Left", oNode);     
                XmlNode oNodeTop = GetNode("Top", oNode);     
        
                if (oNodeLeft != null)     
                {     
                    oNodeLeft.InnerText = oPos.Width.ToString(".0", this.oNumInfo) + "cm";     
                }     
        
                if (oNodeTop != null)     
                {     
                    oNodeTop.InnerText = oPos.Height.ToString(".0", this.oNumInfo) + "cm";     
                }     
            }     
        
            private XmlNode GetNode(string sName, XmlNode oRoot)     
            {     
                return GetNode(sName, oRoot, false);     
            }     
        
            //Method to find the XML elements     
            //This may not be the fastest way to do this?     
            private XmlNode GetNode(string sName, XmlNode oRoot, bool bRecursive)     
            {     
                bool bFlag = false;     
                int iCount = 0;     
                XmlNode oNode = null;     
        
                while ((!bFlag) && (iCount < oRoot.ChildNodes.Count))     
                {     
                    oNode = oRoot.ChildNodes.Item(iCount);     
        
                    if (oNode.Name == sName)     
                    {     
                        bFlag = true;     
                    }     
                    else if (bRecursive)     
                    {     
                        if (oNode.HasChildNodes)     
                        {     
                            oNode = GetNode(sName, oNode, true);     
        
                            if (oNode != null)     
                            {     
                                bFlag = true;     
                            }     
                        }     
                    }     
        
                    iCount++;     
                }     
        
                if (!bFlag)     
                {     
                    oNode = null;     
                }     
        
                return oNode;     
            }     
        
            private XmlNode FindNodeName(string sName, XmlNode oRoot)     
            {     
                bool bFlag = false;     
                int iCount = 0;     
                XmlNode oNode = null;     
        
                while ((!bFlag) && (iCount < oRoot.ChildNodes.Count))     
                {     
                    oNode = oRoot.ChildNodes.Item(iCount);     
        
                    if (oNode.Attributes["Name"] != null)     
                    {     
                        if (oNode.Attributes["Name"].InnerText == sName)     
                        {     
                            bFlag = true;     
                        }     
                    }     
        
                    iCount++;     
                }     
        
                if (!bFlag)     
                {     
                    return null;     
                }     
        
                return oNode;     
            }     
        
            //Save the changed report     
            public Stream GetReport()     
            {     
                MemoryStream ms = new MemoryStream();     
                // Create Xml      
                XmlTextWriter writer = new XmlTextWriter(ms,     
                System.Text.Encoding.UTF8);     
        
                oXmlDoc.Save(writer);     
        
                ms.Position = 0;     
        
                return ms;     
            }     
        
            public string GetReportStr()     
            {     
                return oXmlDoc.InnerXml;     
            }     
        
            private float GetNewWidth(float fWidth)     
            {     
                return (fWidth / (this.sizeReportOld.Width)) * (this.ReportSize.Width);     
            }     
        
            private float GetNewHeight(float fHeight)     
            {     
                return (fHeight / (this.sizeReportOld.Height)) * (this.ReportSize.Height);     
            }     
                 
            public XmlNode GetReportHeader()     
            {     
                return GetNode("PageHeader", oXmlDoc.DocumentElement, true);     
            }     
        
        
            public XmlNode GetReportFooter()     
            {     
                return GetNode("PageFooter", oXmlDoc.DocumentElement, true);     
            }     
        
            public XmlNode GetReportImages()     
            {     
                return GetNode("EmbeddedImages", oXmlDoc.DocumentElement, true);     
            }     
        
            public void SetReportNode(string sName, XmlNode oSourceNode)     
            {     
                XmlNode oNode = GetNode(sName, oXmlDoc.DocumentElement, true);     
        
                if (oNode != null)     
                {     
                    oNode.RemoveAll();     
        
                    foreach (XmlNode oChild in oSourceNode.ChildNodes)     
                    {     
                        oNode.AppendChild(oXmlDoc.ImportNode(oChild, true));     
                    }     
                }     
                else     
                {     
                    oXmlDoc.DocumentElement.AppendChild(oXmlDoc.ImportNode(oSourceNode, true));     
                }     
        
            }     
        
        
            public void SetTextBoxFont(string sFontFamily)     
            {     
                XmlNode oRoot = oXmlDoc.DocumentElement;     
                XmlNode oReportNode = GetNode("ReportItems", oRoot, true);     
        
                SetFont(sFontFamily, oRoot);     
        
        
                XmlNode oPageFooter = GetNode("PageFooter", oRoot, true);     
        
                if (oPageFooter != null)     
                {     
                    oReportNode = GetNode("ReportItems", oPageFooter, true);     
        
                    //ReportItems in Footer      
                    if (oReportNode != null)     
                    {     
        
                        SetFont(sFontFamily, oReportNode);     
                    }     
                }     
        
                XmlNode oPageHeader = GetNode("PageHeader", oRoot, true);     
        
                if (oPageHeader != null)     
                {     
                    oReportNode = GetNode("ReportItems", oPageHeader, true);     
        
                    //ReportItems in Header      
                    if (oReportNode != null)     
                    {     
        
                        SetFont(sFontFamily, oReportNode);     
                    }     
                }     
            }     
        
            private void SetFont(string sFontFamily, XmlNode oRoot)     
            {     
                int iCount = 0;     
                XmlNode oNode = null;     
        
                while ((iCount < oRoot.ChildNodes.Count))     
                {     
                    oNode = oRoot.ChildNodes.Item(iCount);     
        
                    if (oNode.Name == "Textbox")     
                    {     
                        SetStyle(oNode, sFontFamily);     
                    }     
                    else     
                    {     
                        if ((oNode.Name == "List") || (oNode.Name == "ReportItems") || (oNode.Name == "Body"))     
                        {     
                            if (oNode.HasChildNodes)     
                            {     
                                SetFont(sFontFamily, oNode);     
                            }     
                        }     
                    }     
        
                    iCount += 1;     
                }     
        
            }     
        
            private void SetStyle(XmlNode oItemNode, string sFontFamily)     
            {     
                XmlNode oNode = GetNode("Style", oItemNode);     
        
        
                if (oNode == null)     
                {     
        
                    //Make Style Node      
        
                    XmlElement elemStyle = oXmlDoc.CreateElement("Style");     
        
                    oItemNode.AppendChild(elemStyle);     
        
        
                    oNode = GetNode("Style", oItemNode);     
                }     
        
                if (oNode != null)     
                {     
                    XmlNode oFontNode = GetNode("FontFamily", oNode);     
        
                    if (oFontNode != null)     
                    {     
                        if (oFontNode.InnerText != "Wingdings")     
                        {     
                            oFontNode.InnerText = sFontFamily;     
                        }     
                    }     
                    else     
                    {     
        
                        XmlElement elemFont = oXmlDoc.CreateElement("FontFamily", "http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition");     
        
                        elemFont.Attributes.RemoveAll();     
        
                        elemFont.InnerText = sFontFamily;     
        
                        oNode.AppendChild(elemFont);     
                    }     
                }     
            }     
        
        }     
    }    
    Wednesday, March 11, 2009 2:31 AM
  • Thank you.  Very detailed.
    Wednesday, March 11, 2009 11:23 PM
  • Is there someone at Microsoft that can be contacted to see if there are any plans to modify ReportViewer so that a user can at least make persistent changes to the page setup?
    Thursday, March 12, 2009 2:19 PM
  • did you get it to work?  The problem with changing the page size and the report size, all the report items need to repositioned or resized too.  You may also want to control how the items are anchored.

    Friday, March 13, 2009 1:54 AM
  • I kind of put that part aside for awhile.  All I really care about is whether or not changes to the items in the Page Setup get saved.  I don't care whether changing these causes the report to need more pages or whether the fields keep the same relative position.  Upon reflection, I wish I had just designed my own report.  The ReportViewer sounds good, but why in the world would changes to the page steup not be made persistent?

    Thanks so much for your help.  I really appreciate it.

    Randy
    Friday, March 13, 2009 1:11 PM
  • Hi Randy,
    did you solve your issue?

    I'm also having your doubts: why should a user enter and re-enter the same size settings, every time a report is loaded? Why shouldn't I be able to write code to handle and solve this issue on my application?
    Why doesn't ReportViewer control expose these informations in any suitable way (page-setup-dialog-close event, localReport.size property, etc.)?

    Users are asking these questions since late 2005 and nothing has changed. There is something I am missing?

    Bye! Valentina

    Thursday, November 19, 2009 1:42 PM
  • Hi Valentina,

    No.  I ended up discarding the ReportViewer and writing my own reports.  The control is probably fine for very simple reports that are localized and fixed, but the inability to persist changes makes it unusable as far as I am concerned.  Good luck.

    Regards,

    Randy
    Thursday, November 19, 2009 3:57 PM
  • Hi Randy,
    probably the (not easiest - unfortunately) way to persist page layout settings, while preserving ReportViewer processing functionality, is to hide the page-setup button on print preview window, and build a custom one, that gets user settings (page type, margins, etc) and transforms them in RDL instructions.

    In this way, however, the user loses the possibility to see the report updated in "real time", after having adjusted margins or other settings.

    Before completely re-thinking my reporting functionality, is there anyone at Microsoft that knows if a newer version will be available and when?

    Thank you, bye! Valentina

    Friday, November 20, 2009 5:15 PM
  • What is the sXMLData in your code?

    MJ_Developer.
    Sunday, April 18, 2010 6:42 PM
  • Nedir sXMLData kodunuzda?

    MJ_Developer.
      Assembly _assembly = Assembly.GetExecutingAssembly();
                    StreamReader _textStreamReader = new StreamReader(_assembly.GetManifestResourceStream(rpv.LocalReport.ReportEmbeddedResource));
                    string sXMLData  = _textStreamReader.ReadToEnd();
    Thursday, June 30, 2011 9:20 PM
  • Hi.

    I have some textbox in a rectangle, if the textbox blank infrastructure is necessary to reduce the height of the rectangle. I thought I'd use the "private void settop (XmlNode oNodeHeight)," because if the value of the textbox is "" I change the top control.

    But still can not implement this in my code. What would this parameter "XmlNode oNodeHeight"?


    “Caso esta resposta tenha ajudado a solucionar sua dúvida, favor clicar em “Marcar como Resposta” para beneficiar outros membros da comunidade que estejam lendo este thread”.
    Monday, July 4, 2011 2:32 PM
  • Hi,

    Did anyone try out the ReportViewerHelper class as posted above? I've found out that it's not compatible with latest RDLC specification (I am using VS 2010 on SQL Server 2008 R2 Express edition). I'd appreciate someone posted a working example.

    Regards,

    Jhy


    Jun HY

    Thursday, April 5, 2012 2:45 PM
  • Hi MartooTS,

    can you tell me how i use your class in vb.net , i converted the class to vb.net code but i don't know how to use it , i need it to resize Textboxs and report size.

    Sunday, October 19, 2014 12:05 PM