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

Last change on this file since 10573 was 10573, checked in by chi, 19 years ago

Modifications (re-compile in the WindowsXP+MSoffice2000) for allowing this script have backward
compatability with MS office Automation features.

  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 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 = LCase(Command())
44 'MsgBox ("Command:" + cmdln)
45 'cmdln = Chr(34) & "H:\chi\gsdl\collect\WordTest\import\word01.doc" & Chr(34) & Chr(34) & "H:\chi\gsdl\collect\WordTest\tmp\word01.html" & Chr(34)
46 src = Trim(Left(cmdln, (InStr(cmdln, ".doc") + 4)))
47 src = Mid(src, 2, Len(src) - 2)
48 If InStr(src, ":") <> 2 Then src = CurDir + "\" + src
49
50 dst = Trim(Right(cmdln, Len(cmdln) - (InStr(cmdln, ".doc") + 4)))
51 dst = Mid(dst, 2, Len(dst) - 2)
52 If InStr(dst, ":") <> 2 Then dst = CurDir + "\" + dst
53
54 'Creat a Word Application
55 Set wa = CreateObject("Word.application")
56 wa.Visible = True
57
58 'Open a Word Document
59 Dim wd As Word.Documents
60 Set wd = wa.Documents
61
62 wd.Open (src)
63 'wd(1).SaveAs dst, HTMLFileFormat();
64 wd(1).SaveAs dst, wdFormatHTML
65
66 wd(1).Close
67
68 ' Quite Word Application
69 wa.Quit
70
71 'Release Objects
72 Set wa = Nothing
73 Set wd = Nothing
74
75 End
76End Sub
77Function getoutput(line)
78 cmdln = line
79 While InStr(cmdln, ".ppt")
80 cmdln = LTrim(Right(cmdln, Len(cmdln) - (InStr(cmdln, ".ppt") + 3)))
81 Wend
82 If Right(CurDir, 1) = "\" Then cmdln = CurDir + cmdln Else cmdln = CurDir + "\" + cmdln
83 If LTrim(cmdln) = "" Then cmdln = cmdln + "out"
84 If Right(cmdln, 1) <> "\" Then cmdln = cmdln + "\"
85 getoutput = cmdln
86End Function
87
88Function getargs(line)
89 x = LTrim(line)
90 If InStr(x, "-") = 1 Then
91 getargs = Left(line, InStr(line, " "))
92 End If
93End Function
94
95Function getdir(line)
96 x = LTrim(Right(line, Len(line) - Len(getargs(line))))
97 If InStr(x, ":") <> 2 Then
98 direc = CurDir
99 If Right(direc, 1) <> "\" Then direc = direc + "\"
100 End If
101
102 While InStr(x, "\")
103 direc = direc + Left(x, InStr(x, "\"))
104 x = Right(x, Len(x) - InStr(x, "\"))
105 Wend
106 getdir = direc
107End Function
108
109Function getfile(line)
110 x = LTrim(Right(line, Len(line) - Len(getargs(line))))
111 While InStr(x, "\")
112 x = Right(x, Len(x) - InStr(x, "\"))
113 Wend
114 getfile = x
115End Function
Note: See TracBrowser for help on using the repository browser.