# How can I copy & paste cell styles?

In Mac's mail app the key shortcut "command + option + c" gives a copy selected text style and "cmd + opt + v" pastes the style. Is there a way to achieve this with cell styles? The keyboard part is solved in this post, I'm just not sure how to effect the "copy-style" part of this problem.

• What exactly do you mean by cell styles? Are you referring to the Stylesheet types accessed in the Format > Style menu, or to formatting applied at the Cell level (font size, background color, etc.)? – Mr.Wizard Feb 18 '15 at 18:01
• Both or either would be nice. – M.R. Feb 18 '15 at 20:11

I achieved my goal with this code in MenuSetup.tr. Here is copy-cell-style:

MenuItem["Copy Cell Style",
FrontEndExecute[{FrontEndSelectionMove[FrontEndEvaluationNotebook[], All,         FrontEndEvaluationCell],
KernelExecute[
$mystyle = FrontEndExecute[FrontEndNotebookRead[FrontEndEvaluationNotebook[]]];$mystyle = $mystyle[[2]]; ] }], MenuKey["c", Modifiers -> {"Command", "Shift"}], MenuEvaluator -> "Local"]  and paste-cell-style: MenuItem["Paste Cell Style", FrontEndExecute[{FrontEndSelectionMove[FrontEndEvaluationNotebook[], All, FrontEndEvaluationCell], KernelExecute[$mycell = FrontEndExecute[FrontEndNotebookRead[FrontEndEvaluationNotebook[]]];
$mycell =$mycell[[1]];FrontEndExecute[FrontEndNotebookWrite[FrontEndEvaluationNotebook[],Cell[$mycell,$mystyle]]];
]
}],

• @Mr.Wizard In conclusion, we can only use System calls like Set[] friends inside KernelExecute, and we can only use Frontend calls inside FrontEndExecute, and these might have to be wrapped inside each-other depending on context... – M.R. Feb 23 '15 at 16:36