| Author |
|
lantian329 Flashcom Newbie

Joined: 18 April 2005 Posts: 27
|
| Posted: 17 November 2005 at 08:38 | IP Logged
|
|
|
I want to convert PPT to SWF.
Can you give me some suggests.
Thx.
|
| Back to Top |
|
| |
arckid Flashcom Badass


Joined: 05 January 2004 Location: India Posts: 483
|
| Posted: 17 November 2005 at 08:54 | IP Logged
|
|
|
search google! You should find some command line converters (commercial or free one)
Hope this helps
__________________ Ashvin Savani (arckid)
Avinashi
Flash Platform Developer
|
| Back to Top |
|
| |
lantian329 Flashcom Newbie

Joined: 18 April 2005 Posts: 27
|
| Posted: 17 November 2005 at 09:08 | IP Logged
|
|
|
Thx!
But I want to develop the software by myself.
Could you give me some idea?
|
| Back to Top |
|
| |
jaycharles Moderator

Joined: 18 February 2004 Posts: 507
|
| Posted: 17 November 2005 at 09:12 | IP Logged
|
|
|
What I do is convert the PPT to .swf with openOffice. I need to do this from the command line for my purposes, but you could do it from the GUI as well. I export each slide to a separate .swf, as the .swf's open office creates are a little wonky and difficlut to navigate. I then use SWFCombine to stitch the Openoffice generated .swf's back into a single .swf
Both programs are free and run from the command line. For the openOffice part, you'll need to write a Macro (in basic) and a bat or shell script to run it.
The nicest part about using openoffice is that it maintains vectors from the ppt.
|
| Back to Top |
|
| |
jaycharles Moderator

Joined: 18 February 2004 Posts: 507
|
| Posted: 17 November 2005 at 09:14 | IP Logged
|
|
|
lantian329 wrote:
Thx!
But I want to develop the software by myself.
Could you give me some idea? |
|
|
that would mean a C++ or VB application... which is outside the focus of this forum.
|
| Back to Top |
|
| |
arckid Flashcom Badass


Joined: 05 January 2004 Location: India Posts: 483
|
| Posted: 17 November 2005 at 09:25 | IP Logged
|
|
|
jaycharles,
do you have compiled version for win or linux of those binaries which are able to convert ppt -> swf with commandline options.
__________________ Ashvin Savani (arckid)
Avinashi
Flash Platform Developer
|
| Back to Top |
|
| |
lantian329 Flashcom Newbie

Joined: 18 April 2005 Posts: 27
|
| Posted: 17 November 2005 at 09:25 | IP Logged
|
|
|
jaycharles wrote:
What I do is convert the PPT to .swf with openOffice. I need to do this from the command line for my purposes, but you could do it from the GUI as well. I export each slide to a separate .swf, as the .swf's open office creates are a little wonky and difficlut to navigate. I then use SWFCombine to stitch the Openoffice generated .swf's back into a single .swf
Both programs are free and run from the command line. For the openOffice part, you'll need to write a Macro (in basic) and a bat or shell script to run it.
The nicest part about using openoffice is that it maintains vectors from the ppt. |
|
|
Good idea!
Thank you very much!
I will try...
|
| Back to Top |
|
| |
jaycharles Moderator

