Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get Font from a FormulaFieldDefinition? 1

Status
Not open for further replies.

michelle1981

Programmer
Jan 7, 2005
4
RO
i have smth like this:

CString strTemp;
CString strXMLText;
IFormulaFieldDefinitionPtr formula;
IFormulaFieldDefinitionsPtr formulaFields
= m_pReport->GetFormulaFields();
strTemp.Format( _T( "'%s'" ), m_arrXMLReportData.GetAt( e_Clinic ) );
formula = formulaFields->GetItemByName( _bstr_t( "Clinic" ) );
formula->Text = ( LPCTSTR )strTemp;

COULD I OBTAIN THE FONT?
 
You can't get the Font from a FormulaFieldDefinition. You need to get it from a FieldObject. Looks like you're using C or C++ there - which I can't help you with - but here is the code I tested with in VB 6:

Dim fldObj As CRAXDRT.FieldObject
Set fldObj = Report.Sections(2).ReportObjects.Item("test1")
Debug.Print fldObj.Font

You can't cast a FieldDefintion to a FieldObject, so you need to either explicity reference the section that the object is in, or loop through the Report's sections, loop through its objects for your formula, and get the Font property from there. In VB, that would look like this:

Dim crxSections As CRAXDRT.Sections
Dim crxFieldObj As CRAXDRT.FieldObject
For i = 1 To Report.Sections.Count
For j = 1 To Report.Sections(i).ReportObjects.Count
If Report.Sections(i).ReportObjects(j).Kind = 1 Then '1 = crFieldObject
Set crxFieldObj = Report.Sections(i).ReportObjects(j)
If crxFieldObj.Field.Name = "{@test}" Then
Debug.Print crxFieldObj.Font
End If
End If
Next j
Next i

Hope that points you in the right direction.

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top