
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi folks,
This code is meant to set the styles for a CustomTable in an Inventor drawing. There are 3 sections in the following which format the title text style, column header text style, and data text style. Ideally, those would affect the title text, header text, and data text, respectively.
Unfortunately, whichever one comes last in the order of the code is the only one which ends up being applied as the style for all those types of text. And it also gets applied to other existing tables in the drawing, such as the title block, which is not desired.
// create the custom table CustomTable customTable = activeSheet.CustomTables.Add("Custom Table", InvApp.TransientGeometry.CreatePoint2d(60, 30), numCols, numRows, titles, contents, columnWidths); // title text style customTable.TitleTextStyle.Font = "Italic"; Inventor.Color titleTextColor = InvApp.TransientObjects.CreateColor(255, 0, 0); customTable.TitleTextStyle.Color = titleTextColor; customTable.HeadingPlacement = HeadingPlacementEnum.kHeadingAtTop; // (places overall title, not header titles) customTable.ShowTitle = true; // column header text style customTable.ColumnHeaderTextStyle.Font = "Courier New"; Inventor.Color columnHeaderTextColor = InvApp.TransientObjects.CreateColor(0, 0, 0); customTable.ColumnHeaderTextStyle.Color = columnHeaderTextColor; // data text style customTable.DataTextStyle.Font = "Arial"; customTable.DataTextStyle.Italic = false; Inventor.Color dataTextColor = InvApp.TransientObjects.CreateColor(150, 50, 150); customTable.DataTextStyle.Color = dataTextColor; // grid line weights customTable.Style.InsideLineWeight = 0.05; customTable.Style.OutsideLineWeight = 0.05;
(This is C# code for an Inventor 2018 add-in.)
Using a table format object with OverrideFormat does not help matters.
1.) Why do the separate text styles not work separately on the title, header, and data sections of the table?
2.) How can I prevent the text style set here from affecting other existing tables in the drawing?
Many thanks!
Best Regards,
--Jeff
Solved! Go to Solution.