Highly luminescent bulk two-dimensional covalent organic frameworks (COFs) attract much attention recently. Origin of their luminescence and their large Stokes shift is an open question. After first-principles calculations on two kinds of COFs using the GW method and Bethe-Salpeter equation, we find that monolayer COF has a direct band gap, while bulk COF is an indirect band-gap material. The calculated optical gap and optical absorption spectrum for the direct excitons of bulk COF agree with the experiment. However, calculated energy of the indirect exciton, in which the photoelectron and the hole locate at the conduction band minimum and the valence band maximum of bulk COF respectively, is too low compared to the fluorescence spectrum in experiment. This may exclude the possible assistance of phonons in the luminescence of bulk COF. Luminescence of bulk COF might result from exciton recombination at the defects sites. The indirect band-gap character of bulk COF originates from its AA-stacked conformation. If the conformation is changed to the AB-stacked one, the band gap of COF becomes direct which may enhance the luminescence.