Autor Beitrag
LEO_KINK
Hält's aus hier
Beiträge: 3



BeitragVerfasst: Sa 28.07.07 15:42 
Halli Hallo,

Ich bin recht neu imn C# programierung und bin schon auf ein Problem gestossen das ich anscheinend nicht gelöst bekomme.

Unzaw habe ich eine Tabbel in einem Word Dokument erstellt,
ausblenden C#-Quelltext
1:
2:
3:
4:
.
.
  wrdRng.Tables.Add(oDoc.Paragraphs[2].Range, 706ref oMissing, ref oMissing);
  oTable = oDoc.Tables[1];


die ich im nachhinein Formatieren und mit Text füllen möchte.

Soweit so gut. Wenn ich die Oberste Spalte beschrifte und mit dem dazügehörigen Stye ( Schfift / frabe / größe ) versehe ist alle noch bestens.

Dann Verbinde ich die beiden ersten Zellen der Reihe 4 und 5.
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
.
.
 row += 4;
 oTable.Cell(row, 1).Merge(oTable.Cell(row, 2));
 oTable.Cell(row+11).Merge(oTable.Cell(row+12));
 // Setzte den Text 
 oTable.Rows[row+1].Cells[1].Range.Text = text;
.
.
.


Wenn ich aber dann noch das mache :
ausblenden C#-Quelltext
1:
2:
 // Verbinden der Zellen ( Row4 und Row5 )
  oTable.Cell(row, 1).Merge(oTable.Cell(row+11));


kann ich dannache keine Zeile ( row) mehr
ansprechen .... Sobald ich versuche auf eine Zeile zuzugreifen gibt es eims auf die Backen !
Fehler Meldung :
"Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt."

ich poste hir auch mal den gesamten dump ... falls jemand damit was anfangen kann

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
System.NullReferenceException wurde nicht behandelt.
  Message="Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt."
  Source="WindowsApplication3"
  StackTrace:
       bei WindowsApplication3.Form1.button2_Click(Object sender, EventArgs e) in G:\Users\leo\Documents\Visual Studio 2005\Projects\WindowsApplication3\WindowsApplication3\Form1.cs:Zeile 132.
       bei System.Windows.Forms.Control.OnClick(EventArgs e)
       bei System.Windows.Forms.Button.OnClick(EventArgs e)
       bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       bei System.Windows.Forms.Control.WndProc(Message& m)
       bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
       bei System.Windows.Forms.Button.WndProc(Message& m)
       bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       bei System.Windows.Forms.Application.Run(Form mainForm)
       bei WindowsApplication3.Program.Main() in G:\Users\leo\Documents\Visual Studio 2005\Projects\WindowsApplication3\WindowsApplication3\Program.cs:Zeile 17.
       bei System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       bei System.Threading.ThreadHelper.ThreadStart()


Moderiert von user profile iconChristian S.: C#-Tags hinzugefügt
LEO_KINK Threadstarter
Hält's aus hier
Beiträge: 3



BeitragVerfasst: So 29.07.07 14:07 
Mir ist grade aufgefallen das ich den verkerten Exception Text eingefügt habe ...

Es geht eingentlich darum kann das möglich sein das wenn ich zwei Zellen
aus benachtbarten Reihen verbinde (z.B C1 aus Row2 und C1 aus Row3) danach
nicht mehr expleziete Rows ansprechen Kann ???


|Col1|COL2|COL3|
|----|----|----|
ROW1 | C1 | C2 | C3 |
ROW2 | C1 | C2 | C3 |
ROW3 | C1 | C2 | C3 |
ROW4 | C1 | C2 | C3 |
ROW5 | C1 | C2 | C3 |
ROW6 | C1 | C2 | C3 |
LEO_KINK Threadstarter
Hält's aus hier
Beiträge: 3



BeitragVerfasst: So 29.07.07 14:23 
Titel: ich nochmal
Das war natürlich der false exception Text ...

Die richtige Fehlermeldung ist :

"Es können keine individuellen Reihen in dieser Sammlung adressiert werden, weil die Tabelle vertikal verbundene Zellen enthält."

Es geht eingentlich darum kann das möglich sein, das wenn ich zwei Zellen
aus benachtbarten Reihen verbinde (z.B C1 aus Row2 und C1 aus Row3) danach
nicht mehr expleziete Rows ansprechen Kann ???


| Col1 | COL2 | COL3 |
|-------|--------|--------|
ROW1 | C1 | C2 | C3 |
ROW2 | C1 | C2 | C3 |
ROW3 | C1 | C2 | C3 |
ROW4 | C1 | C2 | C3 |
ROW5 | C1 | C2 | C3 |
ROW6 | C1 | C2 | C3 |




System.Runtime.InteropServices.COMException wurde nicht behandelt.
HelpLink="G:\\Program Files\\Microsoft Office\\OFFICE11\\1031\\wdmain11.chm#25471"
Message="Es können keine individuellen Reihen in dieser Sammlung adressiert werden, weil die Tabelle vertikal verbundene Zellen enthält."
Source="Microsoft Word"
ErrorCode=-2146822297
StackTrace:
bei Microsoft.Office.Interop.Word.Rows.get_Item(Int32 Index)
bei WindowsApplication3.Form1.AddKategorieHeader(Table oTable, Int32 row, String text) in G:\Users\leo\Documents\Visual Studio 2005\Projects\WindowsApplication3\WindowsApplication3\Form1.cs:Zeile 114.
bei WindowsApplication3.Form1.button1_Click(Object sender, EventArgs e) in G:\Users\leo\Documents\Visual Studio 2005\Projects\WindowsApplication3\WindowsApplication3\Form1.cs:Zeile 93.
bei System.Windows.Forms.Control.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
bei System.Windows.Forms.Button.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.Run(Form mainForm)
bei WindowsApplication3.Program.Main() in G:\Users\leo\Documents\Visual Studio 2005\Projects\WindowsApplication3\WindowsApplication3\Program.cs:Zeile 17.
bei System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()