View on GitHub

A Dilemma: HTML vs GDI

Genealogical Reporting

For my YAGP project, I want to provide report capabilities. YAGP is for genealogical research, so reports could include pedigree charts, descendant charts, fan charts, family group sheets, and tables of people, locations, marriages, etc. Reports need to be viewable, print/preview-able, ideally customizable, and possibly exported.

My first attempt at a "visually interesting" report was the individual pedigree. I implemented four-generation and five- generation variants using GDI+, a PictureBox, and drawing to a Document for print/preview. A screen shot can be seen below.

While researching ways to implement the "Family Group" report, I discovered Microsoft's WebBrowser control. Said control allows displaying a web page in the application. Said web page can be a URL from the Interwebs, or in my case, HTML generated by the application.

Screen shots are below for the current iteration of the family group report, and a 4-generation pedigree. I haven't got very far with the 5-generation HTML pedigree yet. Both are implemented using the HTML TABLE, with some CSS to draw lines.

So What's the Dilemma?

This is a crossroads point for me. For the desktop, I'm convinced that Windows has won and Linux/Mac are low priority. Mono support is now a lower priority, with WINE as a possible cross-platform solution. On the other hand, using HTML opens up the possibility of going the web route: web server or web site generation. Maybe even Mobile?

I started looking into HTML because I was unhappy at the available choices for print/previewing WinForm grids. Stumbling into the WebBrowser control suggested HTML Tables, and the control provides the print/preview solution.

HTML isn't "natural" to me - I spend a lot of time with Google to find details on tags and css. But I also recall a lot of struggle getting the GDI pedigree "just right", researching tricks for GetTextSize, and no easy way to extend it with additional details (e.g. dropping occuption, adding military service, etc). I still need to do work to add said support to the HTML generation, but the HTML table takes care of the resizing etc.

A 'big question' for me is how to draw graphics in a web page, initially for fan charts. Another one is how to navigate by clicking on the HTML (without adding hyperlinks or javascript). At least for tables, pedigrees and family groups, HTML is a very good solution.

Pros and Cons

Here are some of the pros and cons for each approach which I've considered. Your needs and priorities may vary. GDI+ Pros:

GDI+ Cons: WebBrowser Pros: WebBrowser Cons:
  • Uses IE: some limitations or IE specific HTML required.
  • Effectively limited to web-friendly fonts.
  • Uncertain if can 'remember' print options
  • Alternative control required for Mono; status uncertain
  • Unknown: drawing graphics (e.g. fan chart)
  • Unknown: navigation by clicking in the chart

Screen Shots

Not shown for the HTML is how the font family or font size can easily be selected. Also not shown is the grey and green themes. Neither of these options are available for the GDI version ...

gdi_ped4
4-Gen Pedigree drawn with GDI+

html_ped4
4-Gen Pedigree drawn with HTML

html_fam
Family Group report drawn with HTML