word2pdf

This forum is for ideas and or code to be contributed for general use.
Post Reply
Message
Author
Zdeno Bielik
Posts: 147
Joined: Thu Jan 28, 2010 9:24 am
Location: Nitra, Slovakia
Contact:

word2pdf

#1 Post by Zdeno Bielik »

Hi,

because of difficulties displaying word document in the Xbase++ dialog I made a small function to convert and display as a pdf version of the original file.

Have fun.

Regards
Zdeno





"Zdenko Bielik" napísal v správe news:4225f2b8$1268160d$3003c@news.alaska-software.com...

Hi all,

thanks for tips, infos and experiencies.

I also did some little search on internet and I made some "workaround" :-)

In attached example I first open MS Word document and then
- it is printed with any PDF Printer or (slowly and must be installed any
virtual pdf-driver)
- saved it as PDF or (saved file has bigger size)
- Exported to PDF (this is my current choice - fast and small)
and then showed.

Hope this maybe helps someone and finds this usefull.

TIA & Regards
Zdeno
Attachments
ActiveX-Doc2Pdf-Exp.zip
(265.15 KiB) Downloaded 1184 times

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: word2pdf

#2 Post by rdonnay »

This is interesting and may be useful, but I don't see it as something to put into eXpress++, other than as a sample program.

I use the universal web browser when I want to display a .DOC or DOCX file.

I use DCHTMLVIEWER .. NAVIGATE <cFileName>

Have you tried this?
The eXpress train is coming - and it has more cars.

Zdeno Bielik
Posts: 147
Joined: Thu Jan 28, 2010 9:24 am
Location: Nitra, Slovakia
Contact:

Re: word2pdf

#3 Post by Zdeno Bielik »

Hi Roger,

yes, I used that function some time ago, but with newer versions of IE(I have IE 11 on Win 8.1) are two problems now:

- message with choices Run/Save/Cancel is displayed when you want show any DOC(-X) file with this class
- and NEW window with MS Word app is ALWAYS OPENED

and I/user want it have into ONE Xbase++/eXpress++ dialog

just try run your sample WebBrow.prg from \exp19\samples\activex and open any DOC file

Regards
Zdeno

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: word2pdf

#4 Post by Auge_Ohr »

Zdeno Bielik wrote:because of difficulties displaying word document in the Xbase++ dialog ...
did your try DSOframer OCX ?
greetings by OHR
Jimmy

Wolfgang Ciriack
Posts: 478
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: word2pdf

#5 Post by Wolfgang Ciriack »

Hello Zdeno,
thank you for sharing this.
It would be better, to open the doc as writeprotected so that the conversation can be done without a question of Word if its in use.

Code: Select all

oWord:documents:open(( _cPath + _cFile ), .F., .T.)
_______________________
Best Regards
Wolfgang

Wolfgang Ciriack
Posts: 478
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: word2pdf

#6 Post by Wolfgang Ciriack »

And here the same for Excel-files to PDF (in short):

Code: Select all

#define xlTypePDF   0

  oExcel := CreateObject( 'Excel.Application' )
   if !empty(oExcel)
      oExcel:visible := .F.
      oExcel:Application:DisplayAlerts:=.F.
      oWorkBook:=oExcel:workbooks:open(file,,.T.)
      oWorkBook:ExportAsFixedFormat(xlTypePDF,cSaveFile)
      oExcel:Quit()
      oExcel:Destroy()
_______________________
Best Regards
Wolfgang

Post Reply