LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to create a report like this?

Hello,

 

currently I'm trying to generate a report within my software application and I'm running into a few troubles.

I have attached a html-version of the report, I want to create for reference.

Is there any way achieving this using the NIReports instrument? I can't seem to be able to recreate the table structure using it... or perhaps I'm missing something.

 

If it may not be possible, do you have any other suggestions?

In my first version I created the report in HTML, but now the customer wants to add pictures to the report... for which html isn't really the best option, since you can't embed image files into the document (well you can, but it's not compatible to the Internet Explorer)

 

It would be best if I would not have to resort to any third party applications... PDF output would be acceptable though. Word and Excel isn't an option, since it's not available anywhere.

0 Kudos
Message 1 of 7
(4,116 Views)

Hi,

 

in your questions it´s not apparent for me with what NI software you wants create the report ? You can do it in Testand with all modules like Labview, Labwindows, ActiveX/.Net or .dll calls or direct in Labview, Labwindows, MStudio for VisualC with the NI report generation toolkit.

 

So some solutions depended on what you will do. So i need more details and e.b. an example from your current code.

 

Best Regards

 

Johann

0 Kudos
Message 2 of 7
(4,095 Views)

Hi, supposing you are using CVI in my opinion one feasible solution is to create a simple (hidden) panel with an embedded table or listbox populated with your data and print it.

By setting the panel with a white background and customizing the table or the listbox in a proper fashion you can obtain almost the result you expect. In a panel you can embed one or more picture controls where to store your images either in the UIR editor if known at design time or at runtime with DisplayImageFile or similar image processing instructions.

 

This solution in my opinion has two advantages:

  • It does not rely on anything but the CVI 
  • It permits you to preview the report with a simply displaying the panel (NI Reports does not include such a facility which I consider useful at design time and which customers appreciate)

 

In case you want to try this solution, I suggest you use a good sized panel to obtain a good effect when printed: I usually use a 1400 x 900 pixels panel for this matter.

 

I am attaching a sample report made with a listbox, designed before table controls were included in CVI: some lines are very thin, so you will need to either print the report or examine it with a good zooming factor to catch all details of it.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 7
(4,091 Views)

@Johann

Sorry I forgot to add more information. I'm currently using Labwindows/CVI 8.5. I do not have Teststand available though.

I tried using the NIReports instrument thus far with no viable success.

 

Currently I don't have any code samples available since I'm just testing the possibilities.

 

@Roberto

Thanks for your suggestion. This seems like it could produce a report that I can work with. The only problem I have now, is that my reports sometimes have more or less lines.... so it doesn't always have a fixed layout. I thought about using a table control before, but unfortunately it doesn't allow "colspan".

 

Right now I'm thinking about using the HTML reports I have now and simply send them to a printer. I've read about a "Print HTML Report.vi" for Labview, but I haven't found a solution for that with using Labwindows/CVI thus far.

0 Kudos
Message 4 of 7
(4,087 Views)

It's true that tables do not have colspan, that's why I oftes use listboxes instead of tables. Both of them permit dynamic addition of rows and in case of listboxes I set a decoration around the control to enclose it. Before printing the report I get the height of the control and accomodate the decoration accordingly, this way:

 

    GetNumListItems (reportHandle, REPORT_LISTBOX, &i);
    if (!i) i = 1;
    SetCtrlAttribute (reportHandle, REPORT_LISTBOX, ATTR_VISIBLE_LINES, i);
    GetCtrlAttribute (reportHandle, REPORT_LISTBOX, ATTR_HEIGHT, &height);
    SetCtrlAttribute (reportHandle, REPORT_DECORATION, ATTR_HEIGHT, height);

 

I'm sorry I cannot assist you in using htm.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 7
(4,069 Views)

Hello Roberto,

 

It would be of great help to me, if you post some code for your Report.

Many thanks!

 

 

0 Kudos
Message 6 of 7
(3,546 Views)

Hello Zesty,

there is nothing special in the way I create reports with panels. Here some details on what I do:

 

  • I use 1400 x 990 pixels panels with transparent background, no scrollbars visible, no "Conform to System colours" and no "Use Windows visual style for controls" enabled
  • I put controls on the panels to hold report data: string/text controls, textboxes, listboxes... I use classic-style controls since I can paint their borders in transparent to hide them. All controls with white or transparent background. I found that a pixel dimension of 16 is enough for a good readability
  • When I use listboxes I use "\033" escape codes to align data and create vertical lines to separate columns. See the function help for InsertListItem for details on available escape codes
  • I use classic-style flat box decoration to create boxes around data when needed. Flat box interior is painted in transparent
  • When I have a listbox surrounded with a box, I dimension the box with the code already shown some post ago so that it adapt to listbox content
  • You can have a previou simply displaying the panels: you may need to add scrollbars since they are possibly larger that the screen size
  • Panels are then sent to the printer via PrintPanel

Attached are some reports I created this way: as you can see you can include both text and graphics on reports and you can play with control attributes to achieve a good aspect.

 

 

It is to be said that recently I have moved to PDF reporting: here you can find a sample program I posted on this. I decided produce PDFs because it has become a standard and permits multi-page reports to be saved: with "panel-reports" you can only save a page at a time as an image with GetPanelDisplayBitmap (unless you play with some PDF virtual printer and manage to chain printed pages someway in your program or after it).



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 7 of 7
(3,540 Views)