How can the private stylesheet of the current notebook be exported to some other notebook?

  • $\begingroup$ Does it not have value as q&a? $\endgroup$ – Feyre Oct 25 '16 at 18:40
  • $\begingroup$ @Feyre. I think it has value as a self-answered question if the answer actually works reliably. Unfortunately, I don't have the time to test it right now. $\endgroup$ – m_goldberg Oct 25 '16 at 22:04

Do it like this:

ExportStylesheet::usage =
  "ExportStylesheet[fn]\nExports the private stylesheet of the current notebook to some other one designated by fn. If the notebook designated by fn was open before, one would loose unstored edits. To prevent this, the target notebook is saved automatically before closing it.";
ExportStylesheet[fn_] :=
      ,nbk = NotebookOpen[fn];
       If[nbk == $Failed
         ,Print["ImportStylesheet: Wrong Filename: ", fn]; 
          Throw["Wrong filename!"]  (* ===THROW===> *)
       NotebookSave[nbk];  (* safeguard against edit losses *)
       NotebookClose[nbk]; (* closes without asking to store *)
      ];                   (* ExportStylesheet *)
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.