# SetOptions and Cell

I'm trying to change the CellLabel of Cells using

 SetOptions[Cell, CellLabel -> "test"]


or

 SetOptions[NotebookRead[nb], CellLabel -> "test"]


if nb is the notebook, without success. How should this be done? Thanks, once again, for all help!

-

To see what we are doing, use

SetOptions[EvaluationNotebook[], CellLabel -> True]


Example:

Cell[BoxData[RowBox[{"1", "+", "2"}]], "Input",
CellLabel -> "blabla"] // CellPrint


This should print a cell, such that you can see its label to the left of the cell.

Anyway, we can now do

SetOptions[#, CellLabel -> "test"] & /@ Cells[]


giving all Cells CellLabel test.

-
Thanks a lot for your help. I am now trying to the following: Do[( NotebookWrite[nb, listOfCells[[i]]]; SetOptions[listOfCells[i],CellLabel->"blabla"; ), {i, Length[listOfCells]} ] where listOfCells is a list of cells read earlier from another document using DocumentRead[]. So, I'd like to add labels only in the new document, but not in the document from which these list of cells are read. How is this possible? Thanks! –  Gabriel Sep 9 '13 at 9:08
@Gabriel no problem. Hm are you sure that you are using DocumentRead? I cannot find it in the docs. I think using NotebookWrite here is a bit tricky, as it does not always move the cursor in the right way. Instead of using SetOptions here, I suggest using something like Append, to set the option in the Cell expression. But maybe you should take care to remove any existing CellLabel option. Also I got \$Failed a few times, maybe you should made it handle that case specially as well. Anyway, feel free to start a new Q&A about this :). Maybe I can then provide more details. –  Jacob Akkerboom Sep 9 '13 at 9:24
@ Jacob: sorry, I mistyped: I'm using NotebookRead! –  Gabriel Sep 9 '13 at 9:28