cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Report Change Text interpretation runtime is not working for database field

Yuen
Explorer
0 Kudos
267

I am trying to change the field's text interpretation to HTML at runtime but it isn't working on database field. It is working for formula field. Can anyone help?

CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject fldObject = rptObj ; CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject newClone = fldObject.Clone(true); newClone.FieldFormat.StringFormat.TextFormat = CrystalDecisions.ReportAppServer.ReportDefModel.CrTextFormatEnum.crTextFormatHTMLText;   //this is not working newClone.Format.HorizontalAlignment = CrAlignmentEnum.crAlignmentRight;  //this is working

reportDefController.ReportObjectController.Modify(fldObject, newClone);

View Entire Topic
DonWilliams
Active Contributor
0 Kudos

Always try it in CR Designer to see if it works, if it doesn't work in CRD it won't work in code.

As soon as you set the text to HTML it automatically left justifies.

DonWilliams_0-1731587251694.png

DonWilliams_2-1731587290629.png

 

 

Yuen
Explorer
0 Kudos

it is work in Crystal Report Designer. If i manually changed to HTML and save it. it works. Changing the same field in code is not working.

I put the horizontal align to right to test if the modify in the code is working. It proves that the right horizontal is working but the HTML format isn't.. 

DonWilliams
Active Contributor
0 Kudos
What versionof CR designer are you using? I testing in CR 2020 and it's not working...
Yuen
Explorer
0 Kudos
I used CR Designer 2013
DonWilliams
Active Contributor

Thanks for the update. Discussing with R&D now. They are in Shanghai so daily delays. He did note that Memo fields being a blob type field will not work, it's always been this way, but text files whould be fine. Still working on the right justification issue, it's definitely not working in CR 2020, always ignores setting in both CRD and Code... I'll update you once he confirms the issue or not...

Yuen
Explorer
0 Kudos
Thank you Don for your reply. Looking forward to hearing from you soon.
DonWilliams
Active Contributor
0 Kudos

Hi Yuen, R&D is looking at the question. they noted in CR 2010 it did not work, can you send me the report saved in 2013 with saved data? All reference material suggests this should not have worked and the only way to control the justification is to embed the justification in the HTML as a tag.

Yuen
Explorer
0 Kudos
I have tried again. Confirm that the horizontal alignment will not work if the Text interpretation is set to HTML in CR2013. Thanks for your time.
DonWilliams
Active Contributor
0 Kudos

Thanks Yeun, I asked R&D to confirm again and they said it did not work. Thanks for testing again and confirming it's not working as you first indicated. I asked them for an Enhancement request to disable the justification option when converting to HTML so it stops the confusion. As suggested, use HTML Tag's to set the justification in your data, CR will always left justify.