Joined: 18 February 2004 Posts: 507
|
| Posted: 17 November 2005 at 18:53 | IP Logged
|
|
|
arckid wrote:
jaycharles,
do you have compiled version for win or linux of those binaries which are able to convert ppt -> swf with commandline options. |
|
|
Openoffice is available as linux binaries and windows installer ( http://openoffice.org ). If you want a copy of my OO Macro that handles the conversion just let me know and I'll post it here.
|
| Back to Top |
|
| |
arckid Flashcom Badass


Joined: 05 January 2004 Location: India Posts: 483
|
| Posted: 17 November 2005 at 19:45 | IP Logged
|
|
|
Please ... either post it here or mail me offlist to me@arckid.com
__________________ Ashvin Savani (arckid)
Avinashi
Flash Platform Developer
|
| Back to Top |
|
| |
jaycharles Moderator

Joined: 18 February 2004 Posts: 507
|
| Posted: 17 November 2005 at 20:43 | IP Logged
|
|
|
The OpenOffice Basic macro is below.
The macro opens the ppt document and converts each slide to an .sxi file (OO's native presentation format). The reason for this step is that I've found OO does a better job of interpreting the vectors from an sxi file as opposed taking them from the ppt. The macro then converts each of the .sxi files to an individual .swf, and deletes the .sxi
The macro also collects slide titles, and writes them to an XML file in the destination directory (described below) along with the slide .swf's
The macro is expecting the following input variables
strFile - This the full path (path... not url) to the ppt document to be converted
dirName - this the full path to the destination directory for your slides and XML file. On windows, if the directory does not exist it will be created (don't know if that happens on Linux... let me know if it does).
If you're running this macro as an automated process, I stongly suggest you createa unique destination directory for each conversion.
Here's the code. I don't know if the forum will add any whitespace or newlines when I post the code, but this is basic so you'll need to check for whitespace at the end of each line when you build your basic file. If OO spits out errors you can't track down, let me know and I'll post the basic file for download.
The code also contains what's needed if you want a PDF from the slides as well. If you wan the pdf's, just look at the comments... you'll see which line to un-comment.
Code:
REM ***** BASIC *****
Sub Main(strFile, dirName)
SplitSlides(strFile, dirName)
End Sub
Sub SplitSlides(cImpressDocToSplit, dirName)
' This is the name of the Impress document to split
' into separate documents.
' Each page of this Impress document is saved as a
' separate document, as a PDF, and also as a Flash.
'cImpressDocToSplit = "enterPathManuallyForOverrideHere"
' Open the document to find out how many pages it has.
oDoc = OpenDocument( cImpressDocToSplit )
'Create the XML file for the document titles
myNames = ""
oDrawPages = oDoc.getDrawPages()
'print aSlideNames
' Iterate over each page.
For i = 0 To oDrawPages.getCount() - 1
' Get the page object
oDrawPage = oDrawPages.getByIndex( i )
' Get the slide name
cSlideName = oDrawPage.Name
myNames = myNames+"<slide>"
myNames = myNames+"<title>"
myNames = myNames+cSlideName
'Print cSlideName
myNames = myNames+"</title>"
myNames = myNames+"</slide>"
Next
myNames = myNames+""
iNumber = Freefile
aFile = dirName + cImpressDocToSplit+"_pre.xml"
Open aFile For Output As #iNumber
Print #iNumber, myNames
Close #iNumber
nNumPages = oDoc.getDrawPages().getCount()
' Now that we know how many pages it has, close it.
oDoc.dispose()
' Get the name of the document, but without a filename suffix.
cImpressDocToSplitNoSuffix = Left( cImpressDocToSplit, Len( cImpressDocToSplit ) - 4 )
' Now loop once for each page.
nHighestPageNumber = nNumPages-1
' nPageToSave = 2
For nPageToSave = 0 To nHighestPageNumber
' Open the document.
oDoc = OpenDocument( cImpressDocToSplit )
' Delete all pages except the one we're interested in keeping
' on this loop.
DeleteAllPagesExcept( oDoc, nPageToSave )
' Prepare to save the document in multiple forms.
' First get the new filename to save it under.
'cNewName = cImpressDocToSplitNoSuffix + " -- page " + CSTR( nPageToSave + 1 )
'cNewName = dirName + cImpressDocToSplitNoSuffix + "_" + CSTR( nPageToSave + 1 )
cNewName = dirName + "\slide_" + CSTR( nPageToSave + 1 )
'print "Ouputting to " + cNewName
' Save the document as a new impress document.
oDoc.storeToURL( ConvertToURL( cNewName + ".sxi" ), Array() )
' Save it as a PDF.
'ExportToPDF( oDoc, cNewName )
' Save it as a Flash.
ExportToSWF( oDoc, cNewName )
' Close the document without saving it.
oDoc.dispose()
Next
End Sub
' Pass in the pathname to an Impress document.
' This opens the document, and returns it.
Function OpenDocument( cImpressDoc )
' Open the Impress document.
oDoc = StarDesktop.LoadComponentFromURL( ConvertToURL( cImpressDoc ), "_blank", 0, Array() )
' Return the document
OpenDocument() = oDoc
End Function
' Delete all pages of an Impress or Draw document,
' EXCEPT for a certian page that we want to keep.
Function DeleteAllPagesExcept( oDoc, nPageToKeep )
nNumPages = oDoc.getDrawPages().getCount()
nHighestPageNumber = nNumPages-1
' Delete the last page, then the page before that,
' then the page before that, until we get to the
' page to keep.
' This deletes all pages AFTER the page to keep.
nPageToDelete = nHighestPageNumber
Do while nPageToDelete > nPageToKeep
' Get the page.
oPage = oDoc.getDrawPages().getByIndex( nPageToDelete )
' Tell the document to remove it.
oDoc.getDrawPages().remove( oPage )
nPageToDelete = nPageToDelete - 1
Loop
' Delete all the pages before the page to keep.
For i = 0 To nPageToKeep - 1
' Delete the first page.
nPageToDelete = 0
' Get the page.
oPage = oDoc.getDrawPages().getByIndex( nPageToDelete )
' Tell the document to remove it.
oDoc.getDrawPages().remove( oPage )
Next
End Function
Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
Dim oPropertyValue As New com.sun.star.beans.PropertyValue
If Not IsMissing( cName ) Then
oPropertyValue.Name = cName
EndIf
If Not IsMissing( uValue ) Then
oPropertyValue.Value = uValue
EndIf
MakePropertyValue() = oPropertyValue
End Function
Sub ExportToPDF( oDoc, cFilename )
cUrl = ConvertToURL( cFilename + ".pdf" )
oArgs = Array(_
MakePropertyValue( "URL", cURL ),_
MakePropertyValue( "FilterName", "impress_pdf_Export" ),_
)
oController = oDoc.getCurrentController()
oFrame = oController.getFrame()
oDispatcher = createUnoService( "com.sun.star.frame.DispatchHelper" )
oDispatcher.executeDispatch( oFrame, ".uno:ExportTo", "", 0, oArgs() )
End Sub
Sub ExportToSWF( oDoc, cFilename )
cUrl = ConvertToURL( cFilename + ".swf" )
oArgs = Array(_
MakePropertyValue( "URL", cURL ),_
MakePropertyValue( "FilterName", "impress_flash_Export" ),_
)
oController = oDoc.getCurrentController()
oFrame = oController.getFrame()
oDispatcher = createUnoService( "com.sun.star.frame.DispatchHelper" )
oDispatcher.executeDispatch( oFrame, ".uno:ExportTo", "", 0, oArgs() )
'delete the sxi file
kill cFilename + ".sxi"
End Sub
|
|
|
As far as invoking the macro, I do it with a batch file on windows. I'm not a Linux guy, so I don't know how the shell script would be written.
Assuming the macro is located at soffice>pptConv>ppt the windows bat file would look like this:
Code:
@ECHO OFF
"c:\openOfficeInstallDir\program\soffice" -invisible "macro:///pptConv.ppt.Main(%1,%2)"
ECHO 1
|
|
|
If you saved this batch file as c:\conversion\ppt.bat, you would run from the command line like so:
Code:
c:\conversion\ppt c:\path\to\my\ppt\file.ppt c:\path\to\my\dest\dir\
|
|
|
So you know, OO can export the ppt directly to a single .swf, but it adds odd actionscript makes the .swf's hard to navigate.
Also, the individual slides create by the macro process above will have the silde graphics, anda button that covers the whole stage. Sadly... nothing has instance names, so it can be a project picking out and killing the buttons. If you have a decompiler, you'll see what I mean. I tend to place a movie clip over the slides when I use them in another .swf to kill the hand cursor.
Only way around that is to use OO to convert the ppt to pdf, and then use pdf2swf to turn the pdf into an .swf. that takes care of the navigation slopiness, but I've found that pdf2swf makes a mess of the graphics. Play around with it and you'll see what I mean.
If you're unfamiliar with installing macros on OO, check out their support forum. It took me less than a day to findwhat I needed there when I was getting started with OO.
http://www.ooforum.org
You'll also find that OO will convert just about any office document... doc, xls, and rtf included to .swf.
|
| Back to Top |
|
| |
lantian329 Flashcom Newbie

Joined: 18 April 2005 Posts: 27
|
| Posted: 18 November 2005 at 04:15 | IP Logged
|
|
|
Successfull!
Continue try to combine...
|
| Back to Top |
|
| |
stoem Big Kahuna

stoem == Stefan
Joined: 05 January 2004 Location: United Kingdom Posts: 1079
|
| Posted: 20 November 2005 at 13:19 | IP Logged
|
|
|
You can also use Flashpaper (we use the flashprinter.exe via commandline, it's undocumented) to convert PPt to swf.
stoem
__________________ Flashcomguru.com
|
| Back to Top |
|
| |
jaycharles Moderator

Joined: 18 February 2004 Posts: 507
|
| Posted: 20 November 2005 at 18:10 | IP Logged
|
|
|
stoem wrote:
You can also use Flashpaper (we use the flashprinter.exe via commandline, it's undocumented) to convert PPt to swf.
stoem
|
|
|
I've tried that... but I haven't had any success. Can you post the commands you use?
Thanks.
|
| Back to Top |
|
| |
arckid Flashcom Badass


Joined: 05 January 2004 Location: India Posts: 483
|
| Posted: 20 November 2005 at 18:54 | IP Logged
|
|
|
Stoem,
can you explain the command with sample arguments? is it like
flashpaper abc.ppt abc.swf ?
__________________ Ashvin Savani (arckid)
Avinashi
Flash Platform Developer
|
| Back to Top |
|
| |
lantian329 Flashcom Newbie

Joined: 18 April 2005 Posts: 27
|
| Posted: 21 November 2005 at 00:51 | IP Logged
|
|
|
flashprinter mytest.ppt -o output.swf
|
| Back to Top |
|
| |
lantian329 Flashcom Newbie

Joined: 18 April 2005 Posts: 27
|
| Posted: 21 November 2005 at 03:00 | IP Logged
|
|
|
jaycharles,
Can you use openOffice's ComObject to convert PPT to SWF?
I can use microsoft office's ComObject to convert PPT to JPG,so I want to ...
|
| Back to Top |
|
| |