Bug introduced in 11 or earlier and persisting through 12.1

[...] I have filed a report to the development team, raising the issue to them. [...]


CellPrint[Cell["test", "Text"]]
CellPrint[Cell["test2", "Text", "MyStyle"]]
CellPrint[Cell["test3", "Text", "Text"]]
NotebookImport[EvaluationNotebook[], "Text"]

Since multiple style cells are officially supported I would consider it a bug. Or have I missed something?


I suppose you want that to return all three cells? This does work for that:

NotebookImport[EvaluationNotebook[], "Text" | {"Text", _}]
{"test", "test2", "test3"}

One can also pull only specific combinations:

NotebookImport[EvaluationNotebook[], {"Text", "Text"}]

Notably this matches none of the examples:

NotebookImport[EvaluationNotebook[], {"Text"}]
  • 1
    $\begingroup$ It won't catch CellPrint[Cell["test3", {"Whatever", "Text"}]] but it is a good direction and at the end x__ /; ! FreeQ[{x}, "Text"] works, the problem is we need it for each mentioned style as it can happen in general. $\endgroup$
    – Kuba
    Dec 20 '16 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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