Before and our project team to brew a project, the company's business documents more technical documents, but are more scattered, although by FTP or other means of aggregation, but the feeling is not convenient.
In addition, each time the company to new employees, new employees need some training, relatively time-consuming, a better way is to record the previous configuration video and then offline to the new staff to see their own, but the time is long, the information or video is always found or not up to date and so on.
So our team thought of a project, to put the information and video from the line to online, is to be able to use a Web site to see Office materials and video. And can also evaluate the data and likes, and so on, according to like or want to learn data to decide whether to new employees or old employees to organize a communication.
The first project is to refer to the Baidu Library, the Office data into flash, video data storage directly, and then through the website to watch online, with the Flashpager this software, the general code is as follows:
String converter = Pt.getflashpaperurl () + "/flashprinter.exe-o" + Savepath + swfname + ". swf " + documentname; Process p = pro.exec (converter);
The FlashPrinter.exe is executed by calling process, and then the delivery instruction and the file to be converted can be converted.
But the company went to Windows and went to MicrosoftOffice. This EXE can only run under Windows, so a new way to automatically convert Office documents to HTML under Linux.
Due to the inability to use Microsoft Office, so the use of OpenOffice, I downloaded the local openoffice4.0.1, after the installation of the first boot monitoring:
Soffice-headless-accept= "SOCKET,HOST=127.0.0.1,PORT=8100;URP;"-nofirststartwizard &
Java code can connect to port 8100 and let OpenOffice help us convert Office documents to HTML.
The code is roughly as follows:
Openofficeconnection con = new Socketopenofficeconnection ("127.0.0.1", 8100); Con.connect ();//Create converter documentconverter converter = new openofficedocumentconverter (con);//Convert document to ask HTML Converter.convert (Docfile, htmlfile);//close OpenOffice Connection
This translates the Office document to an HTML file: Htmlfile.
But PPT by default is converted to an HTML file, each page ppt will generate a picture, and the HTML file is the form of the next page of the previous page can only see one page ppt at a time. We want to put this HTML directly on all PPT page images. So slightly changed the next, the PPT into the HTML after the folder all the pictures do rotation, and then splicing an HTML file:
<br><center></center>
The discovery was perfect after the development was completed.
But the back still encountered two pits, analyzed for a long time to find.
1, part PPT Conversion HTML is always garbled.
2. Some Word documents converted to HTML are always blank.
The above two problems toss for a long time, the problem of office always have problems, no problem office must be able to convert successfully, analyzed for a long time to find the problem.
Finally after a page of PPT, a text deletion and conversion only found.
The first question ppt, if there is a note converted to HTML through OpenOffice is garbled, and the content is very small.
The second problem is that some of the text in the Word document is copied to the OpenOffice document, which may be caused by incompatible text fonts. such as WPS Open this word, see is the song body, but the text copied to OpenOffice, found a few words is not the song body.
The workaround is temporarily:
The first issue of all PPT comments manually deleted, you can convert the success.
The second problem is a simple solution is to change the font of all the text into the same font, such as modified into the song.
Hope to give other kinds of test ideas or encounter the same problems brought help, reprint please specify from: http://lawson.cnblogs.com
To convert Office documents to some pit in the HTML process