source: trunk/winbin/bin/word2html.frm@ 10500

Last change on this file since 10500 was 10489, checked in by kjdon, 19 years ago

A VB executable program and source program to convert Word documents to HTML format. - developed by Chi. moved from bin/windows to winbin

  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1VERSION 5.00
2Begin VB.Form Form1
3 Caption = "Form1"
4 ClientHeight = 1380
5 ClientLeft = 60
6 ClientTop = 450
7 ClientWidth = 3825
8 LinkTopic = "Form1"
9 ScaleHeight = 1380
10 ScaleWidth = 3825
11 StartUpPosition = 3 'Windows Default
12 Begin VB.Label W
13 Alignment = 2 'Center
14 Caption = "Word to HTML"
15 BeginProperty Font
16 Name = "MS Sans Serif"
17 Size = 24
18 Charset = 0
19 Weight = 400
20 Underline = 0 'False
21 Italic = 0 'False
22 Strikethrough = 0 'False
23 EndProperty
24 Height = 615
25 Left = 360
26 TabIndex = 0
27 Top = 360
28 Width = 3375
29 End
30End
31Attribute VB_Name = "Form1"
32Attribute VB_GlobalNameSpace = False
33Attribute VB_Creatable = False
34Attribute VB_PredeclaredId = True
35Attribute VB_Exposed = False
36
37Private Sub Form_Load()
38 Dim wa As Word.Application
39 Dim cmdln As String
40 Dim src As String
41 Dim dst As String
42
43 cmdln = Command()
44
45 src = Left(cmdln, (InStr(cmdln, ".doc") + 3))
46 If InStr(src, ":") <> 2 Then src = CurDir + "\" + src
47 dst = LTrim(Right(cmdln, Len(cmdln) - (InStr(cmdln, ".doc") + 3)))
48 If InStr(dst, ":") <> 2 Then dst = CurDir + "\" + dst
49
50 'Creat a Word Application
51 Set wa = CreateObject("Word.application")
52 wa.Visible = True
53
54 'Open a Word Document
55 Dim wd As Word.Documents
56 Set wd = wa.Documents
57
58 wd.Open (src)
59 'wd(1).SaveAs dst, HTMLFileFormat();
60 wd(1).SaveAs dst, wdFormatHTML
61
62 wd(1).Close
63
64 ' Quite Word Application
65 wa.Quit
66
67 'Release Objects
68 Set wa = Nothing
69 Set wd = Nothing
70
71 End
72End Sub
73Function getoutput(line)
74 cmdln = line
75 While InStr(cmdln, ".ppt")
76 cmdln = LTrim(Right(cmdln, Len(cmdln) - (InStr(cmdln, ".ppt") + 3)))
77 Wend
78 If Right(CurDir, 1) = "\" Then cmdln = CurDir + cmdln Else cmdln = CurDir + "\" + cmdln
79 If LTrim(cmdln) = "" Then cmdln = cmdln + "out"
80 If Right(cmdln, 1) <> "\" Then cmdln = cmdln + "\"
81 getoutput = cmdln
82End Function
83
84Function getargs(line)
85 x = LTrim(line)
86 If InStr(x, "-") = 1 Then
87 getargs = Left(line, InStr(line, " "))
88 End If
89End Function
90
91Function getdir(line)
92 x = LTrim(Right(line, Len(line) - Len(getargs(line))))
93 If InStr(x, ":") <> 2 Then
94 direc = CurDir
95 If Right(direc, 1) <> "\" Then direc = direc + "\"
96 End If
97
98 While InStr(x, "\")
99 direc = direc + Left(x, InStr(x, "\"))
100 x = Right(x, Len(x) - InStr(x, "\"))
101 Wend
102 getdir = direc
103End Function
104
105Function getfile(line)
106 x = LTrim(Right(line, Len(line) - Len(getargs(line))))
107 While InStr(x, "\")
108 x = Right(x, Len(x) - InStr(x, "\"))
109 Wend
110 getfile = x
111End Function
Note: See TracBrowser for help on using the repository browser.