Sure.
The attached script searches our ldap structure and creates an html file with a group heading, and then all the members of that group, followed by another group heading, etc.
You may have to modify it slightly depending on your ldapsearch tool and paths. Feel free.