What means excessive flatulence? Some dogs fart more than others. The biggest fartarses are boxers, rotties and english mastiffs. I do believe diet has a lot to do with flatulence, but still some do it more often (and nastier) than others, regardless of how well they eat.
I would also avoid food scraps which might contain onions and all the rest that Hyacinth has suggested and perhaps change the kibble as it might not be suitable for him. I personally don't like RC and my rottie had terrible stool, breath and yes, she farted more frequently when I fed her RC. As for treats, try and get some that have less or even better - none of the colouring, fillers and artificial flavouring. Or give your dog real meat, cheese etc as treat not this industrial garbage such as Pedigree etc. (all my dogs fart and have lose stool after Pedigree sticks)
Respect and you shall be respected. Animal is always right.