Keep all report in one file

hii alex

as we know fr generates report code in xml and stores it in the Resx file but if i want to keep all FRX file in one file format of any kind and then i want to load FRX from that one file for each FRX file one by one how can i do that ??

example : RP1.frx; Rp2.frx, RP3.Frx = RP.xml

then load it separately after extracting particular FRX file from xml file i.e. Report1.load(RP.RP1.frx)

or some other way like this hope u understood wht i mean ??


with regards

Comments

  • edited 11:53PM
    Hello,

    Please look at the Demos\C#\CustomOpenSaveDialogs. This demo uses DataSet that stores report files.
  • edited 11:53PM
    amazing alex ur support #1 [img]style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> just whtever u imaging Fr will Complete that huh i have one question now i understood from this how to save in a XML file just i need a simple code that i have a Report conrol on my form through code how can i load specific reports from the Database.xml ??? without opening custom open Dialog?? and i dont want it to load in designer i need that in preview with regards k[/img]
  • edited 11:53PM
    Here is the code, I hope you will figure it out.
        private DataSet FReportsDs;
    
        private DataTable ReportsTable
        {
          get { return FReportsDs.Tables[0]; }
        }
        
        private void InitializeDatabase()
        {
          FReportsDs = new DataSet();
          FReportsDs.ReadXml(Config.ApplicationFolder + @"..\..\database.xml");
        }
    
        private void FinalizeDatabase()
        {
          FReportsDs.WriteXml(Config.ApplicationFolder + @"..\..\database.xml", XmlWriteMode.WriteSchema);
        }
    
        private void OpenReport(Report report, string reportName)
        {
          // find the datarow with specified ReportName
          foreach (DataRow row in ReportsTable.Rows)
          {
            if ((string)row["ReportName"] == reportName)
            {
              // load the report from a stream contained in the "ReportStream" datacolumn
              byte[] reportBytes = (byte[])row["ReportStream"];
              using (MemoryStream stream = new MemoryStream(reportBytes))
              {
                report.Load(stream);
              }
              return;
            }
          }
        }
    
        private void SaveReport(Report report, string reportName)
        {
          // find the datarow with specified ReportName
          DataRow reportRow = null;
    
          foreach (DataRow row in ReportsTable.Rows)
          {
            if ((string)row["ReportName"] == reportName)
            {
              reportRow = row;
              break;
            }
          }
    
          // no existing row found, append new one
          if (reportRow == null)
          {
            reportRow = ReportsTable.NewRow();
            ReportsTable.Rows.Add(reportRow);
          }
    
          // save the report to a stream, then put byte[] array to the datarow
          using (MemoryStream stream = new MemoryStream())
          {
            report.Save(stream);
    
            reportRow["ReportName"] = reportName;
            reportRow["ReportStream"] = stream.ToArray();
          }
        }
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.