C# 报错 This method or property is not available because this command is not avaibleTable newTable = wordDoc.Tables.Add(range,rows,columns,ref miss,ref miss);错误代码如上,求大侠指教啊如果是什么代码多时,为什么同学的机子

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/12 07:54:47

C# 报错 This method or property is not available because this command is not avaibleTable newTable = wordDoc.Tables.Add(range,rows,columns,ref miss,ref miss);错误代码如上,求大侠指教啊如果是什么代码多时,为什么同学的机子
C# 报错 This method or property is not available because this command is not avaible
Table newTable = wordDoc.Tables.Add(range,rows,columns,ref miss,ref miss);
错误代码如上,求大侠指教啊
如果是什么代码多时,为什么同学的机子可以运行.求正确的才C#操作word代码,插入表格方法

C# 报错 This method or property is not available because this command is not avaibleTable newTable = wordDoc.Tables.Add(range,rows,columns,ref miss,ref miss);错误代码如上,求大侠指教啊如果是什么代码多时,为什么同学的机子
版本问题,是不是你们俩 一个是 office2010 另一个是 2003或者2007?
给你个2010调用的例子.研究下吧
//Be sure to add this reference:
//Project>Add Reference>.NET tab>Microsoft.Office.Interop.Word
//open Word App
Microsoft.Office.Interop.Word.Application msWord = new Microsoft.Office.Interop.Word.Application();
//make it visible or it'll stay running in the background
msWord.Visible = true;
//open a new document based on the Word template.
//You shouldn't open the template directly using msWord.Documents.Open(path) unless you want to edit the template itself.
Microsoft.Office.Interop.Word.Document wordDoc = msWord.Documents.Add(@"c:\MyTemplate.dotx");
//find the bookmark
string bookmarkName = "BookmarkToFind";
if (wordDoc.Bookmarks.Exists(bookmarkName))
{
Microsoft.Office.Interop.Word.Bookmark bk = wordDoc.Bookmarks[bookmarkName];
//set the document's range to immediately after the bookmark.
//If you want to add the table *into* the bookmark, it needs to be done differently.
//This page has a good explanation of the differences between adding to the bookmark's range vs adding after the bookmark's range.
//http://gregmaxey.mvps.org/word_tip_pages/insert_text_at_or_in_bookmark.html
//It's a little more hassle because you have to re-add the bookmark after inserting into it,
//so inserting after the bookmark is usually fine less you're going to be inserting text programmatically at the same bookmark a second time.
Microsoft.Office.Interop.Word.Range rng = wordDoc.Range(bk.Range.End, bk.Range.End);
//create a table with 8 rows and 5 columns into the range.
Microsoft.Office.Interop.Word.Table tbl = wordDoc.Tables.Add(rng, 8, 5);
//set the table's borders.
tbl.Borders.InsideLineStyle = Microsoft.Office.Interop.Word.WdLineStyle.wdLineStyleSingle;
tbl.Borders.OutsideLineStyle = Microsoft.Office.Interop.Word.WdLineStyle.wdLineStyleSingle;
//merge the cells in the first row down to 2 columns (Word's cells start at 1, not at 0).
tbl.Cell(1, 1).Merge(tbl.Cell(1, 3));
//distribute the columns evenly
tbl.Rows[1].Select();
msWord.Selection.Cells.DistributeWidth();
//rows 2-5 already have 5 columns so don't touch them.
//merge rows 6-8 into single-columns rows.
for (int x = 6; x < 9; x++)
{
tbl.Cell(x,1).Merge(tbl.Cell(x,5));
}
//put the cursor in the table's first cell.
rng=wordDoc.Range(tbl.Cell(1,1).Range.Start, tbl.Cell(1,1).Range.Start);
rng.Select();

C# 报错 This method or property is not available because this command is not avaibleTable newTable = wordDoc.Tables.Add(range,rows,columns,ref miss,ref miss);错误代码如上,求大侠指教啊如果是什么代码多时,为什么同学的机子 C#调用C++的dll报错 Attempted to read or write protected memory.This is.之前用C++封装了一个DLL,后来开发了一个C#程序调用该DLL.突然发现:1:将DLL编译为“Use MFC in a Static Library”,就会出现题目报的错误2 Object doesn't support this property or method如何解决 opject doesn't support this propety or method c#中this. C#调用C++的dll总是报错 Attempted to read or write protected memory.Attempted to read or write p……C#代码:[DllImport(duxie.dll,EntryPoint = lala,CharSet = CharSet.None)]public static extern string lala();private void button1_Click(ob t=-3:0.01:3; f=t.*u(t); plot(t,f); axis([-3 3 -0.1 3.1]); 这个有什么错误,为什么报错?Undefined function or method 'u' for input arguments of type 'double'. 不知道为什么一跳转就显示This is class servlet.searchWareServlet, using the GET method登陆就没问题 就是注册和查询信息的时候就跳这个 报错的严重: Error starting endpointjava.net.SocketException: Unrecognized Windo 在Java中这样报错The method SayHi() is undefined for the type AccpTeacher是什么意思? c#中this的作用 英语翻译The try blockIf you’re inside a method and you throw an exception (or another method you call within this method throws an exception),that method will exit in the process of throwing.If you don’t want a throw to exit the method,you ca 英语翻译The economic-financial analysis经济财政分析The economic-financial analysis is a research method based on splitting up or separating an object or a phenomenon into component parts.By means of the techniques typical for this method,ea C# this和C++this 的区别? C# 里的and和or怎么表示?比如我想写一个if( this.textBox1.Text = or this.textBox2.Text =)在c#里面,这个关键词or应该用什么代替?|我试过,好像不行if(this.textBox1.Text =||this.textBox2.Text =)还是不行错误提 matlab有关函数使用的问题k=0:5;t=1;lambda=1.6;y=homework0901(k,t,lambda);plot(k,y);Undefined function or method 'homework0901' for inputarguments of type 'double'.执行不成功报错了,错在了哪里?应该如何修改?—————— matlab化简多项式报错我写了 syms a b c d;y={[(c+d)^2+(a+b+c+d)^3+.这里就报错了,说是undefined function or method 'mrdivide' for input arguments of type 'cell'之后打算写simplify(y)求助该怎么改,具体怎么写,式子里 Undefined function or method 'pdfbdec' for input arguments of type 'double'.contourlet变换经典代码中,总是对于这个函数报错y = pdfbdec(nim,pfilt,dfilt,nlevs);help文档里也米有相关定义说明,请问如何排除此问题.我是 WILL ADV IF THIS PO S/B PACKED IN X-DOCK METHOD OR NOT还有 SUITABLE PREPACKS PACK IN AN EXPORT CARTONPACK EACH GMT IN A INDIVIDUAL POLYBAG