Seite 1 von 1
[erledigt] HTML als PDF oder XLS
Verfasst: Mi, 11. Jan 2017 11:30
von peternmb
Hallo,
gibt es einfache Möglichkeit meine HTML-Ausgabe in ein PDF zu konvertieren?
Die HTML-Seite erstelle ich im Programm selber zeilenweise mit set printer to xyz.html.
Re: HTML als PDF
Verfasst: Mi, 11. Jan 2017 14:58
von Wolfgang Ciriack
Wenn du Word benutzen willst:
Code: Alles auswählen
oWord := CreateObject( 'Word.Application' )
if !empty(oWord)
oWord:visible := .F.
oWord:documents:open(datei,.F.,.T.)
oDoc:=oWord:ActiveDocument
oDoc:saveas( cSaveFile, wdFormatPDF )
oDoc:close()
oWord:Quit()
oWord:destroy()
oDoc:=nil
oWord:=nil
retw:=cSavefile
endif
Re: HTML als PDF
Verfasst: Mi, 11. Jan 2017 16:28
von peternmb
Hallo,
auch mit word wäre das OK, ich erhalte aber leider die Fehlermeldung "unknows Variable wdFormatPDF"
Re: HTML als PDF
Verfasst: Mi, 11. Jan 2017 16:34
von HaPe
Hallo
wdFormatPDF
Da fehlt dir das passende DEFINE in einer ch-Datei.
Setze dafür den Wert auf 17 und es sollte laufen.
Re: HTML als PDF
Verfasst: Mi, 11. Jan 2017 18:22
von Wolfgang Ciriack
Sorry, hier sind die defines:
Code: Alles auswählen
// Enumeration WdSaveFormat
#DEFINE wdFormatDocument 0 && Microsoft Office Word format.
#DEFINE wdFormatDocument97 0 && Microsoft Word 97 document format.
#DEFINE wdFormatTemplate 1 && Word template format.
#DEFINE wdFormatTemplate97 1 && Word 97 template format.
#DEFINE wdFormatText 2 && Microsoft Windows text format.
#DEFINE wdFormatTextLineBreaks 3 && Windows text format with line breaks preserved.
#DEFINE wdFormatDOSText 4 && Microsoft DOS text format.
#DEFINE wdFormatDOSTextLineBreaks 5 && Microsoft DOS text with line breaks preserved.
#DEFINE wdFormatRTF 6 && Rich text format (RTF).
#DEFINE wdFormatEncodedText 7 && Encoded text format.
#DEFINE wdFormatUnicodeText 7 && Unicode text format.
#DEFINE wdFormatHTML 8 && Standard HTML format.
#DEFINE wdFormatWebArchive 9 && Web archive format.
#DEFINE wdFormatFilteredHTML 10 && Filtered HTML format.
#DEFINE wdFormatXML 11 && Extensible Markup Language (XML) format.
#DEFINE wdFormatXMLDocument 12 && XML document format.
#DEFINE wdFormatXMLDocumentMacroEnabled 13 && XML document format with macros enabled.
#DEFINE wdFormatXMLTemplate 14 && XML template format.
#DEFINE wdFormatXMLTemplateMacroEnabled 15 && XML template format with macros enabled.
#DEFINE wdFormatDocumentDefault 16 && Word default document file format. For Microsoft Office Word 2007, this is the DOCX format.
#DEFINE wdFormatPDF 17 && PDF format.
#DEFINE wdFormatXPS 18 && XPS format.
// Enumeration WdExportFormat
#DEFINE wdExportFormatPDF 17 && Export document into PDF format.
#DEFINE wdExportFormatXPS 18 && Export document into XML Paper Specification (XPS) format.
Re: HTML als PDF
Verfasst: Do, 12. Jan 2017 8:50
von brandelh
es gibt bei den ActiveX Beispielen eine word.ch, die alle Definitionen der 2003 enthält.
Mit einem Tool von Xbase++ kann man auch eigene machen und die muss man einbinden.
#include "word.ch"
Re: HTML als PDF
Verfasst: Do, 12. Jan 2017 9:03
von AUGE_OHR
peternmb hat geschrieben:ich erhalte aber leider die Fehlermeldung "unknows Variable wdFormatPDF"
Code: Alles auswählen
..\XPPW32\BIN\Tlb2Ch.exe "Word.Application" >> MyWord.CH
damit kannst man solche Konstanten aus COM Objecten aufgelistet welche man mit ">>" in eine Datei umleiten kann. (im DOS Fenster)
Re: HTML als PDF
Verfasst: Do, 12. Jan 2017 12:14
von peternmb
Super, funktioniert einwandfrei - Danke.
es gibt bei den ActiveX Beispielen eine word.ch, die alle Definitionen der 2003 enthält.
Mit einem Tool von Xbase++ kann man auch eigene machen und die muss man einbinden.
habe ich nicht gefunden, bei mir gibt es die Datei nicht, weder in den Beispielen noch im Verzeichnis \include wo ich so etwas immer hinpacke.
damit kannst man solche Konstanten aus COM Objecten aufgelistet welche man mit ">>" in eine Datei umleiten kann. (im DOS Fenster)
vielen Dank für den Hinweis
Re: HTML als PDF
Verfasst: Fr, 13. Jan 2017 11:01
von peternmb
Hallo,
ist es genauso einfach dIe HTML-Seite nach Excel zu konvertieren?
PS.: ich weiß, dass ich die HTML-Tabelle direkt mit Excel öffnen kann.
Re: HTML als PDF
Verfasst: Fr, 13. Jan 2017 11:13
von Wolfgang Ciriack
Ja
Code: Alles auswählen
#define xlTypePDF 0
oExcel := CreateObject( 'Excel.Application' )
if !empty(oExcel)
oExcel:visible := .F.
oExcel:Application:DisplayAlerts:=.F.
oWorkBook:=oExcel:workbooks:open(datei,,.T.)
oWorkBook:ExportAsFixedFormat(xlTypePDF,cSaveFile)
oExcel:Quit()
oExcel:Destroy()
oExcel:=nil
retw:=cSavefile
endif
Re: HTML als PDF
Verfasst: Fr, 13. Jan 2017 11:14
von Wolfgang Ciriack
Sorry, ich dachte Excel-Datei nach PDF.
Re: HTML als PDF
Verfasst: Fr, 13. Jan 2017 11:54
von HaPe
Wolfgang war ja fast dran:
#DEFINE xlWorkbookDefault 51
oWorkBook:SaveAs(cSaveFile, xlWorkbookDefault)
Re: HTML als PDF
Verfasst: Fr, 13. Jan 2017 12:44
von peternmb
Funktiniert prima so, vielen Dank.