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

VB.NET Discussion :

changer l'emplacement de mon tableau dans un document word


Sujet :

VB.NET

  1. #1
    Futur Membre du Club
    Femme Profil pro
    genie informatique
    Inscrit en
    Août 2011
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : genie informatique
    Secteur : Enseignement

    Informations forums :
    Inscription : Août 2011
    Messages : 10
    Points : 9
    Points
    9
    Par défaut changer l'emplacement de mon tableau dans un document word
    Bonjour
    comment je peux changer l'emplacement de mon tableau ET LES LINES de text dans un document word
    j'ai ce code :
    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
    Public Class Form1
     
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim wordApp As Word.Application
            Dim wordDoc As Word.Document
            Dim oPara1 As Word.Paragraph
            Dim oPara2 As Word.Paragraph
     
     
            'Démarrer un nouveau document dans Word 
            wordApp = CreateObject("Word.Application")
            wordDoc = wordApp.Documents.Open(Application.StartupPath & "\Exemple.dot")
     
            'wordApp = CType(CreateObject("Word.Application"), Word.Application))
            ' wordDoc = wordApp.Documents.Add()
     
            ''Effacer toute l'information existante. 
            wordDoc.Range.Delete()
            'Insert a paragraph at the beginning of the document.
            oPara1 = wordDoc.Content.Paragraphs.Add
            oPara1.Range.Text = "123456789012345678901234567890123456789012345678901234567890" & _
    "123456789012345678901234567890123456789012345678901234567890123456789012"
            oPara1.Range.Font.Bold = True
            oPara1.Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
            oPara1.Format.SpaceAfter = 24    '24 pt spacing after paragraph.
            oPara1.Range.InsertParagraphAfter()
            oPara2 = wordDoc.Content.Paragraphs.Add(wordDoc.Bookmarks.Item("\endofdoc").Range)
            oPara1.Range.Text = TXT1.Text
            oPara2.Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphJustify
     
     
     
     
            'Mettre en place l'en-tête. 
            Dim Rng As Word.Range = wordDoc.Range(10, 10)
            Rng.Font.Name = "Verdana"
            Rng.Font.Size = 16
     
            Dim tlb As Word.Table = wordDoc.Tables.Add(Range:=Rng, NumRows:=4, NumColumns:=3)
            tlb.Borders.Enable = True
     
            'Remplissage des données à la table 
            'Row Header  
            tlb.Cell(1, 1).Range.Text = "Code"
            tlb.Cell(1, 2).Range.Text = "Nom"
            tlb.Cell(1, 3).Range.Text = "Montant"
     
            'Rangée de données 
            tlb.Cell(2, 1).Range.Text = "0001"
            tlb.Cell(2, 2).Range.Text = "Sandip"
            tlb.Cell(2, 3).Range.Text = "10000"
            tlb.Cell(2, 3).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight
     
            tlb.Cell(3, 1).Range.Text = "0002"
            tlb.Cell(3, 2).Range.Text = "Ssmit"
            tlb.Cell(3, 3).Range.Text = "2000"
            tlb.Cell(3, 3).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight
     
     
            tlb.Cell(4, 1).Range.Text = "0003"
            tlb.Cell(4, 2).Range.Text = "Doe"
            tlb.Cell(4, 3).Range.Text = "3000"
            tlb.Cell(4, 3).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight
     
            wordApp.Visible = True
     
     
     
        End Sub
     
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     
        End Sub
     
        Private Sub TXT1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXT1.TextChanged
     
        End Sub
    End Class
    Merci

  2. #2
    Membre du Club
    Femme Profil pro
    futur développeur
    Inscrit en
    Janvier 2010
    Messages
    135
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 34
    Localisation : Maroc

    Informations professionnelles :
    Activité : futur développeur

    Informations forums :
    Inscription : Janvier 2010
    Messages : 135
    Points : 48
    Points
    48
    Par défaut
    bonjour
    vous essayez d'introduire un fichier word sur visual studio pour y importer des données de la base?

  3. #3
    Futur Membre du Club
    Femme Profil pro
    genie informatique
    Inscrit en
    Août 2011
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : genie informatique
    Secteur : Enseignement

    Informations forums :
    Inscription : Août 2011
    Messages : 10
    Points : 9
    Points
    9
    Par défaut
    Citation Envoyé par wikiele Voir le message
    bonjour
    vous essayez d'introduire un fichier word sur visual studio pour y importer des données de la base?

    bonjour
    je veux transformer mon formulaire en word . ce formulaire contient déja les données de ma base de donnée .je travail avec vb.net 2008 pour ce code j'essaye d’insérer un text et un tableau que je veux changer son emplacement
    et merci

Discussions similaires

  1. Réponses: 1
    Dernier message: 04/07/2014, 09h15
  2. [XL-2007] Changer le titre de mon tableau
    Par isrdum dans le forum Macros et VBA Excel
    Réponses: 1
    Dernier message: 08/11/2012, 17h41
  3. [MySQL] changer l'emplacement d'un enregistrement dans un tableau
    Par folla_folla dans le forum PHP & Base de données
    Réponses: 2
    Dernier message: 18/06/2011, 15h03
  4. Visibilité de mon tableau dans bloc try catch
    Par erox44 dans le forum Collection et Stream
    Réponses: 1
    Dernier message: 18/05/2010, 15h13
  5. [VBA][WORD]Identifier un tableau dans un document
    Par mister3957 dans le forum VBA Word
    Réponses: 15
    Dernier message: 10/01/2006, 13h56

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