求 word,excel 的操作API....   最好给出代码 :)
下面要用的API  判断的   网上找半天只有   加文字  读文字 的....   找不到额...四、word操作部分(共25分,每题5分,本题所涉及的文档存放在“D:\A卷\DOC”文件夹下,完成操作后请保存。)
1. 请打开1.DOC文档,并按指定要求进行操作:
请为文档加上标题“奥运会圣火采集”,字体设为隶书,字形加粗,字号为26,颜色为红色,对齐方式为居中;
2. 打开WORD文档Wjz00007.DOC,将文档中字体为黑体的文字改字体为隶书。 
3. 请打开2383122.DOC文档,并按指定要求进行操作。在文档中插入剪贴画中的任一工业类图片,并设置以下的格式:图片的高度为:120磅;图片的宽度为:110磅;图片与文字的环绕方式为:紧密型;环绕位置为:左边。
4. 请打开2363105.DOC文档,并按指定要求进行操作。请将文档按以下参数进行页面设置(注意:没有指定的选项可设置任意值):纸张大小:自定义大小,纸张宽度:425.25磅,纸张高度:567磅
5.   以“Wjz00022.doc”为主文档,“Wjz00023.doc”为数据源进行邮件合并操作,并以 “成绩通知单.doc”为文件名保存在DOC目录下,要求成绩通知单上有各学生姓名及该学生各科成绩。
五、EXCEL操作部分(共35分,每题5分,本题所涉及的文档存放在“D:\A卷\XLS”文件夹下,完成操作后请保存。
1. 请打开文档x005.XLS工作簿,并按指定要求完成有关的操作。 
      A.把各条记录按类别排序 
      B.以类别为分类字段,对总价进行分类求和汇总,替换当前分类汇总,汇总结果显示在数据下方。
2.  请打开2006op2.XLS工作簿,完成下列操作:将所有文化程度是“初中”的司机筛选出来,送至G10为左上角的区域中,条件区域放在以G1为左上角的区域中。
3. 请打开2431031.XLS工作簿,按下列要求排版:
      A.把A1:G1区域设置为:字体--隶书,字号--18,加粗,字体颜色--桔黄(橙色),底纹颜色--浅青绿,水平对齐方式--跨列居中。 
      B.A2:G10区域设置为:字体--仿宋_GB2312,字号--12,字体颜色--梅红,底纹颜色--浅黄,有内外边框,水平对齐方式--居中。
4. 请打开2006js4.xls工作簿,1.在单元格E3中输入公式计算销售业绩:销售额在30000元及以上者,销售业绩为“优秀”;销售额在30000元(不包括30000)至25000元(包括25000)之间,销售业绩为“良好”;其余销售业绩为“一般”,然后复制到E4:E23,
5. 请打开文件E002.xls, 根据左面表格中的数据,在单元格K3,K8中输入需要的数据库函数,计算出正确的结果。
6. 请打开whpe005.xls工作簿,对如下的“各科考试成绩表”进行“数据透视表”的操作:按不同系别分类求出各系学生数学、物理和英语科的平均分,结果放在以G12为左上角的区域中,效果见样图
7. 请打开2441004.XLS工作簿按下列要求作图:
 图表类型为--柱形圆柱图; 
 图表的数据区域--B4:B9,D4:D9,系列按列; 
    图表标题--液晶市场份额分析; 
      有分类(X)主要网格线及数值(Z)主要网格线; 
图表放在/嵌入当前工作表中。

解决方案 »

  1.   

    只要你安装了Office,就会有这个Component,开通服务,在项目上引用相应的COM去操作就行了!
      

  2.   

    我没做过,不过我想vs里应该有对应的类库吧~!up了
      

  3.   

    using System;   
    using System.Collections.Generic;   
    using System.Text;   
    using System.IO;   
    using Microsoft.Office.Interop.Word;   
    using Microsoft.Office.Core;   
      
    namespace TestWord   
    {   
        class Program   
        {   
            static void Main(string[] args)   
            {   
                Console.WriteLine("Word 2007");   
                Microsoft.Office.Interop.Word._Application oWord = new Microsoft.Office.Interop.Word.Application();   
                oWord.Visible = true;   
                Microsoft.Office.Interop.Word._Document oDoc;   
                object oMissing = System.Reflection.Missing.Value;   
                object strFileName = "C:\\test.docx";   
                if (File.Exists((string)strFileName))   
                    File.Delete((string)strFileName);   
      
                // Create An New Word    
                oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);   
                oDoc.Paragraphs.Last.Range.Text = "Created An New word !\n\r";   
                oDoc.SaveAs(ref strFileName, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,   
                    ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,   
                    ref oMissing, ref oMissing, ref oMissing, ref oMissing);   
                oDoc.Close(ref oMissing, ref oMissing, ref oMissing);   
                oWord.Quit(ref oMissing, ref oMissing, ref oMissing);   
                Console.WriteLine("Created An New word");   
      
                // Open the Word   
                oDoc = null;   
                oWord = null;   
                oWord = new Microsoft.Office.Interop.Word.Application();   
                oDoc = oWord.Documents.Open(ref strFileName,   
                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,   
                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,   
                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);   
                oDoc.Paragraphs.Last.Range.Text = "Open The Word !\n\r";   
                Console.WriteLine("Open The New word");   
      
                // Insert a paragraph    
                Microsoft.Office.Interop.Word.Paragraph oPara1;   
                oPara1 = oDoc.Content.Paragraphs.Add(ref oMissing);   
                oPara1.Range.Text = "Heading 1";   
                oPara1.Range.Font.Bold = 1;   
                oPara1.Format.SpaceAfter = 24;    //24 pt spacing after paragraph.   
                oPara1.Range.InsertParagraphAfter();   
                Console.WriteLine("Insert a paragraph");   
      
                // Close    
                oDoc.Save();   
                oDoc.Close(ref oMissing, ref oMissing, ref oMissing);   
                oWord.Quit(ref oMissing, ref oMissing, ref oMissing);   
                Console.WriteLine("Close . Over");   
            }   
        }   
    }  
    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/LCL_data/archive/2009/07/20/4362961.aspx
      

  4.   

    using System;   
    using System.Collections.Generic;   
    using System.Text;   
    using System.Data;   
    using System.Data.OleDb;   
    using System.Data.SqlClient;   
    using System.IO;   
    using Microsoft.Office.Interop.Excel;   
    namespace TestAccess   
    {   
        class Program   
        {   
            static void Main(string[] args)   
            {   
      
                string strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;";   
                strConnection += @"Data Source=C:\Documents and Settings\v-changl\My Documents\couse.xlsx;";   
                strConnection += "Extended Properties=\"Excel 12.0 Xml;HDR=YES\";";   
                OleDbConnection objConnection = new OleDbConnection(strConnection);   
                objConnection.Open();   
                OleDbDataAdapter myCommandd = new OleDbDataAdapter("select * from [Sheet1$]", objConnection);   
                DataSet ds = new DataSet();   
                myCommandd.Fill(ds, "[Sheet1$]");   
                System.Data.DataTable dt = ds.Tables["[Sheet1$]"];   
                Console.WriteLine(dt.Columns[0].ToString());   
                Console.WriteLine(dt.Columns[1].ToString());   
                DataRow drDisplay = dt.Rows[0];   
                int[] num = new int[dt.Columns.Count];   
                for (int j = 0; ; )   
                {   
                    for (int i = 0; i < dt.Columns.Count; i++)   
                    {   
      
                        if (drDisplay[i] is DBNull) ;   
                        else  
                            num[i] += Convert.ToInt32(drDisplay[i]);   
      
                    }   
                    if (++j >= dt.Rows.Count) break;   
                    drDisplay = dt.Rows[j];   
                }   
                objConnection.Close();   
                object MissingValue = Type.Missing;   
                Microsoft.Office.Interop.Excel.Application app = new Application();   
                Microsoft.Office.Interop.Excel.Workbook wbook = app.Workbooks.Open(@"C:\Documents and Settings\v-changl\My Documents\couse.xlsx", MissingValue,   
    MissingValue, MissingValue, MissingValue,   
    MissingValue, MissingValue, MissingValue,   
    MissingValue, MissingValue, MissingValue,   
    MissingValue, MissingValue, MissingValue,   
    MissingValue);   
                Microsoft.Office.Interop.Excel.Worksheet wsheet = wbook.ActiveSheet as Microsoft.Office.Interop.Excel.Worksheet;   
                for (int i = 0; i < dt.Columns.Count; i++)   
                {   
                    //注意下面是i+1,,excel小标默认从1开始   
                    wsheet.Cells[dt.Rows.Count + 2, i + 1] = num[i].ToString();   
                }   
      
                wbook.Save();   
                wbook.Close(true, null, null);   
                System.Runtime.InteropServices.Marshal.ReleaseComObject(wsheet);   
                System.Runtime.InteropServices.Marshal.ReleaseComObject(wbook);   
                System.Runtime.InteropServices.Marshal.ReleaseComObject(app);   
                wsheet = null;   
                wbook = null;   
                app = null;   
                GC.Collect();   
            }   
        }   
    }  
    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/LCL_data/archive/2009/05/06/4154784.aspx
      

  5.   

    http://hi.baidu.com/metaza/blog/item/b277ccc4183b73ab8226ac8b.html
    word编程