Topic
  • 4 replies
  • Latest Post - ‏2013-10-31T13:27:30Z by Estebell
Estebell
Estebell
52 Posts

Pinned topic Export and print word document

‏2013-10-29T08:57:37Z |

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?

Updated on 2013-10-29T08:57:47Z at 2013-10-29T08:57:47Z by Estebell
  • llandale
    llandale
    2972 Posts

    Re: Export and print word document

    ‏2013-10-29T18:48:12Z  

    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

     

     

  • etleg
    etleg
    12 Posts

    Re: Export and print word document

    ‏2013-10-31T09:59:54Z  

    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

  • Estebell
    Estebell
    52 Posts

    Re: Export and print word document

    ‏2013-10-31T13:00:03Z  
    • etleg
    • ‏2013-10-31T09:59:54Z

    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...

  • Estebell
    Estebell
    52 Posts

    Re: Export and print word document

    ‏2013-10-31T13:27:30Z  
    • llandale
    • ‏2013-10-29T18:48:12Z

    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.