Asp generates word files

Source: Internet
Author: User
<Html>

<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Meta name = "GENERATOR" content = "Microsoft FrontPage 5.0">
<Meta name = "ProgId" content = "FrontPage. Editor. Document">
<Title> generate a Word document </title>
</Head>
<Script language = "vbscript">
Sub builddoc ()
On Error Resume Next

Dim wApp
    
Set wApp = CreateObject ("Word. Application ")
If Err. number> 0 Then
Alert "cannot be saved as a Word file. Please install Word97 correctly"
Else
WApp. visible = True
WApp. Documents. add
    
WApp. Selection. TypeParagraph
WApp. Selection. Font. Bold = True
WApp. Selection. TypeText "programfan"
                     
WApp. Selection. ParagraphFormat. Alignment = 1
Rem housing
                                          
WApp. Selection. TypeParagraph
WApp. Selection. Font. Bold = false
                     
WApp. Selection. TypeText "-- programfan.com"
                        
WApp. Selection. TypeParagraph
                     
WApp. Selection. ParagraphFormat. LeftIndent = wApp. CentimetersToPoints (0)
WApp. Selection. ParagraphFormat. FirstLineIndent = wApp. CentimetersToPoints (0.72/2*2)
                      
WApp. Selection. TypeParagraph
WApp. Selection. Font. Bold = false
WApp. Selection. ParagraphFormat. Alignment = 0
                     
                       
                       
Wapp. selection. typetext document.form1.doc 1. value
WApp. Selection. TypeParagraph
                     

Rem right
WApp. Selection. TypeParagraph
WApp. Selection. Font. Bold = false
WApp. Selection. TypeText Now ()
WApp. Selection. TypeParagraph
WApp. Saved = true
Wapp. ActiveDocument. SaveAs "c: \ a.doc"
Wapp. close
                     
End if

End sub
</Script>
<Body>
<Form name = "form1">

<P> </p>
<P> <textarea rows = "8" name = "doc1" cols = "46"> </textarea> </p>
<P> </p>
<P> generate a Word document <input type = "button" value = "generate" name = "B1" onclick = "builddoc ()"> </p>

</Form>
</Body>

</Html>

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.