在Word中插入Excel对象

 1 using Word = NetOffice.WordApi;
 2 
 3 Word.Document doc = this._wordApplication.Documents.Add(@"C:\Users\linmeicheng\Desktop\新建文件夹 (3)\Doc1.docx");
 4 
 5 Word.ContentControl contentControl = doc.ContentControls.Add();
 6 contentControl.Title = "测试";
 7 contentControl.Tag = "test";
 8 
 9 object type = @"Excel.Sheet";//插入的excel
10 contentControl.Range.InlineShapes.AddOLEObject(type);

猜你喜欢

转载自www.cnblogs.com/kingline/p/9354021.html
今日推荐