功能:在上传过程中拆分word文件
书签超过10个以上就不正常。
错误出现数组超出范围。
for (int i = 0; i < doc.Books.Count; i++)
{
if (i != doc.Books.Count)
{
oEnd = positions[i, 0];
}
else
{
oEnd = doc.Content.End;
} //这行数组超出范围 Range tocopy = doc.Range(ref oStart, ref oEnd);
tocopy.Copy(); Document docto = CreateDocument();
docto.Content.Paste();//贴出部分代码
private int[,] GetPosition(Document word)
{
int titleIndex = 0;
int bmcount = word.Books.Count;//书签个数为11
int[,] result = new int[bmcount, 2]; //result 结果最后两个没有赋值如: name value [1,0] 333 [1,1] 5567
…………
[9,0] 0
[9,1] 0
[10,0] 0
[10,1] 0 for (int i = 1; i <= bmcount; i++)
{
index = i;
Book bm = word.Books.get_Item(ref index);
if (bm.Name == "book" + Convert.ToString(titleIndex))
{
result[titleIndex, 0] = bm.Start;
result[titleIndex, 1] = bm.End;
titleIndex++; // 比如i循环到11后,titleIndex只是9,是否跟这个有关。
}
}
return result;
} 帮忙解决下?
书签超过10个以上就不正常。
错误出现数组超出范围。
for (int i = 0; i < doc.Books.Count; i++)
{
if (i != doc.Books.Count)
{
oEnd = positions[i, 0];
}
else
{
oEnd = doc.Content.End;
} //这行数组超出范围 Range tocopy = doc.Range(ref oStart, ref oEnd);
tocopy.Copy(); Document docto = CreateDocument();
docto.Content.Paste();//贴出部分代码
private int[,] GetPosition(Document word)
{
int titleIndex = 0;
int bmcount = word.Books.Count;//书签个数为11
int[,] result = new int[bmcount, 2]; //result 结果最后两个没有赋值如: name value [1,0] 333 [1,1] 5567
…………
[9,0] 0
[9,1] 0
[10,0] 0
[10,1] 0 for (int i = 1; i <= bmcount; i++)
{
index = i;
Book bm = word.Books.get_Item(ref index);
if (bm.Name == "book" + Convert.ToString(titleIndex))
{
result[titleIndex, 0] = bm.Start;
result[titleIndex, 1] = bm.End;
titleIndex++; // 比如i循环到11后,titleIndex只是9,是否跟这个有关。
}
}
return result;
} 帮忙解决下?
解决方案 »
- 资源文件路径在报表参数中的 写法问题
- vs2005工具箱的问题
- C#记事本问题
- 为什么 spring net (2.1.0.2)只能用log4net1.2.9.0 而不能用1.2.10.0
- 怎么判断Access数据表中的某条记录是否存在?
- C#调用ie打开一个网址后怎样才能知道网页全部显示完毕?
- 智能客户端和胖客户端、瘦客户端有什么区别?
- 使用reflector出现"未将对象引用设置到对象的实例",求高人解决。
- 如何设置openFileDialog的大小,不是显示后用鼠标来控制?
- 请教:关于treeview和数据库的问题?
- C#如何将其它指定的程序(非本C#程序)在任务栏里不显示.
- 【版务帖】2009年7月C#版务帖
{
if (i != doc.Books.Count)
{
oEnd = positions[i, 0];
}
else
{
oEnd = doc.Content.End;
} //这行数组超出范围 Range tocopy = doc.Range(ref oStart, ref oEnd);
tocopy.Copy(); 你的oStart没付值?
为什么超过10以上就不正常了,提示数组超出范围.
int [,]这个是有范围吗?
怎么用也超不出范围啊
[0, 0] 4 int
[0, 1] 18 int
[1, 0] 2272 int
[1, 1] 2291 int
[2, 0] 2813 int
[2, 1] 2835 int
[3, 0] 3264 int
[3, 1] 3288 int
[4, 0] 3720 int
[4, 1] 3748 int
[5, 0] 4362 int
[5, 1] 4389 int
[6, 0] 4956 int
[6, 1] 4983 int
[7, 0] 5565 int
[7, 1] 5591 int
[8, 0] 5974 int
[8, 1] 6000 int
[9, 0] 6534 int
[9, 1] 6557 int
[10, 0] 0 int
[10, 1] 0 int
[11, 0] 0 int
[11, 1] 0 int
[12, 0] 0 int
[12, 1] 0 int
[13, 0] 0 int
[13, 1] 0 int
[14, 0] 0 int
[14, 1] 0 int
[15, 0] 0 int
[15, 1] 0 int
[16, 0] 0 int
[16, 1] 0 int10以下全是0了.
是不是不能用int [,]二维数组啊