Word Document Generator Service Broker

  • 18 February 2017
  • 20 replies
  • 147 views

Badge +3

K2 blackpearl service broker for word document generator template base.

In this service you will find 2 methods:

  1. Generate document: allow to user create document based on template and can set up to 15 value on the template.
  2. Generate document advance: allow to user create document based on template and can set up to 200 value on the template.

** note that 1 field can be use many time in the template and this considered 1 field.

 

Setup:

  1. Prepare and map your document template fields using (link base.docx)
  2. Save your document template to k2 server path "ex. C:DocxNDA.docx" this configure when install Service broker.
  3. Configure IIS virtual directory to output path so you can download and preview the document using url "ex. C:Docxoutput".
  4. Execute the method and pass parameter, in advance you need to pass value parameters using delimiter in sequense (ex. Value 1; value 2; value3;etc)
  5. install service broker.
    •  
    • Stop the K2 blackpearl Service.
    • Copy the dll to C:Program Files (x86)K2 blackpearlServiceBroker.
    • Start the K2 blackpearl Service.

       
  6. install Smart Object.kspx to save the output document in SMO.
  7. Build your app.

 

 


20 replies

Badge +3

Please let me know your comments after install and test the broker.

Badge +10

 

Very easy to install Broker.

 

I would suggest to include at least 3 Sample Templates with the XML Values for easy tutorial and deployment.

 

We did not follow step number 3:

Configure IIS virtual directory to output path so you can download and preview the document using url "ex. C:Docxoutput".

 

the expectation was to run the SMO and parse the result directly into a File Control or Save into a File Storage SMO into a SQL DB.

 

So basically we did noticed the creation of the file is very fast, but wondering how can we render back the File or stored it into a specific file storage SMO. to let the user download.

 

I think ability to control the FileName will be great with the option/posibility of overwrite if desired some existing files.

 

Our main question is how do you setup the SMO to store the generated Word Document if choose to save to SMO, is it using SmartBox ?, can it be setup to a particular table/ reference or need to have some specific name ?. we execute the Smart Object Tester but can't get an ID of the generated File...  any ideas ???

 

Keep doing the great job !!!.

 

Dinooz.

 

 

 

 

Badge +3

Hello K2CavMen

 

Thank you for your feed back.

 

you need to deploy "Smart Object.kspx" this allow k2 to save the file to smart object or co can create new smart object with the following details:

name:Link_Solutions_Generated_Documents_2

fields:

  • ID                                           autonumber
  • File Name                             text
  • File Byte                                file
  • Created By                           text
  • Created Date                       date/time
  • Base Template                     text

 

if you choose "Save to Smo=true" the file will be saved to the smart object and service broker return the filename and file id for ID field so you can filter by file name or ID.

Badge +3

Hi K2CaveMen.

 

Happy to hear that you able to create a word document.

 

the depoly error related to k2 version since i am moring on 4.7 and you try to deploy on old version.

Badge +10

Any chance to eventually modify/extend the slolution to let the user enter the name of an SMO and use this one as the storage, perhaps following certain convention names for the insert the Attachment and perhaps some extra fields that could return handy for integration with another Lists/Forms.

 

Possible Generic SMO to Re-Use to Store Data.


CREATE TABLE REF_ATTACHMENTS_GENERIC
(
ID int IDENTITY(1,1) PRIMARY KEY,
REF_ID int,
[File Name] varchar(max), OR Attachments nvarchar(max),
[File Byte] nvarchar(max),
[Created By] varchar(max),
[Created Date] datetime,
[Base Template] varchar(max),
Category varchar(50),
ItemDescription varchar(255)
)

CREATE TABLE REF_ATTACHMENTS_GENERIC
(
ID int IDENTITY(1,1) PRIMARY KEY,
[File Name] varchar(max), OR Attachments nvarchar(max),
[File Byte] nvarchar(max),
[Created By] varchar(max),
[Created Date] datetime,
[Base Template] varchar(max)
)

This way every Form could have their own Attachments  Table for their files separated within DB's

 

Legal Form :: SMO_Legal_Form_Table

Legal Attachments :: SMO_Legal_Atttachments

 

HR Form :: SMO_HR_Form_Table

HR Attachments :: SMO_HR_Attachments

 

Request 1 Form :: SMO_Request1_Form_Table

Request 1 Attachments :: SMO_Request1_Attachments

 

But thank you so much for hte great tool is fantastic, and can assure you with an enhancement like this will become one of the most used Apps in the K2 Market !!!.

 

keep doing the great job.

 

 

 

 

Badge +3

Hello CaveMen,

 

thank your for using this tool, i am happy to hear that you found this is a useful tool (will become one of the most used Apps in the K2 Market). actualy this is a high need for most of our k2 customers. so the company decide to add this to the market.

 

since you are intrested on this tool, i would like to appreciate your efforts so i can make a small change on the SMO to meet your requirements.

you can create many smart box with below structure and the smart object system name can be a parameter when execute the method.

also you can add any custom fields and update these fields after create the record using SMO.ID

 

Name: Any Name (system name)

fields:

  • ID                                           autonumber
  • File Name                             text
  • File Byte                                file
  • Created By                           text
  • Created Date                       date/time
  • Base Template                     text

 

i hope this meet your scenario, i will update the Service broker with new required field "SMO System Name"

 

thanks,

Najih

Badge +3

Check Version 2 :)

Hi,

 

This service broker is quite impressive. However I was wondering if it's somehow possible to dynamically add fields to a word template. For example let's say I have a template where I store all of my previous projects. However this list might potentially hold 20 projects, at the moment however there are only 5. I could obviously make a template for 20 projects and pre-provide all the fields, but this won't be nice to look at when there's few projects. Has anyone got some idea's on this?

 

Kind regards,

Matt

Badge +3

Hello MatthiasV,

 

thanks for using this service broker.

 

in this service broker there is a two methos:

  1. Generate document: allow to user create document based on template and can set up to 15 value on the template.
  2. Generate document advance: allow to user create document based on template and can set up to 200 value on the template.

using Generate document advance you can pass 200 field value with seperator ";" see attacehd file

i hope this help you for your question.

 

Thanks

Hi All

 

I am really needing help here. 

 

I am trying to save the generated document in to a sharepoint library (I dont have full sharepoit rights, So I cant use K2 for sharepoint to do this, which is the easy way). When I tried an actual physical path ex: C:Program Files (x86)K2 blackpearlDocs the word is generating in that path. But is there any way I can save the file in http://test/test/testLibrary which is a shareponit library.

 

Thank You

Badge +3

Hello @DawalaNishi,

 

New Features Added:

1- Save Output file to SharePoint Document Library

 

check new version and there is a vedio how to use this feature

Hi Nzidan, 

 

Can the template reside in another SP doc library instead of a local folder? 

 

Thanks. 

Badge +3

Hi ok1,

 

at this time this feature not avaialbe since you have yo save word template at local drive but the output you can save to sharepoint

Hello,

 

I tried it and it works fine with plain text, however when I convert the memo to Rich Text, and do the field mapping to Rich text, the data comes as xml and when I add image to the rich text, the generated word document is not opening.

 

Thanks

Badge +3

Hello,

it should be supported but not tested on 2007.

Hi,

 

I installed Docx generator and it works with your template sample.docx.

Last step I try to make my own template but it seems I need your XSD to add in my document.

I don't found how to export from your template. Note I use winword 2010. 

 

Thank you for your help

 

Jean-Christophe

 

 

 

Hi,

 

I found my solution : I paste my document in the template model.docx and I manage xml structure  using winword 2013. It works well

 

Thank you

 

Jean-Christophe

Badge +1

Hi NZidan,

 

Thanks for the solution. Excellent Job :-) Appreciated.

 

I did follow the steps (as below) and try to configure. However, the out put file is getting generated in the local server path but don't see a new folder getting created inside SharePoint Library (newly created) with the output document.

 

Steps Followed:

1.Created a directory on server, "C:Docx" and put the template document (Template Sample.docx in ZIP), "C:DocxNDA.docx"

2. Stop the K2 blackpearl Service > C:Program Files (x86)K2 blackpearlServiceBroker > K2 blackpearl Service

3. Register Service Type > Register  Service Instance

4. "Install Smart Object.kspx" didn't happen through the P & D because of version conflit. We are running on K2 Five 5.3 version, hence Generated the SmartObject manually from the Registered Service Instance.

5. Executed the Smart Object, but the output file is getting added to the local path but not on SharePoint Library. Have validated for all the permission on the SharePoint library.

 

 

In the Return Properties I see SmartObjectFileId & SharePointURL field empty.

 

Not sure If I missed any configuration or anything additional that needs to be done. Any pointers is appreciated. 

 

Also, didn't get on why & how to use the "link base.docx". Was able to generate the output document on localpath without it.

 

Thanks in advance.

 

Regards,

Ritesh, [24]7ai

 

 

 

Regads,

Ritesh

Hi,

 

We are trying to use this service broker in k2 Five (5.3) but when we are trying to executre the Smart Object, it's not generating any results. Return Propoerties are blank.

There is no error in logs. Any permission related issue? please help.

 

 

Thank you, Devi. 

Badge +3

Hi  @mmotupalli,

 

i was test this with K2 5.3 with latest cu and its working fine with no any required permissions or settings.

 

Regards,

Najih

Reply