0

I have a custom screen which contains a 'Details' Rich Text area that allows text to be shown as HTML, Plain Text, etc.

I also have a request to somehow be able to show that data on an Acumatica report. Unfortunately, even if the option for 'Plain Text' is selected, it still has formatting tags in the database field. Is there a type of field in the Acumatica report writer that can interpret data from that type of Rich Text field?

pmfith
  • 831
  • 6
  • 24

1 Answers1

0

No it is not really possible until a rich text box control is added to the report designer.

The rich text control in Acumatica web page is mostly HTML.

If you change from VISUAL to HTML you can get the HTML code.

enter image description here

If you are very motivated you can attempt to inject hack the HTML in the report. It's a very bad idea but I managed to fool the designer into accepting HTML content as the navigate URL link content.

enter image description here

When the report is rendered in HTML mode the link control inherits some of the HTML styles on top of the link style. It's silly and useless but demonstrate the underlaying mechanisms needed to make rich text editor control happen in Acumatica report designer.

enter image description here


The alternative is to create a custom field that extracts the plain text:

#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
Hugues Beauséjour
  • 8,067
  • 1
  • 9
  • 22
  • What you can look into is getting Plain Text value of the content of the Acumatica editor control. This strips the style and keeps only text content that can be displayed in the report text box. – Hugues Beauséjour Jan 22 '20 at 22:45
  • If you want to expand on injecting the HTML you will need to insert a link escape sequence or some styles with important property to remove the link styles. It's not a valid option by any means but could be the closest technically possible. – Hugues Beauséjour Jan 22 '20 at 23:01
  • There's a third option that could require extensive development but is technically possible and not a hack. You can use a library to render the rich text content to an image and display that image in the report. https://stackoverflow.com/a/17835914/7376238 – Hugues Beauséjour Jan 22 '20 at 23:28
  • Thanks much for your input on this, Hugues... ;D – pmfith Jan 24 '20 at 16:14