If the heretic is excommunicated by name by the Church, what would he have to do?
That depends on the requirements of the censure or the requirements given at the time the censure was issued. According to Canon Law, no abjuration of heresy is required for absolution - unless the bishop makes it a requirement. I posted the canon law once but cannot find it now.
At any rate, Fr. Wathen explains it......
"It may surprise lay readers to learn that in the traditional formula of absolution in the Sacrament of Penance there is a general absolution from the censures of the Church. This means, of course, that everyone who has received a censure, and everyone who is"under a censure," is a Catholic,
since he goes to confession to seek its removal.....
One who is not a Catholic cannot receive the Sacraments. The excommunicated Catholic can receive the Sacrament of Penance, whereby the censure can be removed, and the sin be forgiven. The Church first removes the censure, then forgives the sin...
May our Lord Jesus Christ absolve you: and I, by His authority, absolve you from every bond of excommunication,
(suspension), and interdict, in so far as I am able and you are needful. Next, I absolve you from your sins, in the Name of the Father, and of the Son, and of the Holy Ghost. Amen.
(The word suspensionis {suspension} is used only for clerics. A cleric may be suspended without being excommunicated; but, should he incur excommunication, he is suspended also.)..."