You could have done it in JD Office several years ago,can't imagine why you would not be able to do it with apex,but I am not going there to find out.
It has taken five years for JD to get the glitches all out of JD Office,and now they want to drop support for JD Office?
Go figure.