Skip to main content
13-Aquamarine
June 2, 2025
Solved

Custom Data Utility Multiline Text Display Issue After Upgrade

  • June 2, 2025
  • 2 replies
  • 1278 views

Version: Windchill 13.0

 

Use Case: Custom Data Utility Multiline Text Display Issue After Upgrade


Description:

Hi there,

 

I'm experiencing an issue with the display of multiline text from a custom Data Utility after upgrading our Windchill environment from version 11.2 to 13.0.

 

I've developed a custom Data Utility which is used to display specific text information, retrieved from an attached Excel document, on the Attributes-Structure tab of WTParts( Thanks to @HelesicPetr  for idea 🙂 ).

 

This text data is structured to include multiple lines for readability (e.g., containing section headers and descriptions).

 

In Windchill 11.2, this Data Utility successfully displayed the text with proper line breaks, effectively creating a multiline output within the UI field/cell where the Data Utility is rendered.

 

1.png

 

However, after upgrading to Windchill 13.0, the exact same Data Utility code now displays all the text as a single continuous line. The intended line breaks are ignored, making the displayed information difficult to read and interpret.

2.png

Steps Taken (Troubleshooting):

  1. I confirmed that the Data Utility logic correctly reads the data from the Excel file and builds the output string with standard newline characters (\n) at the intended break points.

  2. Based on the observation that \n characters were not being interpreted as line breaks in 13.0, we modified the Data Utility code to explicitly replace the newline characters (\n) with HTML <br> tags before setting the value to the TextDisplayComponent.

  3. Upon viewing the modified Data Utility output in Windchill 13.0, we observed that the <br> tags themselves are displayed as literal text within the UI, rather than being interpreted as HTML line breaks. This indicates that the output of the TextDisplayComponent is being escaped and treated as plain text by the rendering mechanism in Windchill 13.0, despite our attempts to insert HTML.

 

Expected Behavior:

We expect the custom Data Utility to display the text with proper line breaks, as it did in Windchill 11.2, for improved readability.

 

Thank you for your time and assistance.

 

 

Btw here my code snippet for set value for textcomponent:

// Seviye değiştiyse veya ilk seviye ise
 	if (level != null && !level.equals(currentLevel)) {
 	currentLevel = level;

 	if (combinedValues.length() > 0) {
 	combinedValues.append("\n"); 
 	}
 	combinedValues.append("----------------------------------------").append(currentLevel).append("----------------------------------------").append("\n");
 	}
 	if (text != null && !text.isEmpty()) {
 	combinedValues.append(text).append("\n");
 	}
 	}

 	if (combinedValues.length() > 0) {
 	return combinedValues.toString();
 	}
 	} catch (Exception e) {
 	System.out.println("Error processing Excel file for document: " + latestDoc.getNumber());
 	e.printStackTrace();
 	}
 	}
 	}
 	} catch (Exception e) {
 	System.out.println("Error in getCombinedColumnAValues for part: " + part.getNumber());
 	e.printStackTrace();
 	}
 	return null;
 	}
 private TextDisplayComponent createTextDisplayComponent(String componentId, String value) {
 TextDisplayComponent textComp = new TextDisplayComponent(null);

 textComp.setId(componentId); 
 textComp.setValue(value); 
 textComp.setLongTextDisplayMode(true);
 textComp.disableMoreLink();
 // textComp.setTruncationLength(4000);
 textComp.setCheckXSS(false);
 
 return textComp;
 }

Anil.

Best answer by HelesicPetr

Hello @Anil_SAD 

I've found a right component to use 

very simple text with BR separator 

HelesicPetr_1-1750086830036.png

 

results

HelesicPetr_0-1750086803017.png

 

 You just have to use RichText datautility and set a value

use extends com.ptc.core.components.factory.dataUtilities.RichTextDataUtility

and return a com.ptc.core.components.rendering.guicomponents.RichTextDisplayComponent

public class MyFunction extends RichTextDataUtility
{
	@Override
	public Object getDataValue(String componentId, Object datum, ModelContext mc) throws WTException
	{
		Object retValue = super.getDataValue(componentId, datum, mc);
		if (retValue instanceof AttributeDisplayCompositeComponent)
		{
			AttributeDisplayCompositeComponent dc = (AttributeDisplayCompositeComponent) retValue;
			RichTextDisplayComponent ricText = (RichTextDisplayComponent) dc.getValueDisplayComponent();
			String combinedValues = "text enter text </BR> system separator text </BR> text next row";
			if (combinedValues != null)
			{
				ricText.setValue(combinedValues);
				return ricText;
			}
		}
		return null;
	}
}

 PetrH

2 replies

Fadel
23-Emerald I
June 2, 2025

take a look at https://www.ptc.com/en/support/article/CS362159 , change seems to be implemented in WC12

Buiꓘa
avillanueva
23-Emerald I
23-Emerald I
June 2, 2025

@Fadel is right on. I had to recode some of my customization to account for Rich Text change. 

Community Moderator
June 9, 2025

Hello @Anil_SAD,

 

It looks like you have some responses from some community members. If any of these replies helped you solve your question, please mark the appropriate reply as the Accepted Solution. 

Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Vivek N.
Community Moderation Team.