如何将一个matrix复制到Ms Word表中而不用循环与C#

我没有将整个string[4273,11]复制到Word中,但是每次循环插入每个单元格需要很多时间。 我想要做的是将整个string[4273,11]直接复制到MS Word 表格中 。 如果还有办法将Excel工作表的内容复制到MS Word中,我将不胜感激,因为它能以任何方式解决问题。

public void WriteContent(string[,] array, Word.Table oDoc) { // This is where I fill the Excel worksheet with the string [4273,11] array Range range = (Range)m_worksheet.Cells[1, 1]; range = range.get_Resize(4273, 11); // Assign the 2-d array to the Excel Range range.set_Value(Microsoft.Office.Interop.Excel.XlRangeValueDataType.xlRangeValueDefault, array); //This is Where I want to Paste the Excel "range" into the word document } 

您可以在办公应用程序之间复制和粘贴,但复制的范围很大,因此您需要一些延迟或检查。 这个回复来自于Office的知识,而不是c#。

 range.Copy(); _wordApp.Selection.Paste(); 

比你 。 我已经做了,问题是如何select一个特定的范围,所以我做到了这一点

m_Worksheet.get_Range("A1", "K5000").Copy();

This range = range.get_Resize(4273, 11);

而下一行意味着你的范围已经被选中。