Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ImportStylesheet[fn_] :=
- Module[{nbk}
- , nbk = NotebookOpen[fn];
- If[nbk == $Failed
- ,Print["ImportStylesheet: Wrong Filename"];
- Throw["Wrong filename!"]
- ];
- SetOptions[EvaluationNotebook[]
- ,Sequence[Options[nbk
- , StyleDefinitions
- ]
- ]
- ];
- NotebookSave[nbk, fn]; (* might have been open before *)
- NotebookClose[nbk]; (* closes it without asking *)
- ];
- Part of the path ...(my nb's full path)... does not exist. Unable to
- save the file ....
- ImportStylesheet::usage =
- "ImportStylesheet[fn]nImport the private Stylesheet of the Nb designated by fn. If this Nb was open before, it will be stored automatically at the end of this function to prevent loosing edits by closing the nb.";
- ImportStylesheet[fn_] :=
- Module[{nbk}
- ,nbk = NotebookOpen[fn];
- If[nbk == $Failed
- ,Print["ImportStylesheet: Wrong Filename: ", fn];
- Throw["Wrong filename!"]; (* ====THROW===> *)
- ];
- SetOptions[EvaluationNotebook[]
- ,Sequence[Options[nbk
- ,StyleDefinitions
- ]
- ]
- ];
- NotebookSave[nbk]; (* the nb might have been open before *)
- NotebookClose[nbk];(* this would close it without asking *)
- ]; (* ImportStylesheet *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement