Page 1 of 1

Font size does not work with html tag

Posted: Sun Jun 21, 2020 9:22 am
by Nuts_ethanol
I have html text that I want to display as below

Code: Select all

string htmlText = "<p style=\"text-align: center;\"><strong><span style=\"font-size: 20px;\">Text <span style=\"text-decoration: underline; font-family: 'times new roman', times, serif;\">dfdsf</span></span></strong></p>\n<p style=\"text-align: center;\">&nbsp;</p>\n<p style=\"text-align: center;\"><strong><span style=\"font-size: 20px;\"><span style=\"text-decoration: underline; font-family: 'times new roman', times, serif;\">dfdf</span></span></strong></p>\n<p style=\"text-align: center;\"><span style=\"color: #ba372a; background-color: #f1c40f;\"><strong><span style=\"font-size: 20px; background-color: #f1c40f;\"><span style=\"text-decoration: underline; font-family: 'times new roman', times, serif;\">aaa</span></span></strong></span></p>";
I generate StiText programmatically in c# and set AllowHtmlTags to true

Code: Select all

stiText.Text.Value = htmlText;
stiText.AllowHtmlTags = true;
Then I generate the rendered report as string and send them to frontend (Angular)

Code: Select all

	    report.Dictionary.Databases.Clear();
            report.RegData(dataSet);
            report.Dictionary.Synchronize();
            report.Render();
            
            return report.SaveDocumentJsonToString();
Frontend

Code: Select all

        this.viewer = new Stimulsoft.Viewer.StiViewer(options, 'StiViewer', false);
        this.report = new Stimulsoft.Report.StiReport();
        
        
        this.report.loadDocument(data);  // data is the rendered report string from backend
        this.viewer.report = this.report;
        this.viewer.renderHtml('viewer');
The font size does not get set correctly. It seems like it's using the default font of StiText to set. But I look at the rendered string sent from backend, the "Font" property does not get assigned. So I'm sure it's because of frontend. (see picture attached)

I'm using Stimulsoft.Reports.Web.NetCore 2018.2.3

Thank you in advance

Re: Font size does not work with html tag

Posted: Mon Jun 22, 2020 5:48 am
by Nuts_ethanol
I think I know. It's because of the version. If I use the latest version, the font size and font family will be shown correctly according to the html text.

So after I update the version and export to excel, all texts will set the left side. But text alignment works well when I export to word and pdf.

Re: Font size does not work with html tag

Posted: Wed Jun 24, 2020 10:45 am
by Lech Kulikowski
Hello,

Could you send us a sample that reproduces the issue for analysis?

Thank you.