ASP reads tabular data from a Word document

Source: Internet
Author: User


There is a table in the Word document with the following table
----------------

|-serial number | name |
----------------
| 1 | AA |
----------------
|   2 | bb |
------------------


I want to get the name of the value {that is AA,BB}, I use the macro to explore the ASP program, but the following ASP program reported "Set Mysel =

ListWord.Application.Selection "Missing objects?" Are the following procedures not known correctly or not?
<%
Set Listword = Server.CreateObject ("Word.Application")
ListWord.Documents.Add Server.MapPath ("Weihu/importfile") & "Wwww.doc",,, True
Listword.visible = True
Set Mysel = ListWord.Application.Selection
Mysel.Find.ClearFormatting
Mysel.Find.Replacement.ClearFormatting
Mysel.Find.Text = "ordinal"
With Thisdocument.tables (1)
For I = 1 to. Columns.count
If InStr (1,. Cell (1, I), "serial number") > 0 Then
r = I
Exit for
End If
Next
MsgBox R
End With
Listword.quit
Set Listword = Nothing
%>

Method Two

<%
Response. Contenttype= "Application/x-msword"

Const adTypeBinary = 1
Dim strFilePath

strFilePath = "C:mainmenu.doc"

Set objstream = Server.CreateObject ("ADODB. Stream ")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath

Response.BinaryWrite Objstream.read

objStream.Close
Set objstream = Nothing
%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.