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)); } }