Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
I wanted to remove style overrides from our titleblock. As there are many, many textboxes, I wanted to do this in an automated way.
There seems to be an issue with writing to FormattedText property.
The code is like
Inventor.Application invApp; invApp = (Inventor.Application)System.Activator.CreateInstance(System.Type.GetTypeFromProgID("Inventor.Application")); DrawingDocument drawDoc = (DrawingDocument)invApp.Documents.Open(@"Z:\_pdm\flg\Administration\Inventor\2014\Templates\Drawing_DE_EN.dwg"); TitleBlock tBlock = drawDoc.ActiveSheet.TitleBlock; DrawingSketch sketch = tBlock.Definition.Sketch; TextBoxes tboxes = sketch.TextBoxes; foreach(TextBox tbox in tboxes) { tbox.Style = drawDoc.StylesManager.TextStyles["Iso"]; String text = tbox.FormattedText; tbox.FormattedText=tbox.FormattedText.Replace("ISOCPEUR", "ISOCP"); } drawDoc.SaveAsInventorDWG(@"c:\temp\test.dwg",true);
even if I say
tbox.FormattedText = tbox.FormattedText
without changing anything, this still causes an exception.
Best regards
Erik
Solved! Go to Solution.