web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Convert HTML to normal text

(0) ShareShare
ReportReport
Posted on by 4
Hi All,
 
Created one string field in parameter form. user will enter inputs in HTML format.
Need to display same field in SSRS report footer.
 
have followed below link (Written code in report DP class) and able to get text in SSRS report. but alignment is not proper. (Bold letter, Capital letter, next line are not coming properly)
 
Kindly help.
Thank you.
I have the same question (0)
  • Community member Profile Picture
    4 on at
    Currently i am using D365 finance and operations.
  • Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at
    Plain text doesn't have formatting such as bold text; that's why it's called plain. You either want plain text or formatted text; it can't be both at the same time.
  • Suggested answer
    Khan zain Profile Picture
    1 on at
    To ensure proper alignment and formatting when displaying HTML content from a string field in the SSRS report footer in Dynamics AX 2012, you can use a combination of methods to parse HTML and convert it into plain text. Here's a step-by-step approach to achieve this:
    1. **HTML to Plain Text Conversion**: Use X++ code in the report DP class to convert HTML content into plain text. You can utilize regular expressions or custom parsing logic to strip HTML tags and convert special characters.
    2. **Formatting Preservation**: Retain formatting such as bold letters, capital letters, and line breaks while converting HTML to plain text. Ensure that the conversion logic handles these elements appropriately.
    3. **Alignment**: Once the HTML content is converted to plain text, ensure proper alignment within the SSRS report footer. You may need to adjust the alignment settings in the SSRS report layout to accommodate the content correctly.
    Here's a sample code snippet demonstrating how you can achieve this in the report DP class:
    ```csharp
    public str convertHtmlToPlainText(str _html)
    {
        System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("<[^>]+>|&nbsp;");
        str plainText = regex.Replace(_html, "");
        return plainText;
    }
    public void fetchReportData()
    {
        YourTable yourTable;
        str htmlContent;
        // Fetch HTML content from the table or data source
        select firstOnly yourTable;
        htmlContent = yourTable.HTMLField;
        // Convert HTML to plain text
        str plainText = convertHtmlToPlainText(htmlContent);
        // Set plain text content to the report footer field
        this.ReportFooterField = plainText;
    }
    ```
    Replace `"HTMLField"` and `"ReportFooterField"` with the appropriate field names in your context. This code snippet will convert HTML content stored in the `HTMLField` of your table to plain text and then assign it to the report footer field for proper alignment in the SSRS report.
    By following these steps, you can ensure that HTML content is correctly displayed in the SSRS report footer with proper alignment and formatting preservation. Adjust the code as needed to fit your specific requirements and data structures.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 616

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 460 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 331 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans