i hope you can help me. i'm working on a Tool which creates technical drawings from excel data.
some of the desciption boxes on that drawings have sub- or superscriptions.
i've found that article related to word: How to add subscript characters in paragraphs using Word Automation?
but there's the text directly edited, i'm not sure if this is possible when the Text is in a Rectangle / Textbox, for mne it is another object and not directly the page.
here is a codesnippet:
"X" + **unsaturated + "unsat** ≤ " + DataServer.GETPROJECTDATA["Motor"]["Unsaturated commutation reactance " + unsaturated].Last.Value + " %";
the bolded part should be subscripted for example, is there a possibilty to realize this?
thanks alot
Mirko
status: the drop method:
public void drawer(ShapeItem sI, Visio.Master master)
{
//drops the shape at 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;
}