我试图在我的word文档中将表放在第二页的特定位置,但总是会出错。我的数据库中有范围,从1049开始到1420结束。
当我输入这些值时,我收到Out of Range Value
错误。我怎样才能把桌子放在我想要的地方?
这是我的代码的一部分:
ApplicationClass wordApp = new ApplicationClass();
Document adoc = wordApp.Documents.Open(ref path, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
Microsoft.Office.Interop.Word.Table wordTable = null;
object rangeStart = null;
object rangeEnd = null;
Microsoft.Office.Interop.Word.Range rngBold = null;
rangeStart = Int32.Parse(lstTables[1].RNG_STA.ToString()); // 0 - with zero works but put in the beggining
rangeEnd = Int32.Parse(lstTables[1].RNG_END.ToString()); // 0 - with zero works but put in the beggining
rngBold = adoc.Range(ref rangeStart, ref rangeEnd);
wordTable = adoc.Tables.Add(rngBold, lstTables[1].TOTALLIN, lstTables[1].TOTALCOL, ref missing, ref missing);