Reputation: 13
doc = app.Documents.Add(fileInfo[i].FullName);
Vis.Shapes shapes = doc.Pages[1].Shapes;
for (int j = 1; j <= shapes.Count; j++)
{
if (shapes[j].Text.StartsWith("getSomeThing"))
{
shapes[j].Text = "doSomething()";
}
}
shapes[j].Text = "doSomething()"; this line will cause an exception, how to fix it?
It causes a COMException.
Exception message is "The requested operation is disabled".
ErrorCode = -2032465766
Upvotes: 1
Views: 1138
Reputation: 10386
Maybe there is some shape with lock on text edit. You can remove that protection:
shape.get_CellsSRC((short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowLock,
(short)VisCellIndices.visLockTextEdit).FormulaU = "0"; //to remove protection
And it is better to "remember" old value and set it back after yours edits.
Upvotes: 1