4
$\begingroup$

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. [...]

[CASE:3802659]


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

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

$\endgroup$

1 Answer 1

4
$\begingroup$

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"}] 
{"test3"} 

Notably this matches none of the examples:

NotebookImport[EvaluationNotebook[], {"Text"}] 
{} 
$\endgroup$
1
  • 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$ Commented Dec 20, 2016 at 18:56

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.