Наши проекты:
Журнал · Discuz!ML · Wiki · DRKB · Помощь проекту |
||
ПРАВИЛА | FAQ | Помощь | Поиск | Участники | Календарь | Избранное | RSS |
[13.58.92.54] |
|
Сообщ.
#1
,
|
|
|
Учусь работать с Word с помощью C#. В программе
namespace CsWordCons { class Program { static void Main(string[] args) { Object missing = System.Reflection.Missing.Value; Object confConv = false; Object readOnly = true; Object isVisible = false; Object saveChanges = false; Object filename = @"d:\MyProgramming\CsWordCons\Документ 1.doc"; //Object filename = @"d:\MyProgramming\CsWordCons\Документ 1.docx"; Word.Application word = new Word.Application(); Word.Document doc = new Word.Document(); doc = word.Documents.Open(ref filename, ref confConv, ref readOnly); word.Visible = false; Word.Table tbl = doc.Tables[1]; string [] strArr = new string [tbl.Rows.Count - 1]; for(int i = 1; i < tbl.Rows.Count; i++) { //strArr[i] = (string) tbl.Cell(i, 4); Console.WriteLine(tbl.Cell(i, 4)); } doc.Close(ref saveChanges); word.Quit(ref saveChanges); Console.ReadKey(); } // Main } //class Program } // namespace CsWordCons Прикреплённый файлCsWordConsForum.zip (55,03 Кбайт, скачиваний: 107) |
Сообщ.
#2
,
|
|
|
В фрагменте кода
doc.Close(ref saveChanges); word.Quit(ref saveChanges); Warning 1 Ambiguity between method 'Microsoft.Office.Interop.Word._Document.Close(ref object, ref object, ref object)' and non-method 'Microsoft.Office.Interop.Word.DocumentEvents2_Event.Close'. Using method group. Warning 2 Ambiguity between method 'Microsoft.Office.Interop.Word._Application.Quit(ref object, ref object, ref object)' and non-method 'Microsoft.Office.Interop.Word.ApplicationEvents4_Event.Quit'. Using method group. Предупреждение, как я понял, о неоднозначности метода Close (Quit) и не метода Close (Quit). Как изменить этот код, чтобы предупреждения не возникали? |