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

Documents Java Discussion :

[iText] rowspan & colspan


Sujet :

Documents Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Inscrit en
    Octobre 2008
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Octobre 2008
    Messages : 10
    Par défaut [iText] rowspan & colspan
    bonjour
    j'ai une tableau (4,4) (lignes, colonnes) je veux savoir comment faire pour mettre les cells des coordonnées (2, 3), (2, 4), (3, 3) et (3, 4) dans un seul cell [ c-a-d colspan(2) et rowspan(2) ]

    [ ][ ][ ][ ]
    [ ][ ][¨¨¨]
    [ ][ ][___]
    [ ][ ][ ][ ]

    PdfPTable table = new PdfPTable(4);

    table.setWidths(new float[]{1, 1, 1, 1});
    table.addCell("row 1; cell 1");
    table.addCell("row 1; cell 2");
    table.addCell("row 1; cell 3");
    table.addCell("row 1; cell 4");
    table.addCell("row 2; cell 1");
    table.addCell("row 2; cell 2");
    table.addCell("row 2; cell 3");
    table.addCell("row 2; cell 4");
    table.addCell("row 3; cell 1");
    table.addCell("row 3; cell 2");
    table.addCell("row 3; cell 3");
    table.addCell("row 3; cell 4");
    table.addCell("row 4; cell 1");
    table.addCell("row 4; cell 2");
    table.addCell("row 4; cell 3");
    table.addCell("row 4; cell 4");

  2. #2
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2012
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2012
    Messages : 13
    Par défaut
    Salut,

    Pour utiliser des Row/colspan, il faut utiliser les cellules de tableau.

    Voici un exemple :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    Phrase ajout = new Phrase( "row 2; cell 3"  )
    PdfPCell cell = new PdfPCell( ajout );
    cell.setColspan(2);
    table.addCell( cell);
    Bon courage

  3. #3
    Membre averti
    Inscrit en
    Octobre 2008
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Octobre 2008
    Messages : 10
    Par défaut
    bonjour,
    merci pour votre réponse. Oui je comprend bien comment utilisé les colspan et le rowspan des cellules dans une tableau la seule souci que j'ai rencontre le faite de faire les deux ensembles pour créer une cellule de 4 cellules (2 col et 2 row)
    merci une autre fois

  4. #4
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2012
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2012
    Messages : 13
    Par défaut
    Bonjour,

    Pour moi, ce code à fonctionné :

    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
     
    PdfPTable table = new PdfPTable(new float[]{1, 1, 1, 1});
     
    		table.addCell("row 1; cell 1");
    		table.addCell("row 1; cell 2");
    		table.addCell("row 1; cell 3");
    		table.addCell("row 1; cell 4");
    		table.addCell("row 2; cell 1");
    		table.addCell("row 2; cell 2");
     
    		PdfPCell cell = new PdfPCell(new Phrase("Cellule colspan"));
    		cell.setRowspan(2);
    		cell.setColspan(2);
    		table.addCell(cell);
    		table.addCell("row 2; cell 4");
    		table.addCell("row 3; cell 1");
    		table.addCell("row 3; cell 2");
    		table.addCell("row 3; cell 3");
    		table.addCell("row 3; cell 4");
    		table.addCell("row 4; cell 1");
    		table.addCell("row 4; cell 2");
    		table.addCell("row 4; cell 3");
    		table.addCell("row 4; cell 4");
    Cordialement

Discussions similaires

  1. Réponses: 2
    Dernier message: 09/01/2014, 05h23
  2. Colspan et RowSpan
    Par Diablo_22 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 3
    Dernier message: 19/11/2008, 09h45
  3. t:dataTable et colspan, rowspan
    Par thetoto52 dans le forum JSF
    Réponses: 6
    Dernier message: 11/04/2008, 10h22
  4. Ajouter 1 ligne à un tableau avec rowspan & colspan
    Par softflower dans le forum Général JavaScript
    Réponses: 8
    Dernier message: 22/11/2006, 22h35

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