Symptom
See this Community post for all of the details: https://answers.sap.com/questions/12991374/text-interpretation-lost.html
Environment
Crystal Report for Visial Studio SP 26
Reproducing the Issue
Example of how to:
When I change the text of a Paragraph Text Element inside a Text Object, I lose the Text Interpretation (RTF Text, HTML Text) of all fields inside that Text Object.
In fact, when I read the Text Format of a Paragraph Field Element, no matter what I've set in design mode, I always get "crTextFormatStandardText". And any modification made are not applied.
I'm testing with version 13.0.26.
using ReportDefModel = CrystalDecisions.ReportAppServer.ReportDefModel;
private void test()
{
CrystalDecisions.CrystalReports.Engine.ReportDocument reportDocument = crystalReportViewer1.ReportSource as CrystalDecisions.CrystalReports.Engine.ReportDocument;
foreach (ReportDefModel.ISCRReportObject reportObject in reportDocument.ReportClientDocument.ReportDefController.ReportObjectController.GetReportObjectsByKind(ReportDefModel.CrReportObjectKindEnum.crReportObjectKindText))
{
ReportDefModel.TextObject textObject = reportObject as ReportDefModel.TextObject;
foreach (ReportDefModel.Paragraph paragraph in textObject.Paragraphs)
foreach (ReportDefModel.ParagraphElement paragraphElement in paragraph.ParagraphElements)
switch (paragraphElement.Kind)
{
case ReportDefModel.CrParagraphElementKindEnum.crParagraphElementKindText:
ReportDefModel.ParagraphTextElement paragraphTextElement = paragraphElement as ReportDefModel.ParagraphTextElement;
paragraphTextElement.Text = "new text";
/**
* this will make me lose the Text Interpretation (RTF Text, HTML Text) of all fields objects inside the Text Object
*/
reportDocument.ReportClientDocument.ReportDefController.ReportObjectController.Modify(textObject, textObject);
break;
case ReportDefModel.CrParagraphElementKindEnum.crParagraphElementKindField:
ReportDefModel.ParagraphFieldElement paragraphFieldElement = paragraphElement as ReportDefModel.ParagraphFieldElement;
/**
* in design mode, I have set all field objects with Text Interpretation to HTML Text, but
* paragraphFieldElement.FieldFormat.StringFormat.TextFormat return crTextFormatStandardText
* I will set to crTextFormatHTMLText
*/
paragraphFieldElement.FieldFormat.StringFormat.TextFormat = ReportDefModel.CrTextFormatEnum.crTextFormatHTMLText;
/**
* this will make me lose the Text Interpretation (RTF Text, HTML Text) of all fields objects inside the Text Object
* I have set to crTextFormatHTMLText, but with no effect
*/
reportDocument.ReportClientDocument.ReportDefController.ReportObjectController.Modify(textObject, textObject);
break;
}
}
}
Resolution
This issue has been escalated to R&D for a solution
Keywords
cr for vs, text interpretation, paragraph https://answers.sap.com/questions/12991374/text-interpretation-lost.html , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem