Discussion
Unitedhealth Group, Inc.
US
Last activity: 4 Dec 2015 5:49 EST
Generating document from attachments
I have work items with attachments in the form of word documents with screenshots in them..
Within the application I need to generate a word document based on data on the work item as well as merging in the attached word documents all to form one word document.
I tried using a word template rule and I know how to embed data from the work item in the document but I do not know how to embed attachments in the word document (-ie- merge them into the document). Please help.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
Hello,
The way we document Specification attachments in system generated documentation is using the function rule Utilities.insertAttachmentFieldCode, which adds the proper field code (pega:binary attachfile=...) with the passed in attachment data and includes the attachment in the word document. You could check out this implementation and borrow/copy as needed to include work object attachments in generated documentation.
Unitedhealth Group, Inc.
US
Hmmm. OK. Thanks. I'll look into it.
Unitedhealth Group, Inc.
US
Hmmm. I found some tag I can include. {pega:attachment attachmentName } in a word template. Might this work as well? Not sure what attachmentName is referring to however. And if it has to be hard coded in the word doc. It might not work for me since I need to be dynamic (-ie- word template wouldn't know the name of the attachment ahead of time and how many)
Pegasystems Inc.
US
Yes, that should work. Word merge should already have your work object in context, so attachmentName is likely a reference to the Data-WorkAttach-File instance. If you use attachment categories, pega:attach CategoryName might also work for you.
Unitedhealth Group, Inc.
US
I just tried the function you recommended. It work well. Think this solves my problem. Thank you very much.
igate
IN
how to save that word document with employee name.i am prepared
UI->Paragraph->HTMLStream->word document.like below the code
//get the http headers response page
ClipboardPage objHeadersPage = requestor.getProperty("pyHTTPResponseHeaders").getPageValue();
//set the contentType and ContentDisposition to get a file save/open
objHeadersPage.putString("contentType", "application/vnd.ms-word");
objHeadersPage.putString("ContentDisposition" ,"attachment;filename=\"Notes Details.doc\"");
%>
now i want how to save this document with the employee name.
please help us.
Mphasis
IN
Please let me know the steps to generate the word doc
As I have this requirement in my application.
Onlick of a button the word doc should get generated.
Tata Consultancy Services Limited
US
i also need to generate word doc. please someone help me withs steps.
thanks in advance.
Mphasis
IN
Which version of pega your are using?
Using Open Office xml this can be achieved.
Create a HTML rule and write the OOXML , the below code is OOXML which says to the doc how the layout should look and which data should go to the doc
Which version of pega your are using?
Using Open Office xml this can be achieved.
Create a HTML rule and write the OOXML , the below code is OOXML which says to the doc how the layout should look and which data should go to the doc
<?xml version="1.0"?>
<?mso-application progid="Word.Document"?>
<!-- Modified from: http://www.lenzconsulting.com/wordml/#officexml-CHP-2-SECT-5.3 -->
<w:wordDocument
xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:o="urn:schemas-microsoft-com:office:office"
xml:space="preserve">
<o:DocumentProperties>
<o:Author><pega:reference name="OperatorID.pxInsName" mode="literal"/></o:Author>
</o:DocumentProperties>
<w:styles>
<w:style w:type="table" w:styleId="MyTableStyle">
<w:name w:val="My Table Style"/>
<w:tblPr>
<w:tblBorders>
<w:top w:val="single"/>
<w:left w:val="single"/>
<w:bottom w:val="single"/>
<w:right w:val="single"/>
<w:insideH w:val="single"/>
<w:insideV w:val="single"/>
</w:tblBorders>
<w:tblCellMar>
<w:left w:w="108" w:type="dxa"/>
<w:right w:w="108" w:type="dxa"/>
</w:tblCellMar>
</w:tblPr>
</w:style>
</w:styles>
<w:body>
<w:p>
<w:r>
<w:t>Genehmigung von außerordentlichen Tarifwechseln</w:t>
</w:r>
</w:p>
<w:p>
<w:r>
<w:t/>
</w:r>
</w:p>
<w:tbl>
<w:tblPr>
<w:tblStyle w:val="MyTableStyle"/>
</w:tblPr>
<w:tr>
<w:tc>
<w:p>
<w:r>
<w:t>Region</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t> </w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t> </w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t> </w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t>Rahmenvertrags-Nr. </w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t><pega:reference name=".FCId" mode="literal"/></w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:tr>
<w:tc>
<w:p>
<w:r>
<w:t>Vertriebsteam</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t> </w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t> </w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t> </w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t>Kundenname</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t><pega:reference name=".pyCompany" mode="normal"/></w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:tr>
<w:tc>
<w:p>
<w:r>
<w:t>Vertriebskanal</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t> </w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t> </w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t> </w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t>BAN</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t><pega:reference name=".BAN" mode="literal"/></w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
</w:tbl>
<w:br/>
<w:p>
<w:r>
<w:t>Anzahl der außerordentlichen Tarifwechsel</w:t>
</w:r>
</w:p>
<w:p>
<w:r>
<w:t/>
</w:r>
</w:p>
<w:tbl>
<w:tblPr>
<w:tblStyle w:val="MyTableStyle"/>
</w:tblPr>
<w:tr>
<w:tc>
<w:p>
<w:r>
<w:t>Wechsel von Sub zu SIMO innerhalb der Mindestlaufzeit</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t><pega:reference name=".pyUIGalleryTemplateProperty2" mode="literal"/></w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:tr>
<w:tc>
<w:p>
<w:r>
<w:t>Vorzeitige Subvention</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t><pega:reference name=".pyUIGalleryTemplateProperty3" mode="literal"/></w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:tr>
<w:tc>
<w:p>
<w:r>
<w:t>Anzahl der außerordentlichen Tarifwechsel Gesamt</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t><pega:reference name=".pyUIGalleryTemplateProperty8" mode="literal"/></w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
</w:tbl>
<w:br/>
<w:p>
<w:r>
<w:t/>
</w:r>
</w:p>
<w:tbl>
<w:tblPr>
<w:tblStyle w:val="MyTableStyle"/>
</w:tblPr>
<w:tr>
<w:tc>
<w:p>
<w:r>
<w:t>Anzahl vorzeitiger VVL Sub</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t><pega:reference name=".pyUIGalleryTemplateProperty3" mode="literal"/></w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:tr>
<w:tc>
<w:p>
<w:r>
<w:t>Anzahl vorzeitiger VVL SIMOnly</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t><pega:reference name=".pyUIGalleryTemplateProperty4" mode="literal"/></w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:tr>
<w:tc>
<w:p>
<w:r>
<w:t>Anzahl der Tarifwechsel gesamt</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t><pega:reference name=".pyUIGalleryTemplateProperty9" mode="literal"/></w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
</w:tbl>
<w:p>
<w:r>
<w:t/>
</w:r>
</w:p>
<w:p>
<w:r>
<w:t>Begründung:</w:t>
</w:r>
</w:p>
<w:p>
<w:r>
<w:t/>
</w:r>
</w:p>
<w:tbl>
<w:tblPr>
<w:tblStyle w:val="MyTableStyle"/>
</w:tblPr>
<w:tr>
<w:tc>
<w:p>
<w:r>
<w:t>Anzahl zusätzliche BNTs im Rahmen des Auftrags (nur zur Information):</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:p>
<w:r>
<w:t><pega:reference name=".pyCount" mode="literal"/></w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
</w:tbl>
<w:p>
<w:r>
<w:t/>
</w:r>
</w:p>
<w:p>
<w:r>
<w:t>VB VO: ________________________</w:t>
<w:br/>
<w:t>VB Name: __________________________________________</w:t>
<w:br/>
<w:t>Datum, Unterschrift: __________________________________</w:t>
<w:br/>
<w:br/>
<w:br/>
<w:br/>
<w:t>Info zu Genehmigungsregeln:</w:t>
<w:br/>
<w:t>'- Bis zu 4 Tarifwechsel pro Vorgang: VL-Genehmigung
- Ab 5 Tarifwechsel pro Vorgang: Genehmigung durch RL/ZV HAL und FER
( Proprietary information hidden) bzw. FEP ( Proprietary information hidden) je nach Zuständigkeit.
- Für Aufträge mit einem negativen Gesamt-Umsatzeffekt ist eine Genehmigung durch RL/ZV HAL und und FER ( Proprietary information hidden) bzw. FEP ( Proprietary information hidden) je nach Zuständigkeit erforderlich.
- Für alle Aufträge mit vorzeitigen Laufzeitverlängerungen im Vertriebskanal Enterprise Partner ist eine Genehmigung durch ZV HAL erforderlich.</w:t>
</w:r>
</w:p>
<w:p>
<w:r>
<w:t/>
</w:r>
</w:p>
</w:body>
</w:wordDocument>
Create a activity
Map the properties which you want to be in the doc
Call the above HTML rule by using the method Show-Stream
Use Java method and provide the below java code
ClipboardPage objHeadersPage = tools.findPage("pxRequestor").getProperty(".pyHTTPResponseHeaders").getPageValue();
objHeadersPage.putString("contentType" ,"application/msword");
objHeadersPage.putString("ContentDisposition" ,"attachment;filename=test.doc");
Now ,call this activity behind a button , using the action Open Url in window
on click of button , word doc will be generated
Mphasis
IN
you have to modify the above OOXML according to your requirements and the proeprties in your application.