Message 1 of 2
Can´t insert text into schedule cell

Not applicable
05-07-2018
03:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi I want set text to a schedule.
Here is the code I got so far:
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { Document doc = commandData.Application.ActiveUIDocument.Document; View activeView = commandData.View; if (activeView is ViewSchedule) { ViewSchedule CellsToAdd = activeView as ViewSchedule; TableData tableData = CellsToAdd.GetTableData(); TableSectionData tsd = tableData.GetSectionData(SectionType.Header); using (Transaction t = new Transaction(doc, "myTrans")) { t.Start(); tsd.SetCellText(tsd.LastColumnNumber-1, tsd.LastColumnNumber-1, "new Text"); t.Commit(); } } }
But whenever I run the programm I get a "ArgumentException" which tells me: The given row number nRow is invalid.
How can I fix that?