Changing the format of the word Document

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

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

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

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)

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

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

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

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.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

189 views 4 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you