Tuesday, 29 April 2014

NextReports: Generate an excel file based on existing template

NextReports 7.1 will introduce a new feature which will allow to generate an excel file based on one existing template file.

What does it mean? You may have an excel file with 2 (or more) sheets. One sheet is the actual data sheet and the others are computations made on values from data sheet like pivots for example.

Let's say you have a data sheet like:

and a pivot created on this data on a separate sheet:

This excel file is our template. By modifying data inside 'Data' sheet we will have by default this pivot in our resulted file. To make the pivot automatically refresh when we open the file, in the PivotTable Options dialog box, on the Data tab, select the 'Refresh data when opening the file' check box.

Now lets see how is this template used inside NextReports.

You create a simple report that prints the data in the form shown in 'Data' sheet. We have a simple query like:

 with a report showing just header and detail (no formatting needed):

Running such report as EXCEL will show us just a sheet (see previously Data sheet).

To specify that we have a template, some new properties were added on the Report node from layout tree:

 Here we can select a template excel file and the sheet number (starting from 1) where NextReports engine will write the data. In our example is sheet number 2. And that is all!

When you use some actions like Publish, Download from designer, the template file will be automatically passed between designer and server. On the server, when we do an upload, a new file upload field will allow to add a template. Also, Download and Edit in designer server actions will pass the template file to the client machine.

Tuesday, 22 April 2014

NextReports Survey

From some time ago, on NextReports site there is a small survey about the product. It can be found here.

From 7.1, to make people help us and also the entire NextReports open source community, we will show a small information about the survey on designer and server. This is not an intrusive message, once you click on the link or close the window, it will never show up again for that user.

Survey message will show after 10 days from installation, or , for server, if you use old data it may appear right away depending from how long logged user was created.

Inside NextReports Designer a small window will ask for taking the survey:

Inside NextReports Server a small message will notify the user on the top right corner:

If you want to contribute, please tell us on the survey wizard what are your needs.

Tuesday, 8 April 2014

NextReports: Images from database

NextReports Designer 7.0 allows to insert an image element to report layout. This element takes an image from a file. All images used by report are kept near that file, so when we publish a report to server from designer, all its images are also uploaded.

Starting with version 7.1 a new report layout element called "Image Sql Column" is added. This will indicate to report layout that at runtime to try to show the actual image that is kept inside database. Sql column must be of type blob or other specific image type used by different databases (for example MS SQL uses varbinary or image).

We create a query by selecting columns from a table (here Photo is our blob column):

When we run the query in designer we will see "blob"string for Photo values:

We create a report from this query:

Here we added instead a simple "Sql Column", an "Image Sql Column" for Photo:

This element has width and height properties to allow for image scaling.

Inside our database blob field we added different types of images (png, gif, jpeg) and a text file (to test if blob is not a recognizable image). When we export the report to PDF, EXCEL, HTML or RTF we will see actual images stored inside database:

Values that are not recognized as images, are seen with "blob" string.