If the Shimano freehub body looks like this:

then you can swap from 8 speed to 7 speed. In other words, Shimano 600 (640*), 105 (1056), RX100 (A55*), RSX (A41*), Ultegra (650*), 105 (550*), Dura Ace (770*) hubs. Some hubs have a spacer between the freehub body and hub. In that case you may need to retain the spacer in order for the freehub body to clear the hub flange.
A lazier option is to just shorten the axle and take out 2mm of washers on each side, but keep the existing 8 speed freehub. Instead of using the HG lock ring, you use a UG small cog to lock your 7 speed cassette in. You may have to leave one cog out of the 7 speed cassette to make it 6 speed. This works on hubs that have the HG/UG threading.