cancel
Showing results for 
Search instead for 
Did you mean: 

how to read at runtime a report's FieldObject TextFormat Property

0 Kudos
301

I need to know (in vb.net) if a bound fieldobject has the property 'TextFormat' set to 'crStandardText' or 'crRTFText'.

I am not able to read at runtime this property. Can someone help me? Thanks

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

I don't have it in VB code but Google can help you find sites that can convert C# to VB.

You need to use RAS to get the info

With the ReportClientDocument object use this to determine the type:

CrystalDecisions.ReportAppServer.ReportDefModel.ReportObjects rptObjs;
rptObjs = rptClientDoc.ReportDefController.ReportObjectController.GetAllReportObjects();

foreach (CrystalDecisions.ReportAppServer.ReportDefModel.ReportObject rptObj1 in rptObjs)
{
    switch (rptObj1.Kind)
    {
        case CrReportObjectKindEnum.crReportObjectKindField:
            CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject fldObj1;
            fldObj1 = (CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject)rptObj1;

            btnReportObjects.Text += "Name: " + fldObj1.Name.ToString();
            btnReportObjects.Text += "\n Kind: " + rptObj1.Kind.ToString() + "-> " + fldObj1.DataSourceName.ToString() + "\n";
                            
            if(fldObj1.FieldFormat.StringFormat.TextFormat == CrystalDecisions.ReportAppServer.ReportDefModel.CrTextFormatEnum.crTextFormatRTFText)
                btnReportObjects.Text += "\n RTF: = true";
            if (fldObj1.FieldFormat.StringFormat.TextFormat == CrystalDecisions.ReportAppServer.ReportDefModel.CrTextFormatEnum.crTextFormatHTMLText)
                btnReportObjects.Text += "\n HTML: = true";
            if (fldObj1.FieldFormat.StringFormat.TextFormat == CrystalDecisions.ReportAppServer.ReportDefModel.CrTextFormatEnum.crTextFormatStandardText)
                btnReportObjects.Text += "\n Standard Text: = true";

...

Don

Answers (3)

Answers (3)

0 Kudos

OK, Thank you very much

0 Kudos

No, some modules you need to set not to import, that should fix the problem.

The other problem is you may need to fully qualify the call's because both Engine and RAS have the same API's. You'll have to update you qualifiers...

0 Kudos

Hi Don,

Thanks for your fast esponse, but I have a problem. I can't use ReportAppServer in the program because we have imported:

CrystalDecisions..CrystalReports.Engine, CrystalDecisions..ReportSource , CrystalDecisions.shared, CrystalDecisions.Windows.forms

and importing (using) CrystalDecisions.ReportAppServer lead to many errors in other parts of the module. It is possible not to use ReportAppServer to have the same result? Thanks