ALTERAR TAMANHO FONTE DE UM OBJETO CRYSTAL REPORTS

 Tópico anterior Próximo tópico Novo tópico

ALTERAR TAMANHO FONTE DE UM OBJETO CRYSTAL REPORTS

VB / VBA

 Compartilhe  Compartilhe  Compartilhe
#493234 - 26/03/2020 11:20:39

MALA
RONDONOPOLIS
Cadast. em:Janeiro/2004


Bom dia amigos, eu com mais um problema pra resolver, preciso Alterar tamanho fonte de um objeto crystal reports em runtime, conforme o tamanho da informação que vai ter neste campo eu alterar o tamanho de da fonte.


desde ja agradeço a atenção de todos.

CLESIO SANTOS


Resposta escolhida #493235 - 26/03/2020 11:54:15

FABRICIOWEB
BELO HORIZONTE
Cadast. em:Novembro/2011


Dim rpt As CRAXDRT.Report
    Dim myapp As CRAXDRT.Application
    
    'Create a new Crystal Application
    Set myapp = New CRAXDRT.Application
    
    'Open Report
    Set rpt = myapp.OpenReport("C:\test.rpt")
    
    'Loop through all the field objects in the detail section
    For i = 1 To rpt.Sections("D").ReportObjects.Count
        If TypeOf rpt.Sections("D").ReportObjects.Item(i) Is FieldObject Then
        
            'Check if the field is one we want to change the font for
            Select Case rpt.Sections("D").ReportObjects.Item(i).Field.Name
            Case "{@myString1}"
                'Change its font to Arial
                rpt.Sections("D").ReportObjects.Item(i).Font.Name = "Arial"
            Case "{@myString2}"
                'Change its font to Comic Sans MS
                rpt.Sections("D").ReportObjects.Item(i).Font.Name = "Comic Sans MS"
            End Select
            
        End If
    Next
    
    'Print results
    rpt.PrintOut False, 1, False
    
    Set rpt = Nothing
    Set myapp = Nothing




exemplo 2



  Dim CrxApp As CRAXDRT.Application
    Dim crxReport As CRAXDRT.Report
    Dim reportObject As Object
    Dim myFont As IFontDisp  'Declare a Font Object.
    Dim I As Integer
    Dim X As Integer

    Set CrxApp = New CRAXDRT.Application
    Set crxReport = CrxApp.OpenReport("H:\test\crtests\Report1.rpt")
      
    'Initialize the font object. Populate it  with the Font of the Form
    Set myFont = Me.Font
    
    'Set what fonts to display
    CommonDialog1.Flags = (cdlCFBoth Or cdlCFEffects)

    'Show the Font dialog
    CommonDialog1.ShowFont

    'Set properties of the  Font Object to what the user selected
    myFont.Bold = CommonDialog1.FontBold
    myFont.Italic = CommonDialog1.FontItalic
    myFont.Name = CommonDialog1.FontName
    myFont.Size = CommonDialog1.FontSize
    myFont.Underline = CommonDialog1.FontUnderline
    myFont.Strikethrough = CommonDialog1.FontStrikethru

    'now loop through all the sections and apply Font properties to field and text objects
    
    For I = 1 To crxReport.Sections.Count
        For X = 1 To crxReport.Sections(I).ReportObjects.Count
          Set reportObject = crxReport.Sections(I).ReportObjects.Item(X)
            If reportObject.Kind = crTextObject Or reportObject.Kind = crFieldObject Then
                reportObject.Font.Name = myFont.Name
                reportObject.Font.Bold = myFont.Bold
                reportObject.Font.Italic = myFont.Italic
                reportObject.Font.Size = myFont.Size
                reportObject.Font.Underline = myFont.Underline
                reportObject.Font.Strikethrough = myFont.Strikethrough
            End If
          Set reportObject = Nothing
        Next X
    Next I

    'Preview the report
    CRViewer91.ReportSource = crxReport
    CRViewer91.ViewReport
    
    'release the references    
    Set crxReport = Nothing
    Set crxApplication = Nothing






#493236 - 26/03/2020 12:01:50

MALA
RONDONOPOLIS
Cadast. em:Janeiro/2004


 Anexos estao visíveis somente para usuários registrados

Citação:
:
Dim rpt As CRAXDRT.Report
    Dim myapp As CRAXDRT.Application
    
    'Create a new Crystal Application
    Set myapp = New CRAXDRT.Application
    
    'Open Report
    Set rpt = myapp.OpenReport("C:    est.rpt")
    
    'Loop through all the field objects in the detail section
    For i = 1 To rpt.Sections("D").ReportObjects.Count
        If TypeOf rpt.Sections("D").ReportObjects.Item(i) Is FieldObject Then
        
            'Check if the field is one we want to change the font for
            Select Case rpt.Sections("D").ReportObjects.Item(i).Field.Name
            Case "{@myString1}"
                'Change its font to Arial
                rpt.Sections("D").ReportObjects.Item(i).Font.Name = "Arial"
            Case "{@myString2}"
                'Change its font to Comic Sans MS
                rpt.Sections("D").ReportObjects.Item(i).Font.Name = "Comic Sans MS"
            End Select
            
        End If
    Next
    
    'Print results
    rpt.PrintOut False, 1, False
    
    Set rpt = Nothing
    Set myapp = Nothing




exemplo 2



  Dim CrxApp As CRAXDRT.Application
    Dim crxReport As CRAXDRT.Report
    Dim reportObject As Object
    Dim myFont As IFontDisp  'Declare a Font Object.
    Dim I As Integer
    Dim X As Integer

    Set CrxApp = New CRAXDRT.Application
    Set crxReport = CrxApp.OpenReport("H:    estcrtestsReport1.rpt")
      
    'Initialize the font object. Populate it  with the Font of the Form
    Set myFont = Me.Font
    
    'Set what fonts to display
    CommonDialog1.Flags = (cdlCFBoth Or cdlCFEffects)

    'Show the Font dialog
    CommonDialog1.ShowFont

    'Set properties of the  Font Object to what the user selected
    myFont.Bold = CommonDialog1.FontBold
    myFont.Italic = CommonDialog1.FontItalic
    myFont.Name = CommonDialog1.FontName
    myFont.Size = CommonDialog1.FontSize
    myFont.Underline = CommonDialog1.FontUnderline
    myFont.Strikethrough = CommonDialog1.FontStrikethru

    'now loop through all the sections and apply Font properties to field and text objects
    
    For I = 1 To crxReport.Sections.Count
        For X = 1 To crxReport.Sections(I).ReportObjects.Count
          Set reportObject = crxReport.Sections(I).ReportObjects.Item(X)
            If reportObject.Kind = crTextObject Or reportObject.Kind = crFieldObject Then
                reportObject.Font.Name = myFont.Name
                reportObject.Font.Bold = myFont.Bold
                reportObject.Font.Italic = myFont.Italic
                reportObject.Font.Size = myFont.Size
                reportObject.Font.Underline = myFont.Underline
                reportObject.Font.Strikethrough = myFont.Strikethrough
            End If
          Set reportObject = Nothing
        Next X
    Next I

    'Preview the report
    CRViewer91.ReportSource = crxReport
    CRViewer91.ViewReport
    
    'release the references    
    Set crxReport = Nothing
    Set crxApplication = Nothing




POR ESSE CAMINHO AQUI DA IMAGEM NAO TEM COMO AMIG ?

CLESIO SANTOS


#493239 - 26/03/2020 13:19:57

MALA
RONDONOPOLIS
Cadast. em:Janeiro/2004


 Anexos estao visíveis somente para usuários registrados

Amigo fiz assim

CLESIO SANTOS


 Tópico anterior Próximo tópico Novo tópico


Tópico encerrado, respostas não sao permitidas
Encerrado por MALA em 26/03/2020 13:20:17