c# - subscript Strings and add to Textboxes/Rectangle in Visio -
i hope can me. i'm working on tool creates technical drawings excel data.
some of desciption boxes on drawings have sub- or superscriptions.
i've found article related word: how add subscript characters in paragraphs using word automation?
but there's text directly edited, i'm not sure if possible when text in rectangle / textbox, mne object , not directly page.
here codesnippet:
"x" + **unsaturated + "unsat** ≤ " + dataserver.getprojectdata["motor"]["unsaturated commutation reactance " + unsaturated].last.value + " %";
the bolded part should subscripted example, there possibilty realize this?
thanks alot
mirko
status: drop method:
public void drawer(shapeitem si, visio.master master) { //drops shape @ position x,y. visio.shape shape = vpage.drop(master, (si.coordx / 100000), (si.coordy / 100000)); if (master.name.equals("rectangle") || master.name.equals("rechteck")) { shape.text = si.shapetext; shape = stringformater.formattext(shape, si.shapename); shape.linestyle = "none"; shape.style = "none"; } }
and stringformater.formattext:
protected static visio.shape formattext(microsoft.office.interop.visio.shape shape, string p) { string[] seperatewords = shape.text.split(' '); //messagebox.show(string.join(",",seperatewords)); visio.characters vchars = shape.characters; int start = 0; int end = 0; if (p.equals("head")) { foreach (string s in seperatewords) { if (s.equals("skmin")) { vchars.begin = start + 1; end = start + s.length; vchars.end = end - 1; vchars.set_charprops(4, 2); } if (s.equals("skmax")) { vchars.begin = start + 1; end = start + s.length; vchars.end = end - 1; vchars.set_charprops(4, 2); } start += s.length; } messagebox.show(shape.text); } return vchars.shape; }
Comments
Post a Comment