We adapt the L-Galaxies semi-analytic model to follow the star-formation histories (SFH) of galaxies -- by which we mean a record of the formation time and metallicities of the stars that are present in each galaxy at a given time. We use these to construct stellar spectra in post-processing, which offers large efficiency savings and allows user-defined spectral bands and dust models to be applied to data stored in the Millennium data repository. We contrast model SFHs from the Millennium Simulation with observed ones from the VESPA algorithm as applied to the SDSS-7 catalogue. The overall agreement is good, with both simulated and SDSS galaxies showing a steeper SFH with increased stellar mass. The SFHs of blue and red galaxies, however, show poor agreement between data and simulations, which may indicate that the termination of star formation is too abrupt in the models. The mean star-formation rate (SFR) of model galaxies is well-defined and is accurately modelled by a double power law at all redshifts: SFR proportional to $1/(x^{-1.39}+x^{1.33})$, where $x=(t_a-t)/3.0,$Gyr, $t$ is the age of the stars and $t_a$ is the loopback time to the onset of galaxy formation; above a redshift of unity, this is well approximated by a gamma function: SFR proportional to $x^{1.5}e^{-x}$, where $x=(t_a-t)/2.0,$Gyr. Individual galaxies, however, show a wide dispersion about this mean. When split by mass, the SFR peaks earlier for high-mass galaxies than for lower-mass ones, and we interpret this downsizing as a mass-dependence in the evolution of the quenched fraction: the SFHs of star-forming galaxies show only a weak mass dependence.