IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Composants VCL Delphi Discussion :

Outil de dispositions rapports ?


Sujet :

Composants VCL Delphi

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mars 2013
    Messages
    14
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2013
    Messages : 14
    Par défaut Outil de dispositions rapports ?
    Bonjour. bien longtemps que je n'étais venu ici.
    je reviens avec joie à la programmation Delphi après avoir été contraint par la mode du full web à d'autres langages et EDI :-)

    puisqu'une image est bien plus "parlante" qu'un long discours :

    Nom : page rapport OpenLog.png
Affichages : 353
Taille : 209,7 Ko

    je créé un rapport faisant intervenir différents graphiques et tableaux. tout ça est écrit "en dur" dans le code et était assez figé, mais d'un client à l'autre il peut y avoir des souhaits différents.
    tel ou tel graphique n’apparaîtrait pas ou alors sur l'autre page.

    j'ai découpé ma page en surface graphe (demi page) demi graphe, etc.

    Nom : DispositionOpenLog.png
Affichages : 303
Taille : 8,8 Ko

    l'idée est présenter une interface ou l'on pourra choisir les surface, leur disposition, leur contenu.
    mais avant de réinventer la roue, sauriez vous s'il existe un composant qui s'approche de ça?

    du coté des générateurs de rapports, je vois des choses assez éloigné de ce dont j'ai besoin..

  2. #2
    Rédacteur/Modérateur

    Avatar de SergioMaster
    Homme Profil pro
    Développeur informatique retraité
    Inscrit en
    Janvier 2007
    Messages
    15 663
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 69
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Janvier 2007
    Messages : 15 663
    Billets dans le blog
    65
    Par défaut
    Bonsoir et (re)bienvenue
    Citation Envoyé par bitben Voir le message
    du coté des générateurs de rapports, je vois des choses assez éloigné de ce dont j'ai besoin..
    chacune des surfaces peut être un(sous) état (subreport) et chaque état peu se disposer dans une zone de la page à imprimer
    c'est possible avec FastReport, Rave et certainement d'autres.
    FastReport (version enregistrée) à en outre l'avantage de fournir à l'utilisateur la possibilité de designer sa sortie
    Donc, a priori, avec FastReport ça devrait le faire (surtout que l'on peut inclure les graphes)

  3. #3
    Membre averti
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mars 2013
    Messages
    14
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2013
    Messages : 14
    Par défaut
    merci de cette rapide réponse.
    je n'ai pas trop cherché je l'avoue pour le moment, mais n'ayant que deux pages à créer , le générateur de rapports me semblait peu adapté.
    C’était surtout la possibilité donné à l'utilisateur de pouvoir composer une page à sa guise que m'intéressait.
    je vais creuser un peu. ça me fera sans doute aussi du boulot si je ne peux plus utiliser Debenu PDF library qui dessinait les tableaux et me permettant de construire le PDF.
    si d’ailleurs qq un utilise cette librairie, je serais ravi d'avoir qq échanges et peut être proposer des routines que je me suis faites.

  4. #4
    Membre Expert

    Homme Profil pro
    Retraité
    Inscrit en
    Novembre 2007
    Messages
    3 530
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 64
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Novembre 2007
    Messages : 3 530
    Par défaut
    Un de nos clients utilise Debenu dans son projet et c'est vrai que ça fonctionne plutôt pas mal.
    N'hésite pas à partager ce que tu juges opportun, parce que ça peut toujours servir

  5. #5
    Membre averti
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mars 2013
    Messages
    14
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2013
    Messages : 14
    Par défaut
    Mince! je n'avais pas vue la réponse.
    voici qq routines simples, qui correspondaient à mes besoins particuliers.


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    // Remplace le texte dans tout le tableau
      function QPDFTableauRemplaceTexte(TexteSrc, TexteDest : string; ID_Table : integer; var PDFLib: TDebenuPDFLibrary1113) : integer;
      // Remplace le texte d'une colonne donnée
      function QPDFTableauRemplaceTexteCol(TexteSrc, TexteDest : string; ID_Table, Col : integer; var PDFLib: TDebenuPDFLibrary1113) : integer;
      // juste pour ajouter une valeur et passer à la ligne suivante
      function QPDFTableauAddVal(Valeur : single; ID_Table, Col : integer; Var Row : integer; var PDFLib: TDebenuPDFLibrary1113) : integer;
      // On va regarder toutes les valeurs, trouver min et max, puis colorer en fonction
      function QPDFTableauColorationSelonContenu(ID_Table, FirstRow, LastRow, FirstCol, LastCol : integer; var PDFLib: TDebenuPDFLibrary1113) : integer;
     
      function QPDFTableauDelRow(TextePremCol : string; ID_Table : integer; var PDFLib: TDebenuPDFLibrary1113) : integer; overload;
      function QPDFTableauDelRow(NoLigne, ID_Table : integer; var PDFLib: TDebenuPDFLibrary1113) : integer; overload;
      // Suppression de la ligne si aucune valeur trouvée en la parcourant
      function QPDFTableauDelRowSiZero(NoLigne, ID_Table, ColDeb, ColFin : integer; var PDFLib: TDebenuPDFLibrary1113) : integer; overload;
      // Idem, mais sur tout le tableau en parcourant toutes les lignes, entre deux colonnes données
      function QPDFTableauDelRowSiZero(ID_Table, ColDeb, ColFin : integer; var PDFLib: TDebenuPDFLibrary1113) : integer; overload;
      // Remplace les valeur nulles par des chaine vides
      function QPDFTableauVideSiZero(ID_Table, ColDeb, ColFin : integer; var PDFLib: TDebenuPDFLibrary1113) : integer;
     
      function QPDFRowSum(ID_Table, Row, ColDeb, ColFin : integer; PDFLib : TDebenuPDFLibrary1113) : double;
      function QPDFRowAvg(ID_Table, Row, ColDeb, ColFin : integer; PDFLib : TDebenuPDFLibrary1113) : double;
     
      function QPDFTitreTableau(Texte : string; PosX, PosY, LargTab : Integer; PDFLib : TDebenuPDFLibrary1113) : double;
     
    implementation
     
    // Remplace le texte dans tout le tableau
    function QPDFTableauRemplaceTexte(TexteSrc, TexteDest : string; ID_Table : integer; var PDFLib: TDebenuPDFLibrary1113) : integer;
    var
      NbCol, NbRow, IdxCol, IdxRow : integer;
     
    begin
      NbCol := PDFLib.GetTableColumnCount(ID_Table); NbRow := PDFLib.GetTableRowCount(ID_Table);
     
      For IdxRow := 1 to NbRow do
        For IdxCol := 1 to NbCol do
        begin
          if (TexteSrc = PDFLib.GetTableCellStrProperty(ID_Table, IdxRow, IdxCol, 301{Cell contents})) then
            PDFLib.SetTableCellContent(Id_Table, IdxRow, IdxCol, TexteDest);
        end;
     
    end; // QPDFTableauRemplaceTexte
     
    // Remplace le texte d'une colonne donnée
    function QPDFTableauRemplaceTexteCol(TexteSrc, TexteDest : string; ID_Table, Col : integer; var PDFLib: TDebenuPDFLibrary1113) : integer;
    var
      NbRow, IdxRow : integer;
     
    begin
      NbRow := PDFLib.GetTableRowCount(ID_Table);
     
      For IdxRow := 1 to NbRow do
        begin
          if (TexteSrc = PDFLib.GetTableCellStrProperty(ID_Table, IdxRow, Col, 301{Cell contents})) then
            PDFLib.SetTableCellContent(Id_Table, IdxRow, Col, TexteDest);
        end;
     
    end; // QPDFTableauRemplaceTexteCol
     
    // juste pour ajouter une valeur et passer à la ligne suivante
    function QPDFTableauAddVal(Valeur : single; ID_Table, Col : integer; Var Row : integer; var PDFLib: TDebenuPDFLibrary1113) : integer;
    begin
      inc(Row);
      PDFLib.SetTableCellContent(Id_Table, Row, Col, Format('%2.1f', [Valeur]));
    end; // QPDFTableauAddVal
     
     
    // 28/11/2016 :  pas de fonction pour effacer une ligne, pas de fonction pour changer aprés création la taille d'un tableau. mais on peut afficher que X col et rows
    // Effacement de la ligne dont on donne le contenu de la première colonne
    function QPDFTableauDelRow(TextePremCol : string; ID_Table : integer; var PDFLib: TDebenuPDFLibrary1113) : integer;
    var
      NbCol, NbRow, IdxCol, IdxRow, i : integer;
     
    begin
      NbCol := PDFLib.GetTableColumnCount(ID_Table); NbRow := PDFLib.GetTableRowCount(ID_Table);
     
      IdxRow := 0;
     
      while IdxRow < NbRow do
      begin
        if (TextePremCol = PDFLib.GetTableCellStrProperty(ID_Table, IdxRow, 1, 301{Cell contents})) then
        begin
          for i := IdxRow  to NbRow do
            for IdxCol := 1 to NbCol do
              PDFLib.SetTableCellContent{écriture}(Id_Table, IdxRow, IdxCol, PDFLib.GetTableCellStrProperty{lecture}(ID_Table, IdxRow + 1, IdxCol, 301{Cell contents}));
          exit;
        end;
        Inc(IdxRow);
      end;
     
    end; // QPDFTableauDelRow
     
    // Effacement de la ligne dont on donne le N°
    function QPDFTableauDelRow(NoLigne, ID_Table : integer; var PDFLib: TDebenuPDFLibrary1113) : integer;
    var
      NbCol, NbRow, IdxCol, IdxRow, i : integer;
     
    begin
      NbCol := PDFLib.GetTableColumnCount(ID_Table); NbRow := PDFLib.GetTableRowCount(ID_Table);
     
      IdxRow := NoLigne;
     
      for i := IdxRow to pred(NbRow) do
        for IdxCol := 1 to NbCol do
          PDFLib.SetTableCellContent{écriture}(Id_Table, i, IdxCol, PDFLib.GetTableCellStrProperty{lecture}(ID_Table, i + 1, IdxCol, 301{Cell contents}));
     
      result := NbRow - 1;
     
    end; // QPDFTableauDelRow
     
    // Suppression de la ligne si aucune valeur trouvée en la parcourant
    function QPDFTableauDelRowSiZero(NoLigne, ID_Table, ColDeb, ColFin : integer; var PDFLib: TDebenuPDFLibrary1113) : integer;
    var
      NbCol, NbRow, IdxCol, IdxRow, i : integer;
      Chaine : string;
      Zero : boolean;
     
    begin
      NbCol := PDFLib.GetTableColumnCount(ID_Table); NbRow := PDFLib.GetTableRowCount(ID_Table);
      Zero := true;
     
      for IdxCol := ColDeb to ColFin do
      begin
        Chaine := PDFLib.GetTableCellStrProperty{lecture}(ID_Table, NoLigne, IdxCol, 301{Cell contents});
        if not ((Chaine = '') OR (Chaine = '0.0') OR (Chaine = '0')) then
        begin
          result := NbRow;
          exit;
        end;
      end;
     
      QPDFTableauDelRow(NoLigne, ID_Table, PDFLib);
      result := pred(NbRow);
     
    end; // QPDFTableauDelRowSiZero
     
    //Idem, mais sur tout le tableau en parcourant toutes les lignes, entre deux colonnes données
    function QPDFTableauDelRowSiZero(ID_Table, ColDeb, ColFin : integer; var PDFLib: TDebenuPDFLibrary1113) : integer;
    var
      NbCol, NbRows, IdxCol, IdxRow, i : integer;
      Chaine : string;
      Zero : boolean;
     
    begin
      NbCol := PDFLib.GetTableColumnCount(ID_Table); NbRows := PDFLib.GetTableRowCount(ID_Table);
     
      IdxRow := 1;
      while IdxRow < NbRows do
      begin
        Zero := true;
        for IdxCol := ColDeb to ColFin do
        begin
          Chaine := PDFLib.GetTableCellStrProperty{lecture}(ID_Table, IdxRow, IdxCol, 301{Cell contents});
          if not ((Chaine = '') OR (Chaine = '0.0') OR (Chaine = '0')) then
          begin
            inc(IdxRow);
            Zero := false;
            break;
          end;
        end;
        if Zero then
        begin
          QPDFTableauDelRow(IdxRow, ID_Table, PDFLib);
          Dec(NbRows);
        end;
      end;
     
      result := NbRows;
     
    end; // QPDFTableauDelRowSiZero
     
    // Remplace les valeur nulles par des chaine vides
    function QPDFTableauVideSiZero(ID_Table, ColDeb, ColFin : integer; var PDFLib: TDebenuPDFLibrary1113) : integer;
    var
      NbCol, NbRow, IdxCol, IdxRow, i : integer;
      Chaine : string;
     
    begin
      NbCol := PDFLib.GetTableColumnCount(ID_Table); NbRow := PDFLib.GetTableRowCount(ID_Table);
     
      for IdxRow := 1 to NbRow do
        for IdxCol := ColDeb to ColFin do
        begin
          Chaine := PDFLib.GetTableCellStrProperty{lecture}(ID_Table, IdxRow, IdxCol, 301{Cell contents});
          if  (Chaine = '0.0') OR (Chaine = '0') OR (Chaine = '0%')then
            PDFLib.SetTableCellContent{écriture}(Id_Table, IdxRow, IdxCol, '');
        end;
     
    end; // QPDFTableauDelRowSiZero
     
     
    // On va regarder toutes les valeurs, trouver min et max, puis colorer en fonction
    function QPDFTableauColorationSelonContenu(ID_Table, FirstRow, LastRow, FirstCol, LastCol : integer; var PDFLib: TDebenuPDFLibrary1113) : integer;
    var
      NbCol, NbRow, IdxCol, IdxRow, i : integer;
      Valeur, Min, Max, r,g,b : double;
      Texte : string;
     
    begin
      Min := MaxDouble; Max := MinDouble;
      NbCol := PDFLib.GetTableColumnCount(ID_Table); NbRow := PDFLib.GetTableRowCount(ID_Table);
     
      for IdxRow := FirstRow to LastRow do
        for IdxCol := FirstCol to LastCol do
        begin
          Texte := PDFLib.GetTableCellStrProperty(ID_Table, IdxRow, IdxCol, 301{Cell contents});
          if Texte <> '' then
          begin
            Valeur := StrToFloat(Texte);
            if Valeur < Min then  Min := Valeur;
            if Valeur > Max then  Max := Valeur;
          end;
        end;
     
      for IdxRow := FirstRow to LastRow do
        for IdxCol := FirstCol to LastCol do
        begin
          Texte := PDFLib.GetTableCellStrProperty(ID_Table, IdxRow, IdxCol, 301{Cell contents});
          if Texte <> '' then
          begin
            Valeur := StrToFloat(Texte);
            TColorToRGB_0_1(CouleurSelonMinMax(Min, Max, Valeur, False), r,g,b);
            PDFLib.SetTableCellBackgroundColor(Id_Table, IdxRow, IdxCol, IdxRow, IdxCol, r, g, b);
          end;
        end;
     
    end; // QPDFTableauColorationSelonContenu
     
    function QPDFRowSum(ID_Table, Row, ColDeb, ColFin : integer; PDFLib : TDebenuPDFLibrary1113) : double;
    var
      j : integer;
      ch : string;
    begin
      result := 0;
      for j := ColDeb to ColFin do
      begin
        ch := PDFLib.GetTableCellStrProperty(ID_Table, Row, j, 301);
        if (ch <> '') AND (ch <> '-INF'){}  then
        begin
          ch := HTMLStripAll(ch); //
     
          if ch[length(ch)] = '%' then
            Delete(ch, Length(ch) , 1);
     
          result := result + StrToFloat(ch);
        end;
      end;
    end; // RowSumQPDF
     
    function QPDFRowAvg(ID_Table, Row, ColDeb, ColFin : integer; PDFLib : TDebenuPDFLibrary1113) : double;
    var
      j, Nb : integer;
      ch : string;
      total : double;
    begin
      result := 0; total := 0; nb := 0;
      for j := ColDeb to ColFin do
      begin
        ch := PDFLib.GetTableCellStrProperty(ID_Table, Row, j, 301);
        if (ch <> '') AND (ch <> '-INF'){} then
        begin
          ch := HTMLStripAll(ch); //
     
          if ch[length(ch)] = '%' then
            Delete(ch, Length(ch) , 1);
     
          total := total + StrToFloat(ch);
     
          inc(nb);
     
        end;
      end;
     
      if Nb <> 0 then
        result := total / Nb
      else
        result := 0;
     
    end; //RowAvgQPDF
    pour afficher mes graphes : (je poste ça parce que j'ai galéré un peu à trouver)
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    procedure TChartEMFToStreamToPDFLib(Chart : TChart);
    var
      strm : TMemoryStream;
    begin
      meta := TMetafile.Create;
      meta := Chart.TeeCreateMetafile(true, rect(0,0,Chart.Width, Chart.Height));
      strm := TMemoryStream.Create;
      meta.SaveToStream(strm);
      PDFLibrary.ImportEMFFromStream(strm, 0{fontOpt}, 0{generalopt});
    end;

Discussions similaires

  1. Réponses: 3
    Dernier message: 21/05/2012, 10h42
  2. outils pour un rapport croisé de mes dépendances
    Par besstiolle dans le forum Maven
    Réponses: 2
    Dernier message: 27/04/2010, 10h49
  3. Réponses: 1
    Dernier message: 23/12/2009, 11h21
  4. [SNMP] Outils snmp sous linux (graphes, rapports...)
    Par doudine dans le forum Développement
    Réponses: 2
    Dernier message: 12/04/2005, 09h08

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo