cancel
Showing results for 
Search instead for 
Did you mean: 

Table cell text view special design

former_member540174
Participant
0 Kudos

I have a table where when the contents of the text view is set to a certain value I want the text design to be reference otherwise standard.

In my view context I created a node TableFormatting with an element "ClockInDesign" of type TextViewDesign cardinatlity 0...n with a supply function.

When I view the output all elements have the same format --- though if I message out the contents of the tableformat node's elements there are 12 of them and they are different based on how I set them.

Here is the supply function


public void supplyTableFormatting(IPrivateDetailView.ITableFormattingNode node, IPrivateDetailView.IContextElement parentElement)
  {
    //@@begin supplyTableFormatting(IWDNode,IWDNodeElement)
	
	for (int i=0;i<wdContext.nodeEmployeesTime().size();i++)
	{
		ITableFormattingElement elem = wdContext.nodeTableFormatting().                                                                                
createTableFormattingElement();
		if (wdContext.nodeEmployeesTime().getEmployeesTimeElementAt(i).
                                                                          getClockInTs().indexOf("Weekend") == -1)
		{			
			elem.setClockInDesign(WDTextViewDesign.GROUP_TITLE);
		} 
		else
		{
			elem.setClockInDesign(WDTextViewDesign.REFERENCE);
		}
		node.bind(elem);
	}
}

Regards,

Diane

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

That doesn't work this way. Instead, add the context attribute "clockInDesign" as a calculated attribute

(readOnly=true) to the context node "EmployeesTime".

If adding attributes to that node is not possible (because of structure binding), add a value node

"Formatting" (c=1:1,s=1:1,singleton=false) and add the attribute to that value node.

Implement the calculated attribute like this:


WDTextViewDesign getEmployeesTimeClockInDesign(IEmployeesTimeElement element)
{
  return element.getClockInTs().indexOf("Weekend") == -1
    ? WDTextViewDesign.GROUP_TITLE
    : WDTextViewDesign.REFERENCE;
}

Using a calculated attribute is not mandatory but appropriate for this use-case.

Armin

Answers (0)