Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the format of the word Document

Priyashani Perera October 15, 2012

I dont need to make display all the custom fields in my word document though they are visible in Jira interface. Only few defined fields like rough estimate time, verification are needed to take though URL fields are available in my issue... Is it possible to show only our prefered fields in word document...

Please some1 help....

4 answers

1 accepted

0 votes
Answer accepted
Bhushan Nagaraj
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 16, 2012

Try this

## List custom fields
#foreach ($tabs in $fieldScreenRenderer.fieldScreenRenderTabs)
    #foreach ($layoutItem in $tabs.fieldScreenRenderLayoutItems)
        #if ($layoutItem.orderableField.hasValue($issue) && $layoutItem.orderableField.customFieldType.descriptor.viewTemplateExists == true)
            #if($layoutItem.orderableField.name=="Verification" || $layoutItem.orderableField.name=="roughestimate")
                <tr>
                    <td bgcolor="#f0f0f0" width="20%" valign="top"><b>$textutils.htmlEncode($layoutItem.orderableField.name):</b></td>
                    <td id="${layoutItem.orderableField.id}-${issue.id}-value" class="value" bgcolor="#ffffff" width="80%">$wordView.getCustomFieldHtml($layoutItem.fieldLayoutItem, $layoutItem.orderableField, $issue)</td>
                </tr>
            #end
        #end
    #end
#end

Priyashani Perera October 16, 2012

K nbhushan I got the answer finally................. Thank u so so so much frnd.... Its a big thing... Thanx alot................. :) :) :)

Pavel Zozulka
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 1, 2015

I tried to get the value from a custom field without using a loop, and I get some extra text returned: When using the foreach loop above, the returned string is: John Smith When using the below method, the returned string is: {null=John Smith} $customFieldManager.getCustomFieldObject("customfield_10003").getValue($issue)

0 votes
mwarton
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2013

Hi,

For future reference a much easier way to do this than programming with velocity templates is to use a plugin designed specifically for this purpose. Intelligent Reports lets you easily design your export template in Microsoft Word and and point and click choose which data goes where in the document, no programming required. It supports custom fields and many other features.

0 votes
Priyashani Perera October 16, 2012

kkk thanx Nic... I hv one more question...

I wnt to show only 2 custom fields in the Word doc. Not all the custom fields in the issues...
Bt since they had applied a for each loop I cnt get wt I need

## List custom fields

#foreach ($tabs in $fieldScreenRenderer.fieldScreenRenderTabs)
#foreach ($layoutItem in $tabs.fieldScreenRenderLayoutItems)
#if ($layoutItem.orderableField.hasValue($issue) && $layoutItem.orderableField.customFieldType.descriptor.viewTemplateExists == true)

<h2><li><b>$textutils.htmlEncode($layoutItem.orderableField.name):</b></h2></li>
$wordView.getCustomFieldHtml($layoutItem.fieldLayoutItem, $layoutItem.orderableField, $issue)

#end
#end
#end

cn u plz tell me a way to adjust it..... In where do I need to chage... My new custom fields were textfields name Verification and roughestimate

0 votes
Bhushan Nagaraj
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 15, 2012
Priyashani Perera October 15, 2012

Thanx nbhushan ... this is nt the answer I need.... cn u tell me

## issue_descriptiontable_word

<div id="descriptionArea">

#if ($fieldVisibility.isFieldHidden($issue.project.getLong('id'), 'description', $issue.issueTypeObject.id) == false && $issue.description && $issue.description.length() > 0)
<font color="Black"><b><h2><li>Description: </h2></b></font></li>
$wordView.getRenderedContent('description', $issue.description, $issue)
#end

the meaning of this cording and is it relate to show all the custom fields in the word document ? can't I customize it nbhushan?

It ws available under issueviews in "single-word-vm".....

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 15, 2012

That's a chunk of "velocity template language". It really is mostly a template for generating html - statements that start with a # are procedural within velocity, things that start with a $ are either variables, or the results of calls back into the java application behind it, and everything else is simply output into the result.

The segment you've got there is am html <div> block, with "if the description field is available and the description for the current issue has something in it, then output the description, rendered for word" as the content.

For the custom fields, I'd simply read the rest of the .vm stuff you have found - it's in there somewhere, and you'll need to read the documentation that @nbhushan pointed you to alongside the .vm files

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events