how to load a .repx file report to print - c#

I'm new to DevExpress and I created a .repx report using the RibbonReportDesigner. It's working fine in print preview reading from SQLite and loading the perfect design.
I saved the .repx file in project directory and changed its copy to output directory property to 'copy always'.
I have a button that should load this report, but I don't know what to do next and I couldn't find an answer online.
As shown in the attached picture I have a simple structure, Form1 takes several inputs from the user and generate a barcode, the barcode is well designed through RibbonReportDesigner but still I don't know the next step.

Another option that might better suit your needs would be to save the report to your project as a report class. Add a new DevExpress report object to your project and load your existing design from the .repx file.
When you want to print the document from your code, instead of instantiating a new XtraReport object and loading the layout from the .repx file, instantiate the CustomReport.cs class instead. Because your custom class is inherited from the XtraReport class, it will function the same and you can fill in your parameters like normal.

Related

Visual Studio 2013 - Creating Dataset for RDLC Report

I am trying to make a report. The class that I am working with has several ICollection properties, and passing those values to the report for display is difficult.
I have created a class called FlatClass that has all of the string values that I need to display. In the Controller, I plan to populate an array of type FlatClass and pass it to my Report. From what I have read, I need to create a custom dataset/data source. In Visual Studio 2013, when I click Add DataSet in the Report Data tab, it wants me to choose a table from my database. But ClassFlat does not have a table in the database.
I have added a .xsd file, but I cannot find any instruction on how to tell it the names and types of the Fields I want it to have.
Any help would be greatly appreciated!!!!
I tried to create rdlc report in my web application but I could not add my class as dataset. There was no option for that.
Workaround:
Create a Library project in the same solution.
Add the main project as reference to this new Library project.
Create a rdlc file.
Add dataset; for datasource select New->Object->Choose the class from you project namespace
Do your report and when it is complete, move the file to the main project
Not sure if your problem is similar but hope the information is useful.
I ended up creating an .xsd file and just editing the raw XML to add all the properties of the class I wanted to use as a dataset. This worked when I added it to the report.

Adding a dataset to rdlc file

Scenario:
I have an RDLC file - TestReport.rdlc
I have a form - Form1.cs
I have a ReportViewer - rptViewer
My datasource for the report will be an XML file or a datatable defined at run time (in button click event). Now when I am in design mode for the report how do I add the DataSource or DataSet to the report so I can "add" the columns/fields into the report?
Right now in the report when I click New -> DataSet I am asked to pick from Database, Service, Object or SharePoint but I want to use an object which exists in memory.
I am using VS2012.
Thanks,
Andrew
In case of XML, you have to create the schema for it and then add it to the report in the design view.
A little example is exaplained in this blog (it's old but still good to understand what you have to do).
If also the XML's schema is dynamic, the only solution I came out is about to create one paramater for each node/attribute of your XML and build one or more .rdlc files for every type of XML

Create Print Template

I have a web services application where I would like the users to be able to define print page templates with database field placeholder in my project.for this reason I
have to provide environment for design template for my users.this templates must save in database,
then for print I get data from database and put it in placeholders.I found that "XSLT" can be usefully for this issue, but a big problem is Html result for XSLT.If There is any solution please let me know.
thanks in advance
what you can do is: create a html file template, create field placeholder in it. When you need to print it, load data from database, replace the placeholder, create the html file, load it into webbrowser class (it does not have to have an UI). then print from there.
since it is html file, you can save it to database too.
it works great in one of our project which has the same requirement.

How do I make a custom project-template show me a certain view on creating a new project?

When I create a new project of the predefined templates, say a new windows form application – it starts out showing me the designer view of Form1.
What I want to do is something similar with the custom template. (Actually, I want the code-view.) Currently, nothing is shown automatically.
I created the project with “Export template”.
open your template zip file and in file *.vstemplate add attribute OpenInEditor="true" to code files you would like to open on project creation (ProjectItem). i tried to open code for Form and i failed, but it works pretty well for simple code files.

Active Reports PDF Generation

I've inherited a project that uses Active Reports. I'm required to basically create a simple pdf that holds data that's in a DataGrid on one of my ASP.NET pages.
I've only found a single walkthrough on the DataDynamics website and it only applies to users of VS2003 and VS2005.
The report I need doesn't need to be interactive. I don't need to use Document and Page events. I just need to take what I have in a DataTable (which is bound to my grid) and create a pdf file, which will be available for download.
Is there a straightforward way to create this simple, static report with ActiveReports? Thanks.
kmarks,
You can indeed do this very easily, you can use the same DataTable as a datasource for report by setting the datasource property of the report to the DataTable.Then you just need to add an ActiveReports TextBox control to the Details section of the report and then set its DataField property to a column name in the datatable to bind a field from the datatable to the TextBox control.You can do this either at design time or in the code behind
After you have done this,just create an instance of the report,call the Run the method on this instance and then export the report document to PDF.
I would also suggest you to go through the following link which can help you achieve the same.
http://www.datadynamics.com/Help/ActiveReports6/arWLKCustomWebExporting.html
You can also download a sample application which converts a DataGrid to PDF report using Active Reports form here
ftp://ftp.fpoint.com/ActiveReports/Samples/GridToPdf.zip
Regards,
Abhishek Dutta
Grapecity

Categories

Resources