Skip to content

Instantly share code, notes, and snippets.

@johnpierson
Last active September 5, 2019 13:10
Show Gist options
  • Save johnpierson/11a6d0005bb1825254f771599eafbb37 to your computer and use it in GitHub Desktop.
Save johnpierson/11a6d0005bb1825254f771599eafbb37 to your computer and use it in GitHub Desktop.
public static global::Revit.Elements.Element ToUpper(global::Revit.Elements.Element textNote)
{
Autodesk.Revit.DB.Document doc = DocumentManager.Instance.CurrentDBDocument;
Autodesk.Revit.DB.TextNote internalNote = (Autodesk.Revit.DB.TextNote)textNote.InternalElement;
//Get the text from the text box
//we obtain formatted text and modify the caps instead of the string. Preserves formatting.
FormattedText formattedText = internalNote.GetFormattedText();
formattedText.SetAllCapsStatus(true);
//Change all the text to upper case and reassign to the text box
//using formatted text allows for the formatting to stay - John
TransactionManager.Instance.EnsureInTransaction(doc);
internalNote.SetFormattedText(formattedText);
TransactionManager.Instance.TransactionTaskDone();
return textNote;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment