My program supports the generation of 4 staff types: piano, orchestral, choir and solo. The Noteworthy file illustrated below shows how this is supported (remember - you can always downloaded the file by clicking the image).

Exporting this, translating it to LilyPond format and then typesetting it gives:

As we can see, at the top we have 2 staves that have no bracketing or linking, then 2 bracketed, unlinked choir staves, 2 bracketed, linked orchestra staves and the bottom piano piece. The way of achieving this was briefly mentioned earlier. Piano staves and orchestra staves are produced by setting the Staff Properties Visual Style to Upper Grand Staff/Lower Grand Staff for piano parts, and Orchestral for Orchestra style. All the vocal parts are set to Standard, and we discriminate the solo parts by setting their name to start with the word "Solo". In my example above, the top staff is named SoloStaff and the next one down is SoloStaff1. Simple.

The next question is how we ensure that LilyPond does not display empty staff lines. Below is the opening page of part of a Mikado score that I've arranged (clicking it downloads the whole score).

If we do nothing else but export it, transate to LilyPond using the default settings and then typeset it (note - this is the first example of quite a large score and the typesetting takes some time - almost 30 seconds on my machine when nothing seems to happen) we get the page below:

As you see, we still have the empty staves. However, if we select the option "Remove empty staves" all bar the top empty staves are not displayed. If we also select "Also remove first empty stave" then all the empty ones are removed, as below. I always run with these options set.

That's better. Some notes on what counts as an "empty staff" for LilyPond:

  1. Bars containing "whole bar rests". For my program, this counts as a bar with a duration of a semi-breve. Let's be clear - in a 2/2 bar, a minim rest would occupy the whole bar, but would not be translated as a "whole bar rest" and therefore would still display. Even for bars where a semi-breve isn't strictly a full bar, Noteworthy still treats it as occupying the bar and my program translates it to a "whole bar rest".
  2. Bars contaning only "spacer rests" (in LilyPond notation). Spacer rests are translated from notes or rests with the display propery of "Never".