Ticket #324: SaveAsHTML.macro

File SaveAsHTML.macro, 1002 bytes (added by Frank J Bruzzaniti, 15 years ago)

Open Office Macro to convert to HTML

Line 
1' Credit goes to Cuzuco's post:
2' http://www.oooforum.org/forum/viewtopic.phtml?t=31818
3
4Sub SaveAsHTML( cFile )
5cURL = ConvertToURL( cFile )
6' Open the document. Just blindly assume that the document
7' is of a type that OOo will correctly recognize and open
8' without specifying an import filter.
9oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, _
10Array(MakePropertyValue( "Hidden", True ),))
11
12Select Case LCase(Right(cFile,3))
13Case "pdf" ' PowerPoint file.
14LeFilter = " writer_web_pdf_Export"
15Case "ppt" ' PowerPoint file.
16LeFilter = "impress_html_Export"
17Case "pps" ' PowerPoint file.
18LeFilter = "impress_html_Export"
19Case "doc" ' Word file.
20LeFilter = "HTML (StarWriter)"
21Case "xls" ' Excel file.
22LeFilter = "HTML (StarCalc)"
23Case Else
24LeFilter = "xxx"
25End Select
26
27cFile = Left( cFile, Len( cFile ) - 4 ) + ".html"
28cURL = ConvertToURL( cFile )
29
30' Save the document using a filter.
31oDoc.storeToURL( cURL, Array(_
32MakePropertyValue( "FilterName", LeFilter ),)
33
34oDoc.close( True )
35End Sub
36