none
How to show a title on each page of the report dynamically created reportviewer (c#) RRS feed

  • Question

  • I create the report dynamically, i e, I have no way to open a designer RDLC and fix it. I create a table and fill it through the dataset. Getting XML file and export it to PDF file. But even if I write

    string deviceInfo =
    "<DeviceInfo>" +
    " <OutputFormat>PDF</OutputFormat>" +
    " <PageWidth>11in</PageWidth>" +
    " <PageHeight>8.5.0in</PageHeight>" +
    " <MarginTop>0.05in</MarginTop>" +
    " <MarginLeft>0.05in</MarginLeft>" +
    " <MarginRight>0.05in</MarginRight>" +
    " <MarginBottom>0.05in</MarginBottom>" +
    
    " <KeepWithGroup>After</KeepWithGroup>" +
    " <RepeatOnNewPage>true</RepeatOnNewPage>" + 
    " <FixedData>true</FixedData>"+
     " <RepeatHeaderOnNewPage>true</RepeatHeaderOnNewPage>" +
    "</DeviceInfo>";
    try
    {
     byte[] bytes = reportViewer1.LocalReport.Render(
     "PDF", deviceInfo, out mimeType, out encoding, out filenameExtension,
     out streamids, out warnings);
    
     using (FileStream fs = new FileStream(filename, FileMode.Create))
     {
     fs.Write(bytes, 0, bytes.Length);
     fs.Close();
     }
     return filename;
     }
     //....
    I see the title only on 1 page Help solve the problem! Thanks!
    Tuesday, June 5, 2012 8:11 AM

All replies

  • I added the code RDLc new node

                    //Add new node
                   XmlNode newNode = xDocument.CreateNode("element", "RepeatOnNewPage", "http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition");
                    newNode.InnerText = "true";
                    xDocument.ChildNodes[1].ChildNodes[1].ChildNodes[0].ChildNodes[0].ChildNodes[1].ChildNodes[0].ChildNodes[0].AppendChild(newNode);

    , but now get an error "An error during local report processing"

    Help me, please!!!

    Wednesday, June 6, 2012 11:18 AM
  • Issue has been resolved! Anyone who read my question - thank you!
    Monday, June 11, 2012 12:28 PM