Accueil > > > EXPORTER MFLEXGRID DANS DOCUMENT WORD
EXPORTER MFLEXGRID DANS DOCUMENT WORD
Information sur la source
Description
il faut referance le word application dans votre projet
Source
- Private Sub Image2_Click()
- 'Importer.DataGrid1.Print
- 'DataGrid1.t
- 'Early object binding
- Dim oWord As Word.Application
-
- Dim oDoc As Word.Document
- Dim oRange As Word.Range
- 'Uncomment below for late object binding
- 'Dim oWord As Object
- 'Dim oDoc As Object
- 'Dim oRange As Object
- Dim row As Integer
- Dim col As Integer
- Dim i As Integer
- Dim n As Integer
- Dim sTemp As String
- Dim arr() As String
-
- ReDim arr(MSFlexGrid1.Rows - 1, MSFlexGrid1.Cols - 1)
-
- 'Créer une instance de word
- Set oWord = CreateObject("Word.Application")
-
-
- 'rendre le document word visible
- oWord.Visible = True
-
- 'Ouivrir un nouveau document
- Set oDoc = oWord.Documents.Add
-
- For row = 0 To MSFlexGrid1.Rows - 1
- n = 0
- For col = 0 To MSFlexGrid1.Cols - 1
- arr(i, n) = MSFlexGrid1.TextMatrix(row, col)
- n = n + 1
- Next
- i = i + 1
- Next
-
- 'ENregistrer sur un tableau
- For i = LBound(arr, 1) To UBound(arr, 1)
- For n = LBound(arr, 2) To UBound(arr, 2)
- sTemp = sTemp & arr(i, n)
- If n = UBound(arr, 2) Then
- sTemp = sTemp & vbCrLf
- Else
- sTemp = sTemp & vbTab
- End If
- Next
- Next
-
- 'Avoir l'emplacelent sur le document
- Set oRange = oDoc.Bookmarks("\EndOfDoc").Range
-
- oRange.Text = sTemp
-
- 'Convertire le format et le texte
- oRange.ConvertToTable vbTab, Format:=wdTableFormatColorful2
-
- Set oRange = Nothing
-
- End Sub
Private Sub Image2_Click()
'Importer.DataGrid1.Print
'DataGrid1.t
'Early object binding
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oRange As Word.Range
'Uncomment below for late object binding
'Dim oWord As Object
'Dim oDoc As Object
'Dim oRange As Object
Dim row As Integer
Dim col As Integer
Dim i As Integer
Dim n As Integer
Dim sTemp As String
Dim arr() As String
ReDim arr(MSFlexGrid1.Rows - 1, MSFlexGrid1.Cols - 1)
'Créer une instance de word
Set oWord = CreateObject("Word.Application")
'rendre le document word visible
oWord.Visible = True
'Ouivrir un nouveau document
Set oDoc = oWord.Documents.Add
For row = 0 To MSFlexGrid1.Rows - 1
n = 0
For col = 0 To MSFlexGrid1.Cols - 1
arr(i, n) = MSFlexGrid1.TextMatrix(row, col)
n = n + 1
Next
i = i + 1
Next
'ENregistrer sur un tableau
For i = LBound(arr, 1) To UBound(arr, 1)
For n = LBound(arr, 2) To UBound(arr, 2)
sTemp = sTemp & arr(i, n)
If n = UBound(arr, 2) Then
sTemp = sTemp & vbCrLf
Else
sTemp = sTemp & vbTab
End If
Next
Next
'Avoir l'emplacelent sur le document
Set oRange = oDoc.Bookmarks("\EndOfDoc").Range
oRange.Text = sTemp
'Convertire le format et le texte
oRange.ConvertToTable vbTab, Format:=wdTableFormatColorful2
Set oRange = Nothing
End Sub
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
ASYNC/AWAIT: COMPRENDRE COMMENT CA MARCHEASYNC/AWAIT: COMPRENDRE COMMENT CA MARCHE par fathi
Tout le monde est unanime pour dire que la programmation multi-thread et asynchrone est en train de devenir un sujet incontournable. Beaucoup de choses sont arrivées avec le framework 4 pour le code parallèle (TPL, PLinq,.) et bientôt, on va avoir l...
Cliquez pour lire la suite de l'article par fathi PAS D'INTELLITRACE SUR MON SITE WEB DANS IIS !PAS D'INTELLITRACE SUR MON SITE WEB DANS IIS ! par Etienne Margraff
J'ai récemment eu un problème pour obtenir l'intelliTrace sur un site web dans IIS. Il n'y avait pas de message d'erreur, rien dans le journal d'évènement Windows, et après 3 appels à une voyante, 2 visites chez un marabou, j'ai failli me résign...
Cliquez pour lire la suite de l'article par Etienne Margraff OFFICE 365 - SHAREPOINT ONLINE, QUELQUES LIMITATIONSOFFICE 365 - SHAREPOINT ONLINE, QUELQUES LIMITATIONS par junarnoalg
De nombreuses entreprises font le choix de SharePoint Online, service fourni au travers de l'offre de Microsoft Office 365. S'il est vrai que ce choix apporte un grand nombre d'avantages; rapidité de mise en œuvre, disponibilité, large couvertu...
Cliquez pour lire la suite de l'article par junarnoalg PRéSENTATION DES API REST DE WINDOWS AZURE : LISTER LES COMPTES DE STORAGEPRéSENTATION DES API REST DE WINDOWS AZURE : LISTER LES COMPTES DE STORAGE par richardc
http://www.c2idotnet.com/articles/presentation-des-api-rest-de-windows-azure-lister-les-comptes-de-storage
Désolé pour "toto", mais c2i existait avant blogs.developpeur.org et c'est mon site "officiel" ;-) ...
Cliquez pour lire la suite de l'article par richardc
Logiciels
DocTranslate (V3.1.0.0)DOCTRANSLATE (V3.1.0.0)DocTranslate est un traducteur de document Microsoft Word, PowerPoint et Excel. Il permet d'autom... Cliquez pour télécharger DocTranslate Tribler (2012)TRIBLER (2012)Tribler est un client pair à pair (P2P/Peer-to-Peer) open source avec la capacité de regarder des... Cliquez pour télécharger Tribler OneSwarm (2012)ONESWARM (2012)Le peer-to-peer qui protège votre vie privée, c'est OneSwarm.
Ce logiciel de peer-to-peer crypté... Cliquez pour télécharger OneSwarm PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System
|