Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

How can I get the style such as Input, Text, Code, etc., of a selected cell? If a group of cells is selected, how can I get styles of all the cells in the group?

share|improve this question
    
Programmatically? If it's just one cell, then a manual method: you can right-click on the cell's bracket, mouse over to "Style", and then see what's ticked... –  J. M. Mar 23 '13 at 16:09
    
@J.M. yes programmatically. I wasn't precise. –  Vladimir Mar 23 '13 at 17:58

1 Answer 1

up vote 11 down vote accepted
"Style" /. Developer`CellInformation[nb]

where nb is the NotebookObject for the notebook you care about. Since you could have multiple cells selected, this will always return a list. It's also possible to have no cells selected, in which case CellInformation will return $Failed and the above code would throw an error.

share|improve this answer
    
God, it's even in the help and I couldn't find it.. Thanks! –  Vladimir Mar 24 '13 at 18:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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