Generate documents using subitems from multiple main items

Currently you can only generate documents containing subitems from a specific main item. A more flexible approach is the ability to generate documents that contain subitems spanning multiple items. For example, if the document contains items A, B, and C, it should also be able to include subitems under A, subitems under B, and subitems under C.