Hallo
Ich probiere gerade in einer Tabelle, eine Zelle nach rechts zu "rutschen".
Dazu habe ich den Befehl "MoveRight" genommen.
Jedoch will er nicht ganz.
Dafür habe ich folgende Funktion geschrieben:
public void Zeileändern(string Richtung, string Typ, int count, string wd)
{
object Type = Typ;
object Anzahl = count;
object ext = (object)wd;
if (wd == "wdMove")
{
ext = WdMovementType.wdMove;
}
switch (Richtung)
{
case "rechts":
sftWord.Selection.MoveRight(ref Type, ref Anzahl, ref ext);
break;
case "links":
sftWord.Selection.MoveLeft(ref Type, ref Anzahl, ref ext);
break;
case "oben":
sftWord.Selection.MoveUp(ref Type, ref Anzahl, ref ext);
break;
case "unten":
sftWord.Selection.MoveDown(ref Type, ref Anzahl, ref ext);
break;
default:
break;
}
}
Der Aufruft erfolgt folgendermassen:
Editor.Zeileändern("rechts", "Cell", 1, "wdMove");
Wo liegt nun genau das Problem?
Ich bekomme immer folgenden Error: "Bad Parameter (COMException was unhandled)"
€:
Habs nun hinbekommen (Nach einer ganzen Woche -.-').
Der erste Parameter muss auch noch umgewandelt werden:
public void Zeileändern(string Richtung, string Typ, int count, string wd)
{
object Type = Typ;
object Anzahl = count;
object ext = wd;
if (wd == "wdMove")
{
ext = WdMovementType.wdMove;
}
if (Typ == "Cell")
{
Type = WdUnits.wdCell;
}
switch (Richtung)
{
case "rechts":
sftWord.Selection.MoveRight(ref Type, ref Anzahl, ref ext);
break;
case "links":
sftWord.Selection.MoveLeft(ref Type, ref Anzahl, ref ext);
break;
case "oben":
sftWord.Selection.MoveUp(ref Type, ref Anzahl, ref ext);
break;
case "unten":
sftWord.Selection.MoveDown(ref Type, ref Anzahl, ref ext);
break;
default:
break;
}
}