Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > .NET Frameworks (точка нет фреймворки) > Общие вопросы .NET
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 12.12.2009, 12:55   #1
Cpluser
Форумчанин
 
Аватар для Cpluser
 
Регистрация: 16.02.2009
Сообщений: 555
По умолчанию Excel Word C#

Есть у кавото простый примери работы с екселем или вордо!
Выложыте пожалуста!
дайте инфу!
Cpluser вне форума Ответить с цитированием
Старый 14.12.2009, 11:08   #2
Hollander
Участник клуба
 
Аватар для Hollander
 
Регистрация: 03.05.2007
Сообщений: 1,189
По умолчанию

Word: http://www.c-sharpcorner.com/UploadF...utomation.aspx
Excel: http://www.codeproject.com/KB/cs/Sim...utomation.aspx
Hollander вне форума Ответить с цитированием
Старый 14.12.2009, 21:27   #3
Cpluser
Форумчанин
 
Аватар для Cpluser
 
Регистрация: 16.02.2009
Сообщений: 555
По умолчанию

Я подключил Microsoft Excel 11.0 Object Library!
Код:
private void button4_Click(object sender, EventArgs e)
        {
            ExcelAuto excel = new ExcelAuto();
            ArrayList array = new ArrayList();
            

                array.Insert(0, textBox1.Text);
                array.Insert(1, textBox2.Text);

                excel.CreateFile(array);
            
       }
        public void CreateFile(ArrayList array)
        {
            object missing = System.Reflection.Missing.Value;
            object fileName = "normal.dot";
            object newTemplate = false;
            object docType = 0;
            object isVisible = true;

            ExcelApp = new Excel.ApplicationClass();
            ExcelApp.Visible = true;
            objBook = ExcelApp.Workbooks.Add(missing);
            objSheet = (Excel.Worksheet)objBook.Sheets["Sheet1"];
            objSheet.Name = "It's Me";

            objSheet.Cells[1, 1] = "Details";
            objSheet.Cells[2, 1] = "Name : " + array[0].ToString();
            objSheet.Cells[3, 1] = "Age : " + array[1].ToString();

            objSheet.get_Range("A1", "A1").Font.Bold = true;
            objSheet.get_Range("A1", "A6").EntireColumn.AutoFit();
            objSheet.get_Range("A1", "A7").BorderAround(Excel.XlLineStyle.xlContinuous,
                       Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic,
                       Excel.XlColorIndex.xlColorIndexAutomatic);


        }
error CS0246: The type or namespace name 'ExcelAuto' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'ExcelAuto' could not be found (are you missing a using directive or an assembly reference?)
error CS0103: The name 'ExcelApp' does not exist in the current context
error CS0103: The name 'ExcelApp' does not exist in the current context
error CS0103: The name 'objBook' does not exist in the current context
error CS0103: The name 'ExcelApp' does not exist in the current context
error CS0103: The name 'objSheet' does not exist in the current context
error CS0103: The name 'objBook' does not exist in the current context
error CS0103: The name 'objSheet' does not exist in the current context
error CS0103: The name 'objSheet' does not exist in the current context
error CS0103: The name 'objSheet' does not exist in the current context
error CS0103: The name 'objSheet' does not exist in the current context
error CS0103: The name 'objSheet' does not exist in the current context
error CS0103: The name 'objSheet' does not exist in the current context
error CS0103: The name 'objSheet' does not exist in the current context

В чем может быть проблема:????
Cpluser вне форума Ответить с цитированием
Старый 14.12.2009, 21:48   #4
SunKnight
Участник клуба Подтвердите свой е-майл
 
Аватар для SunKnight
 
Регистрация: 14.12.2007
Сообщений: 1,434
По умолчанию

1) не весь листинг
2) http://msdn.microsoft.com/ru-ru/library/w7xf6dxs.aspx - описание ошибки
Проповедую design patterns, верую в MVC, доверяю eXtrime programming.
SunKnight вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
преобразование из Word в Excel afelia Microsoft Office Word 17 03.03.2012 10:21
к темам из Excel в Word serafim09 Microsoft Office Excel 2 23.10.2009 10:02
Синхронизация excel и word? ru3000 Microsoft Office Excel 1 20.07.2009 21:09
Из word в Excel Biosasha Microsoft Office Word 0 15.02.2007 22:32