We present a formalism for optical waveguiding in two-dimensional periodic structures by means of Bragg reflection. The theory provides analytic expressions for the field modal profiles, dispersion, and attenuation or gain in the waveguide. Line defects in two-dimensional photonic crystal slabs are used as the principal example.