问题是这样的。有一些Word文档。内容是一些表格。比如一个Word文档中会有一些说明性文字,然后接着一个表格。然后又是文字。接着又是表格。
现在想通过程序,将文档中的表格信息读取出来,然后建立成数据库。问题是,如何读取word文档的信息出来。
上网搜了一些资料。还是没有太多的章法。希望给位高手能给点建议和思路。

解决方案 »

  1.   

    读取都是靠book控制的,我感觉你这类没有什么固定格式的很难
      

  2.   

    这是我去年做的练习,可能对你有帮助,同时也希望多多指教。private void button1_Click(object sender, System.EventArgs e)
    {
    System.Data.DataTable dt = new System.Data.DataTable();
    //获取选定的ID号
    string personId =listBox1.Text;
    //字符型转化为整型
    int x = Int32.Parse(personId);
    //连接数据库获取结果集
    PersonInfo pi = new PersonInfo();
    dt = pi.getPersonInfo(x); //浏览文件夹保存文件
    string savePath = "";
    FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();

    if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) 
    {
    savePath = folderBrowserDialog1.SelectedPath;
    }

    object filename = savePath + "/" + "项目任务书"; object missing = System.Reflection.Missing.Value;
    /* \endofdoc is a predefined book */
    object endOfDoc = "\\endofdoc"; 

    //Word应用程序对象
    Word._Application wordApp;
    //Word文档对象
    Word._Document wordDoc;
    wordApp = new Word.Application();
    //wordApp.Caption = "My New Caption";
    wordApp.Visible = true;
    wordDoc = wordApp.Documents.Add(ref missing, ref missing,ref missing, ref missing); //使用默认打印机打印文档
    /*
    wordDoc.PrintOut( ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,
    ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,
    ref missing,ref missing,ref missing,ref missing,ref missing);
    */            //添加页眉
    if(wordApp.ActiveWindow.ActivePane.View.Type == Word.WdViewType.wdNormalView || wordApp.ActiveWindow.ActivePane.View.Type == Word.WdViewType.wdOutlineView)
    {
    wordApp.ActiveWindow.ActivePane.View.Type = Word.WdViewType.wdPrintView;
    }
    wordApp.ActiveWindow.View.SeekView = Word.WdSeekView.wdSeekCurrentPageHeader;
    //wordApp.ActiveWindow.ActivePane.Selection.InsertAfter("Header"); string sHeader = "XXXXXX股份有限公司";
    wordApp.Selection.HeaderFooter.LinkToPrevious = false;
    wordApp.Selection.HeaderFooter.Range.Text = sHeader;
    wordApp.ActiveWindow.View.SeekView = Word.WdSeekView.wdSeekMainDocument; //Insert a paragraph at the beginning of the document.
    Word.Paragraph para1;
    para1 = wordDoc.Content.Paragraphs.Add(ref missing);
    para1.Range.Font.Bold = 1;//字体加粗
    //para1.Range.Text = "                                职工调查表";//title
    para1.Range.Font.Size = 12;
    para1.Range.Font.Name = "Arial";
                para1.Range.Text = "                            项目任务书";//title
    //para1.Format.SpaceAfter = 7.3f;    //7.3 pt spacing after paragraph.
    para1.Range.InsertParagraphAfter(); //Insert another paragraph.
    Word.Paragraph para2;
    //利用了book确定text的插入位置
    object oRng = wordDoc.Books.Item(ref endOfDoc).Range; //Insert a picture
    wordDoc.InlineShapes.AddPicture("C:\\logo_color.gif",ref missing,ref missing,ref oRng); para2 = wordDoc.Content.Paragraphs.Add(ref oRng);
    para2.Range.Text = "Id号: "+dt.Rows[0]["Id"].ToString()+"                         总消费: "+dt.Rows[0]["all_money"].ToString()+"            ";
    para2.Range.Font.Bold = 0;
    //para2.Format.SpaceAfter = 24;
    para2.Range.InsertParagraphAfter();
    //Insert a 3 x 5 table, fill it with data, and make the first row
    Word.Table table;
    Word.Range wrdRng = wordDoc.Books.Item(ref endOfDoc).Range;
    table = wordDoc.Tables.Add(wrdRng, 8, 6, ref missing, ref missing);
    table.Range.ParagraphFormat.SpaceAfter = 4;
    /*
    int r, c;
    string strText;
    //生成8行6列的表
    for(r = 1; r <= 8; r++)
    {
    for(c = 1; c <= 6; c++)
    {
    strText = "r" + r + "c" + c;
    //给表的每个格赋值
    table.Cell(r, c).Range.Text = strText;
    }
    }
    */
    //wordDoc.Paragraphs.First.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter; table.Cell(1,1).Range.Text="性别";
    table.Cell(1,2).Range.Text=dt.Rows[0]["sex"].ToString();
    table.Cell(1,3).Range.Text="年龄";
    table.Cell(1,4).Range.Text=dt.Rows[0]["age"].ToString();
    table.Cell(1,5).Range.Text= "婚否";
    table.Cell(1,6).Range.Text=dt.Rows[0]["marriage"].ToString();
    table.Cell(2,1).Range.Text= "出生地";
    table.Cell(2,2).Range.Text=dt.Rows[0]["brith_province"].ToString()+" 省 "+dt.Rows[0]["brith_city"].ToString()+" 市(县)";
                table.Cell(1,1).Range.Font.Bold = 1;//设置粗体
    table.Cell(1,1).Range.Font.Color = Word.WdColor.wdColorBlue;//设置表头字体颜色
    table.Cell(2,1).Shading.Texture = Word.WdTextureIndex.wdTexture25Percent;//设置阴影 //Add some text after the table.
    Word.Paragraph para3;
    oRng = wordDoc.Books.Item(ref endOfDoc).Range;
    para3 = wordDoc.Content.Paragraphs.Add(ref oRng);
    para3.Range.InsertParagraphBefore();
    para3.Range.Text = "注:\n     1. 此表由项目管理部门填写,主管开发的副总经理审批,发给开发部门的项目组。\n     2. 功能描述可参考有关需求文档。\n     3. 此页不足记录时,可以有附页,附页格式自定,总页数包括所有附页。";
    para3.Format.SpaceAfter = 24;
    para3.Range.InsertParagraphAfter();
                
    //限制word文档不能复制、粘贴功能,只能被查看
    if(wordApp.ActiveDocument.ProtectionType==Word.WdProtectionType.wdNoProtection)
    {
    wordApp.ActiveDocument.Protect(Word.WdProtectionType.wdAllowOnlyComments ,ref missing ,ref missing);
    } /*关闭文档而不保存*/
    //object SaveChanges  = Word.WdSaveOptions.wdDoNotSaveChanges;
    //wordDoc.Close( ref SaveChanges, ref missing, ref missing);            /*设置表第一行的属性*/
    //table.Rows.First.Range.Font.Italic = 1;
    //table.Rows.First.Range.Font.Color = Word.WdColor.wdColorBlue;//设置表头字体颜色
    //table.Rows.First.Range.Font.Bold = 1;//设置粗体
    //table.Rows.First.Shading.Texture = Word.WdTextureIndex.wdTexture25Percent;//设置阴影 //保存文档
    wordDoc.SaveAs(ref filename,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing);
    //关闭文档
    wordDoc.Close(ref missing, ref missing, ref missing);
    //推出文档
    wordApp.Quit(ref missing, ref missing, ref missing);
    }
      

  3.   

    http://support.microsoft.com/search/default.aspx?query=Word&catalog=LCID%3D2052&spid=1108&qryWt=&mode=r&cus=False
      

  4.   

    good good study,day day up~~~
      

  5.   

    我在项目中专门做的类库,还不够完善,现在拿出来大家共享。
    很希望看过或用过的朋友提出你宝贵的意见
    我的email: [email protected]
    =======================================================
    using System;
    using System.Data;
    using System.Reflection;
    using System.IO;
    using Microsoft.Office.Core;
    using System.Windows.Forms;
    using Word = Microsoft.Office.Interop.Word;namespace compass.Common
    {
        /// <summary>
        /// 作者:emanlee
        /// 功能描述:对Word进行操作
        /// 创建时间:2006-04-7
        /// 说明:在工程中需要添加 Word 11.0对象库的引用(Office 2000为Word 9.0,Office XP为Word 10.0);
        /// 方法:添加引用-com-microsoft word 11.0 object library;
        ///    需要在Dcom中配置Wordl应用程序的权限;
        ///    服务器需要安装Office2003
        /// help:Visual Studio Tools for Office 文档—〉使用 Office 对象模型实现应用程序自动化 —〉Word 任务 
        /// 目录:office开发:开发工具和语言:visual studio文档:Visual Studio Tools for Office 文档—〉
        /// 使用 Office 对象模型实现应用程序自动化 —〉Word 任务 
        /// </summary>
        public class WordLib
        {        #region Variables
            private Word.Application WordApp = null;
            private string WordOpenFileName = ""; //操作Word的路径
            private string WordSaveFileName = ""; //保存Word的路径
            object missing = System.Type.Missing;
            #endregion        #region Properties        public string OpenFileName
            {
                get
                {
                    return WordOpenFileName;
                }
                set
                {
                    WordOpenFileName = value;
                }
            }
            public string SaveFileName
            {
                get
                {
                    return WordSaveFileName;
                }
                set
                {
                    WordSaveFileName = value;
                }
            }
            #endregion        //
            //--------------------------------------------------------------------------------------------------------
            /// <summary>
            /// 构造函数;
            /// </summary>
            public WordLib()
            {
            }
            public bool NewWordApp()
            {
                if (WordApp != null) CloseWordApp();
                WordApp = new Word.ApplicationClass();
                WordApp.Visible = false;
                return true;
            }        public bool NewWordFile()
            {
                //创建基于 Normal.dot 的新文档
                object missing = System.Type.Missing;
                //object missing = System.Type.Missing;
                WordApp.Documents.Add(ref missing, ref missing, ref missing, ref missing);
                return true;
            }
            public bool NewWordFile(object template)
            {
                //使用自定义模板
                //首先检查模板文件是否存在
                if (template.ToString() == "")
                {
                    throw new Exception("请选择文件!");            }
                if (!File.Exists(template.ToString()))
                {
                    throw new Exception(template + "该文件不存在!");//该异常如何处理,由什么处理????            }
                //object template = @"C:\Test\SampleTemplate.dot";
                object missing = System.Type.Missing;
                WordApp.Documents.Add(ref template, ref missing, ref missing, ref missing);
                return true;
            }        public bool SaveWordFile(object fileName)
            {
                //保存与项目关联的文档
                Word.DocumentClass doc = WordApp.Documents.get_Item(ref fileName) as Word.DocumentClass;
                doc.Save();
                return true;
            }
            public bool SaveActiveWordFile()
            {
                //保存活动文档
                WordApp.ActiveDocument.Save();
                return true;
            }        public bool SaveWordFileAS(object fileName)
            {
                //使用 SaveAs 保存文档
                //object fileName = @"C:\Test\NewDocument.doc";            WordApp.ActiveDocument.SaveAs(ref fileName,
                    ref missing, ref missing, ref missing, ref missing, ref missing,
                    ref missing, ref missing, ref missing, ref missing, ref missing,
                    ref missing, ref missing, ref missing, ref missing, ref missing);
                return true;
            }
            public bool CloseWordFile(object fileName)
            {
                //在不提示用户的前提下关闭文档并保存所做的更改
                //fileName = "NewDocument.doc";
                object doNotSaveChanges = Word.WdSaveOptions.wdDoNotSaveChanges;
                Word.DocumentClass doc = WordApp.Documents.get_Item(ref fileName) as Word.DocumentClass;
                object missing = System.Type.Missing;
                doc.Close(ref doNotSaveChanges, ref missing, ref missing);
                return true;
            }        //--------------------------------------------------------------------------------------------------------
            /// <summary>
            /// 关闭Word文件,释放对象;最后一定要调用此函数,否则会引起异常
            /// </summary>
            /// <param></param> 
            public void CloseWordApp()
            {
                try
                {
                    if (WordApp != null)
                    {
                        WordApp = null;
                    }
                }
                finally
                {
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                }
            }
            public void Quit()
            {
                object missing = System.Type.Missing;
                WordApp.Application.Quit(ref  missing, ref  missing, ref  missing);
            }        public void Save()
            {
                 WordApp.ActiveDocument.Save();
            }
            public void SaveAs(string strFileName)
            {
                object missing = System.Type.Missing;
                object fileName = strFileName;
                 WordApp.ActiveDocument.SaveAs(ref  fileName, ref  missing, ref  missing, ref  missing, ref  missing, ref  missing, ref  missing,
               ref  missing, ref  missing, ref  missing, ref  missing, ref  missing, ref  missing, ref  missing, ref  missing, ref  missing);
            }        public void SaveAsHtml(string strFileName)
            {
                object missing = System.Type.Missing;
                object fileName = strFileName;
                object Format = (int)Word.WdSaveFormat.wdFormatHTML;
                 WordApp.ActiveDocument.SaveAs(ref  fileName, ref  Format, ref  missing, ref  missing, ref  missing, ref  missing, ref  missing,
               ref  missing, ref  missing, ref  missing, ref  missing, ref  missing, ref  missing, ref  missing, ref  missing, ref  missing);
                 WordApp.ActiveDocument.Close(ref  missing, ref  missing, ref  missing);        }
            public void CopyAll()
            {
                WordApp.Selection.WholeStory();
                WordApp.Selection.Copy();        }
      

  6.   

    public void PasetAll()
            {            WordApp.Selection.PasteAndFormat(Word.WdRecoveryType.wdPasteDefault);        }
            public void Clear()
            {
                //删除整个文档的内容
                object Unit = (int)Word.WdUnits.wdCharacter;
                object Count = 1;
                WordApp.Selection.WholeStory();
                WordApp.Selection.Delete(ref  Unit, ref  Count);
            }        public void InsertText(string strText)
            {
                WordApp.Selection.TypeText(strText);
            }
            public void InsertLineBreak()
            {
                WordApp.Selection.TypeParagraph();
            }
            public void InsertLineBreak(int nline)
            {
                for (int i = 0; i < nline; i++)
                    WordApp.Selection.TypeParagraph();
            }        public void SetAlignment(string strType)
            {
                switch (strType)
                {
                    case "Center":
                        WordApp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
                        break;
                    case "Left":
                        WordApp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft;
                        break;
                    case "Right":
                        WordApp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight;
                        break;
                    case "Justify":
                        WordApp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphJustify;
                        break;
                }
            }
            public void SetFont(string strType)
            {
                switch (strType)
                {
                    case "Bold":
                        WordApp.Selection.Font.Bold = 1;
                        break;
                    case "Italic":
                        WordApp.Selection.Font.Italic = 1;
                        break;
                    case "Underlined":
                        WordApp.Selection.Font.Subscript = 0;
                        break;
                }        }
            public void SetFont()
            {
                WordApp.Selection.Font.Bold = 0;
                WordApp.Selection.Font.Italic = 0;
                WordApp.Selection.Font.Subscript = 0;        }
            public void SetFontName(string strType)
            {
                WordApp.Selection.Font.Name = strType;        }
            public void SetFontSize(int nSize)
            {
                WordApp.Selection.Font.Size = nSize;        }
            public void InsertPagebreak()
            {            object pBreak = (int)Word.WdBreakType.wdPageBreak;
                WordApp.Selection.InsertBreak(ref  pBreak);
            }        public void GotoBookMark(string strBookMarkName)
            {            object missing = System.Type.Missing;
                object Book = (int)Word.WdGoToItem.wdGoToBook;
                object NameBookMark = strBookMarkName;
                WordApp.Selection.GoTo(ref  Book, ref  missing, ref  missing, ref  NameBookMark);
            }
            public void GoToTheEnd()
            {            object missing = System.Type.Missing;
                object unit;
                unit = Word.WdUnits.wdStory;
                WordApp.Selection.EndKey(ref  unit, ref  missing);        }
            public void GoToTheBeginning()
            {            object missing = System.Type.Missing;
                object unit;
                unit = Word.WdUnits.wdStory;
                WordApp.Selection.HomeKey(ref  unit, ref  missing);        }
            public void GoToTheTable(int ntable)
            {
                object missing = System.Type.Missing;
                object what;
                what = Word.WdUnits.wdTable;
                object which;
                which = Word.WdGoToDirection.wdGoToFirst;
                object count;
                count = 1;
                WordApp.Selection.GoTo(ref  what, ref  which, ref  count, ref  missing);
                WordApp.Selection.Find.ClearFormatting();
                WordApp.Selection.Text = "";
            }
            public void GoToRightCell()
            {            object missing = System.Type.Missing;
                object direction;
                direction = Word.WdUnits.wdCell;
                WordApp.Selection.MoveRight(ref  direction, ref  missing, ref  missing);
            }
            public void GoToLeftCell()
            {            object missing = System.Type.Missing;
                object direction;
                direction = Word.WdUnits.wdCell;
                WordApp.Selection.MoveLeft(ref  direction, ref  missing, ref  missing);
            }
            public void GoToDownCell()
            {            object missing = System.Type.Missing;
                object direction;
                direction = Word.WdUnits.wdLine;
                WordApp.Selection.MoveDown(ref  direction, ref  missing, ref  missing);
            }
            public void GoToUpCell()
            {            object missing = System.Type.Missing;
                object direction;
                direction = Word.WdUnits.wdLine;
                WordApp.Selection.MoveUp(ref  direction, ref  missing, ref  missing);
            }
            public void InsertPageNumber(string strType, bool bHeader)
            {
                object missing = System.Type.Missing;
                object alignment;
                object bFirstPage = false;
                object bF = true;
                switch (strType)
                {
                    case "Center":
                        alignment = Word.WdPageNumberAlignment.wdAlignPageNumberCenter;
                        //WordApp.Selection.HeaderFooter.PageNumbers.Item(1).Alignment = Word.WdPageNumberAlignment.wdAlignPageNumberCenter;
                        break;
                    case "Right":
                        alignment = Word.WdPageNumberAlignment.wdAlignPageNumberRight;
                        //WordApp.Selection.HeaderFooter.PageNumbers.Item(1).Alignment = Word.WdPageNumberAlignment.wdAlignPageNumberRight;
                        break;
                    case "Left":
                        alignment = Word.WdPageNumberAlignment.wdAlignPageNumberLeft;
                        WordApp.Selection.HeaderFooter.PageNumbers.Add(ref  alignment, ref  bFirstPage);
                        break;
                }
            }        //--------------------------------------------------------------------------------------------------------        private void ReleaseAllRef(Object obj)
            {//ReleaseComObject()方法可以使RCW减少一个对COM组件的引用,并返回减少一个引用后RCW对COM组件的剩余引用数量。
                //我们用一个循环,就可以让RCW将所有对COM组件的引用全部去掉。
                try
                {
                    while (System.Runtime.InteropServices.Marshal.ReleaseComObject(obj) > 1) ;
                }
                finally
                {
                    obj = null;
                }
            }        //public Word.Book GetBook(object bookName)
            //{ 
            ////WordApp.ActiveDocument.Books        //}        public void UpdateBook(Word.Book book, string newText)
            {
                object rng = book.Range;
                string bookName = book.Name;
                book.Range.Text = newText;
                WordApp.ActiveDocument.Books.Add(bookName, ref rng);
            }
      

  7.   

    public void UpdateBook(string bookName, string newText)
            {
                object name = bookName;
                Word.Range rng = WordApp.ActiveDocument.Books.get_Item(ref name).Range;
                rng.Text = newText;
                object range = rng;
                WordApp.ActiveDocument.Books.Add(bookName, ref range);
            }        public void UpdateTableContent(int tableID, int lineID, int columnID, string context)
            {//更改某表的某个单元格的内容
                Word.Table tbl = WordApp.ActiveDocument.Tables[tableID];
                tbl.Cell(lineID, columnID).Range.Text = context;
            }        //将图片添加到文档中当前选定的位置
            //调用 InlineShapes 对象的 AddPicture 方法,并传入文件名。
            public void InsertPicture(string bookName, string pictureFileName)
            {
                object name = bookName;
                Word.Range rng = WordApp.ActiveDocument.Books.get_Item(ref name).Range;
                rng.InlineShapes.AddPicture(pictureFileName,
            ref missing, ref missing, ref missing);
            }
            public void InsertPicture(string pictureFileName)
            {
                WordApp.Selection.InlineShapes.AddPicture(pictureFileName,
            ref missing, ref missing, ref missing);
            //    rng.InlineShapes.AddPicture(pictureFileName,
            //ref missing, ref missing, ref missing);
            }        public void DeleteBook(string bookName)
            {
                //删除书签
                //object name = bookName;
                //Word.Range rng = WordApp.ActiveDocument.Books.get_Item(ref name).Range;
                //object wd = Word.WdUnits.wdCharacter;
                //rng.Delete(wd, 1);
            }        public void DeleteText(string text)
            {
                //删除查找到的文本
                object findText = text;
                object replaceWith = "";
                object replaceAll = Word.WdReplace.wdReplaceAll; 
                this.WordApp.Selection.Find.ClearFormatting();
                this.WordApp.Selection.Find.Replacement.ClearFormatting(); 
                this.WordApp.Selection.Find.Replacement.Text = ""; 
                this.WordApp.Selection.Find.Execute(ref findText,
                     ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
                     ref missing, ref missing, ref replaceWith, ref replaceAll, ref missing, ref missing,
                     ref missing, ref missing);            object unit = (int)Word.WdUnits.wdCharacter;
                object count = 1;
                this.WordApp.Selection.Delete(ref unit, ref count);
            }
            public int CountPage()
            {
                //统计页数
                Word.WdStatistic stat = Word.WdStatistic.wdStatisticPages;
                int num = this.WordApp.ActiveDocument.ComputeStatistics(stat, ref missing);
                return num;
            }    }
    }
      

  8.   

    谢谢了。。
    很少看到Word分析的实例。只有Word读取的。相关帮助又找不到所以很郁闷
      

  9.   

    谢谢各位的帮助。刚尝试着打开文档并提取其中表格的信息。相关代码如下:object oFileName = @"C:\Documents and Settings\liush\My Documents\TestDoc.doc";
    object oReadOnly = true;
    object oMissing = System.Reflection.Missing.Value;Word._Application oWord;
    Word._Document oDoc;
    oWord = new Word.Application();
    oWord.Visible = true;
    oDoc = oWord.Documents.Open(ref oFileName, ref oMissing, ref oReadOnly, ref oMissing, ref oMissing,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);//MessageBox.Show(oDoc.Tables.Count.ToString());
    for (int tablePos = 1; tablePos <= oDoc.Tables.Count; tablePos++)
    {
        Word.Table nowTable = oDoc.Tables.Item(tablePos);
        string tableMessage = string.Format("第{0}/{1}个表:\n", tablePos, oDoc.Tables.Count);    for (int rowPos = 1; rowPos <= nowTable.Rows.Count; rowPos++)
        {
            for (int columPos = 1; columPos <= nowTable.Columns.Count; columPos++)
            {
    tableMessage += nowTable.Cell(rowPos, columPos).Range.Text;
    tableMessage = tableMessage.Remove(tableMessage.Length - 2, 2);//remove \r\a
    tableMessage += "\t";
            }        tableMessage += "\n";
        }    MessageBox.Show(tableMessage);
    }TestDoc.doc是有着几个n*m的表信息的文档,如下:
    The first table:
    11 12 13 14 15
    21 22 23 24 25
    31 32 33 34 35
    41 42 43 44 45
    The second table:
    Aa Ab Ac Ad
    Ba Bb Bc Bd
    The third table:
    一一 一二 一三 一四 一五
    二一 二二 二三 二四 二五现在就是提取出表对表进行分析,对我来说足够了。如果还有更多需要。我按楼上给的地址找到了这篇帮助,如下:
    http://msdn2.microsoft.com/zh-CN/library/78whx7s6.aspx给我最大的启示就是:用com用C#就是自虐,还是vb结合的更好一些