Showing results for 
Search instead for 
Did you mean: 

Edit Text style for TextBox




is there any API to modify the Text style for inserted textbox ? 

There is way to set the text style before inserting new textbox but there is no way to modify the style for the same textbox. 


Thanks in advance. Please let me know.


Sample code :


Type objType = null;

objType = Type.GetTypeFromProgID("SolidEdge.Application");

SolidEdgeFramework.Application objApplication = System.Runtime.InteropServices.Marshal.GetActiveObject("SolidEdge.Application") as SolidEdgeFramework.Application;

SolidEdgeFramework.SolidEdgeDocument seObjDocument = objApplication.ActiveDocument as SolidEdgeFramework.SolidEdgeDocument;

SolidEdgeDraft.DraftDocument draftDoc = seObjDocument as SolidEdgeDraft.DraftDocument;

SolidEdgeFramework.TextStyles textStyles = draftDoc.TextStyles;
List<string> tableS = new List<string>();
foreach (SolidEdgeFramework.TextStyle style in textStyles)
string nameOfStyle = style.Name;

textStyles.Active = "Onkar";

SolidEdgeDraft.Sheets draftSheets;
string activeSheetname = "Sheet1";
string textBoxname;
string layerName = "Default";
string text=" added this for testing \n I was here.\n Doing some testing.\n Got correct results.";
InsertTextBox(draftDoc, out draftSheets, text, activeSheetname, layerName, out textBoxname);

SolidEdgeFramework.SolidEdgeDocument seObjDocument2 = objApplication.ActiveDocument as SolidEdgeFramework.SolidEdgeDocument;

SolidEdgeDraft.DraftDocument draftDoc2 = seObjDocument2 as SolidEdgeDraft.DraftDocument;

SolidEdgeDraft.Sheets draftSheets2 = draftSheets = draftDoc2.Sheets;

SolidEdgeDraft.Sheet requiredSheet = null;

foreach (SolidEdgeDraft.Sheet item in draftSheets2)
if (item.Name == activeSheetname)
requiredSheet = item;

SolidEdgeFrameworkSupport.TextBoxes textBoxesCollection = requiredSheet.TextBoxes as SolidEdgeFrameworkSupport.TextBoxes;
SolidEdgeFrameworkSupport.TextBox requiredTextBox = null;
foreach (SolidEdgeFrameworkSupport.TextBox textBox in textBoxesCollection)
if (textBox.Name == textBoxname)
requiredTextBox = textBox;

SolidEdgeFramework.TextStyles textStyles2 = draftDoc.TextStyles;
List<string> tableS2 = new List<string>();
foreach (SolidEdgeFramework.TextStyle style2 in textStyles2)
string nameOfStyle1 = style2.Name;


SolidEdgeFramework.SelectSet s=draftDoc.SelectSet;

textStyles2.Active = "Normal";


//Trying to set the style again for the same textbox which I have created on drawing file.



Thanks and Regards,



Re: Edit Text style for TextBox

Valued Contributor
Valued Contributor



Please Use "SolidEdgeFrameworkSupport.TextEdit".


i dont know in C#. i added in .net code,


objtexts = objsheet.textboxes


objtxt = objtxts.item(1)


dim objtxtedit as SolidEdgeFrameworkSupport.TextEdit


objtxtedit = objtxt.edit = "new style name"


its worked for me, my "Normal" textstyle changed to my new textstyle "Test".


Also please use "Solidedge spy" for more details.