当前位置: 首页>>代码示例>>C#>>正文


C# Application.DDETerminateAll方法代码示例

本文整理汇总了C#中Microsoft.Office.Interop.Word.Application.DDETerminateAll方法的典型用法代码示例。如果您正苦于以下问题:C# Application.DDETerminateAll方法的具体用法?C# Application.DDETerminateAll怎么用?C# Application.DDETerminateAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Office.Interop.Word.Application的用法示例。


在下文中一共展示了Application.DDETerminateAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: dumpText

        protected void dumpText()
        {
            DocumentUpload.SaveAs(Server.MapPath(DocumentUpload.FileName));
            object documentContainer = Server.MapPath(DocumentUpload.FileName);

            Microsoft.Office.Interop.Word.Application wordDocInstance = new Microsoft.Office.Interop.Word.Application();
            Microsoft.Office.Interop.Word.Document wordDocFile = new Microsoft.Office.Interop.Word.Document();

            object readOnly = false;
            object isVisible = true;
            object missing = System.Reflection.Missing.Value;

            wordDocFile = wordDocInstance.Documents.Open(ref documentContainer, ref missing, ref readOnly, ref missing,
                            ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible);
            docOutput.MaxLength = wordDocFile.Content.Text.Length;

            string fullDocText = wordDocFile.Content.Text;

            docOutput.Text = fullDocText;

            SyllabusParser parser = new SyllabusParser(fullDocText);

            docOutput.Text = " ";
            docOutput.Text = parser.getCurrentText();

            fullDepartmentInput.Text = parser.SyllabusDepartment;
            CourseTitleInput.Text = parser.SyllabusCourseName;
            DeptAbbrInput.Text = parser.SyllabusDepartmentAbbreviation;
            CourseNumberInput.Text = parser.SyllabusCourseNumber;
            CourseLectureHoursInput.Text = parser.LectureHours.ToString();
            CourseLabHoursInput.Text = parser.LabHours.ToString();
            CourseCreditHoursInput.Text = parser.CreditHours.ToString();
            InstructorFirstInput.Text = parser.CourseInstructorFName;
            InstructorLastInput.Text = parser.CourseInstructorLName;
            CourseCoordinatorFirstInput.Text = parser.CourseCoordinatorFName;
            CourseCoordinatorLastInput.Text = parser.CourseCoordinatorLName;
            DescriptionInput.Text = parser.DescriptionText;

            lname_list = parser.getAuthorLNameList();
            fname_list = parser.getAuthorFNameList();
            int count = fname_list.Count();

            if (count == 2)
            {
                authorFname1 = fname_list[0];
                authorFname2 = fname_list[1];
                authorLname1 = lname_list[0];
                authorLname2 = lname_list[1];
            }
            else
            {
                authorFname1 = fname_list[0];
                authorLname1 = lname_list[0];
            }

            for(int cur_index = 0; cur_index < count; cur_index++)
            {
                TableCell fname = new TableCell();
                fname.Text = fname_list[cur_index];
                TableCell lname = new TableCell();
                lname.Text = lname_list[cur_index];
                TableRow insert_row = new TableRow();
                insert_row.Cells.Add(fname);
                insert_row.Cells.Add(lname);
                AuthorTable.Rows.Add(insert_row);
            }

            TextbookTitleInput.Text = parser.TextbookTitle;
            PublisherInput.Text = parser.Publisher;
            PublishDateInput.Text = parser.PublishDate;
            ISBNInput.Text = parser.ISBNNumber;
            TableCell type = new TableCell();
            type.Text = parser.ReqType;
            TableCell reqcomment = new TableCell();
            reqcomment.Text = parser.RequisiteCourseComment;
            TableRow insert_req_row = new TableRow();
            insert_req_row.Cells.Add(type);
            insert_req_row.Cells.Add(reqcomment);
            PreReqsTable.Rows.Add(insert_req_row);

            wordDocFile.Close(ref missing, ref missing, ref missing);
            if (wordDocFile != null)
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(wordDocFile);
                wordDocFile = null;
            }
            if (wordDocInstance != null)
            {
                wordDocInstance.DDETerminateAll();
                System.Runtime.InteropServices.Marshal.ReleaseComObject(wordDocInstance);
                wordDocInstance = null;
            }

            if (File.Exists(DocumentUpload.FileName))
            {
                File.Delete(HttpContext.Current.Server.MapPath(DocumentUpload.FileName));
            }
        }
开发者ID:Tpimp,项目名称:AbetWebsite,代码行数:98,代码来源:WordDocImportPage.aspx.cs


注:本文中的Microsoft.Office.Interop.Word.Application.DDETerminateAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。