Skip to main content
Solved

Convert rich text to simple text (report designer)

  • November 25, 2020
  • 1 reply
  • 871 views

Forum|alt.badge.img

i tried to display the field “InventoryItem.Body” and i get a HTML return i just want to get only the values in the fields in report designer

Best answer by Hughes Beausejour

I have a detailed answer for this question on Stack Overflow:

https://stackoverflow.com/a/59869303/7376238

 

The solution is to create a custom field and use the Html2PlainText helper method to extract the text content from the HTML field (body):

#region DescriptionAsPlainText
public abstract class descriptionAsPlainText : PX.Data.BQL.BqlString.Field<descriptionAsPlainText> { }

private string _plainText;
[PXString(IsUnicode = true)]
[PXUIField(Visible = false)]
public virtual String DescriptionAsPlainText
{
    get
    {
        return _plainText ?? (_plainText = PX.Data.Search.SearchService.Html2PlainText(this.Description));
    }
}
#endregion

View original
Did this topic help you find an answer to your question?

1 reply

Hughes Beausejour
Acumatica Employee
Forum|alt.badge.img+2
  • Acumatica Developer Support Team
  • 91 replies
  • Answer
  • November 25, 2020

I have a detailed answer for this question on Stack Overflow:

https://stackoverflow.com/a/59869303/7376238

 

The solution is to create a custom field and use the Html2PlainText helper method to extract the text content from the HTML field (body):

#region DescriptionAsPlainText
public abstract class descriptionAsPlainText : PX.Data.BQL.BqlString.Field<descriptionAsPlainText> { }

private string _plainText;
[PXString(IsUnicode = true)]
[PXUIField(Visible = false)]
public virtual String DescriptionAsPlainText
{
    get
    {
        return _plainText ?? (_plainText = PX.Data.Search.SearchService.Html2PlainText(this.Description));
    }
}
#endregion


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings