从Word文件中读取目录
您好, ///阅读内容后关闭文档
我是Navaneeth,是Web开发的新手.我有一个疑问,希望有人能回答我的疑问.在这里.
我有第一页,其中包含文件上传器和确定"按钮.当我选择一个词文件并单击确定"按钮时,它将在第二页中显示该词文件的目录.我已经使用com对象来实现这一点.我已经使用了以下应用程序类.
//创建应用程序类的实例
ApplicationClass WordApp = 新 ApplicationClass ();
//设置文件名和参数
对象 fileName = TheFile;
对象 readOnly = 否 ;
对象 isVisible = true ;
//声明我不关心的参数
object 缺少= System.Reflection. 缺少 .Value;
//正在打开要检索目录的文档
文档 aDoc = WordApp.Documents.Open( ref fileName,字体> ref 丢失, ref readOnly, ref 缺少, ref 丢失, ref 丢失, ref ,缺少 ref , ref 丢失, ref 丢失, ref 丢失, ref isVisible, ref 丢失, 参考 丢失, ref 丢失, ref 缺少);
//为活动文档创建文档对象
文档 doc1 = WordApp.ActiveDocument;
aDoc.Close(
Hi, //Closing the document after reading the contents
I am Navaneeth and new to web development. I have a doubt and hope someone answers my doubt. Here it is.
I have a first page with a file uploader and a Ok button. When I select a word file and click the OK button it displays the table of contents of the word file in the second page. I have used com object to implement this. I have used the application class as follows.
//Creating instance of application class
ApplicationClass WordApp = new ApplicationClass();
//Setting file name and parameters
object fileName = TheFile;
object readOnly = false;
object isVisible = true;
//Declaring parameters that I dont care about
object missing = System.Reflection.Missing.Value;
//Opening the document to retrieve table of contents
Document aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);
//Creating a document object for the active document
Document doc1 = WordApp.ActiveDocument;
aDoc.Close(