At the trial the ballots shall be opened and a recount taken, in the presence of all the parties, of the votes cast for the various candidates in all contests where it appears from the statements filed that a recount is necessary for the proper determination of the contest. The recount shall include a tabulation of all names written upon a ballot and which are subject to canvass pursuant to Chapter 7 (commencing with Section 15350) of Division 15.