Export and print word document

Hello,

When I baseline my module, I would want to do several things by pressing the export command :

- export it as a Word document and,

- save it as a PDF (print function I suppose on Word)

 

Is it possible to make that by DXL and how?


Estebell - Tue Oct 29 04:57:37 EDT 2013

Re: Export and print word document
llandale - Tue Oct 29 14:48:12 EDT 2013

Here is an example of invoking the native Word Exporter with DXL:

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014305335&ps=25

You can then tell Word to "Save-As" a PDF file, but you would get into OLE automation.  Here are the key commands:

  •  put(oaaArgs, "OutputFileName", in_NameFile_PDF)   // full windows path of desired output file name
  •  put(oaaArgs, "ExportFormat",   lc_Word_wdExportFormatPDF)  // constant value is 17
  •  oleMethod(in_oaoDoc, "ExportAsFixedFormat", oaaArgs)

-Louie

 

 

Re: Export and print word document
etleg - Thu Oct 31 05:59:54 EDT 2013

Hi,

Normally the standard format/style of an export don't satisfy the company standards, so you have to modify the word export anyway.

Then they are two ways (which I know) to do it.

-first one is to do it like Louie wrote, modify the word export function, as for me I am not a fan of this method

Anyway.

- the second way is to write a macro (vba / c#) in word and to use it, which I prefer much more, so you can combine format modification with a save as pdf function

 

 

Something like:

My modification

-what ever

'Save function

ActiveDocument.ExportAsFixedFormat OutputFileName:= _

        "path\DatName.pdf ", ExportFormat:=wdExportFormatPDF, _

        OpenAfterExport:=True, OptimizeFor:=wdExportOptimizeForPrint, Range:= _

        wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _

        IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _

        wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _

        True, UseISO19005_1:=False

    ChangeFileOpenDirectory "path"

 

You can also combine the methods by modify export function with a call of the macro.

 

I hope I could show you a road map how to implement your function.

 

German

Re: Export and print word document
Estebell - Thu Oct 31 09:00:03 EDT 2013

etleg - Thu Oct 31 05:59:54 EDT 2013

Hi,

Normally the standard format/style of an export don't satisfy the company standards, so you have to modify the word export anyway.

Then they are two ways (which I know) to do it.

-first one is to do it like Louie wrote, modify the word export function, as for me I am not a fan of this method

Anyway.

- the second way is to write a macro (vba / c#) in word and to use it, which I prefer much more, so you can combine format modification with a save as pdf function

 

 

Something like:

My modification

-what ever

'Save function

ActiveDocument.ExportAsFixedFormat OutputFileName:= _

        "path\DatName.pdf ", ExportFormat:=wdExportFormatPDF, _

        OpenAfterExport:=True, OptimizeFor:=wdExportOptimizeForPrint, Range:= _

        wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _

        IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _

        wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _

        True, UseISO19005_1:=False

    ChangeFileOpenDirectory "path"

 

You can also combine the methods by modify export function with a call of the macro.

 

I hope I could show you a road map how to implement your function.

 

German

I already modified the word export for other questions.

As these modifications used the Ole automation, I want to try to translate the VBA code you gave me into DXL script using also Ole Automation.

But I'm very quickly lost by ole automation...

Re: Export and print word document
Estebell - Thu Oct 31 09:27:30 EDT 2013

llandale - Tue Oct 29 14:48:12 EDT 2013

Here is an example of invoking the native Word Exporter with DXL:

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014305335&ps=25

You can then tell Word to "Save-As" a PDF file, but you would get into OLE automation.  Here are the key commands:

  •  put(oaaArgs, "OutputFileName", in_NameFile_PDF)   // full windows path of desired output file name
  •  put(oaaArgs, "ExportFormat",   lc_Word_wdExportFormatPDF)  // constant value is 17
  •  oleMethod(in_oaoDoc, "ExportAsFixedFormat", oaaArgs)

-Louie

 

 

Is it possible to ask the user entering its path for the key command "put(oaaArgs, "OutputFileName", in_NameFile_PDF)" ?

Though each user has its own path to save the exported document.