下面是我写的代码.可是运行的时候速度慢的无法忍受。要是有几百条线段估计要20多分钟;
int numRows = numLsegs;
int numCols = 6;
object [,] data = new object[ numRows, numCols ];
FillTableData(out numCols, out numRows, out data);
object start = 0 ;
object end = wDoc.Characters.Count ;
Word.Range range = wDoc.Range(ref start ,ref end);
object defaultTableBehavior = true;
object autoFitBehavior = true;
Word.Table table = wDoc.Tables.Add(range,numRows,numCols,ref defaultTableBehavior,ref autoFitBehavior);
table.Cell( row, 1).Range.Text = "线段编号";
table.Cell( row, 2).Range.Text = "端点x1";
table.Cell( row, 3).Range.Text = "端点y1";
table.Cell( row, 4).Range.Text = "端点x2";
table.Cell( row, 5).Range.Text = "端点y2";
table.Cell( row, 6).Range.Text = "长度l";
for (int r = 1; r <= numRows; r++)
{
for (int c = 1; c <= numCols; c++)
{
table.Cell(r, c).Range.Text = (string)data[r - 1, c - 1];
}
}
试了各种方法都很慢 恳请这里的高手指点一下
[此贴子已经被作者于2006-2-22 15:17:39编辑过] |