Autor Beitrag
delphist
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

WIN XP, 98, 95; SUSE LINUX 8.1, 6.1, 6.0

BeitragVerfasst: Do 05.02.04 17:09 
Hallo
ich habe ein Problem mit Word!
Mit der Makro aufzeichnung kam ich zu folgendem Code!
Wie kann ich den jetzt für Delphi aufbereiten??
Bitte Helft mir!

ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=2, NumColumns:= _
3, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
With Selection.Tables(1)
.Columns.PreferredWidth = CentimetersToPoints(7.4)
If .Style <> "Tabellengitternetz" Then
.Style = "Tabellengitternetz"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
End With
ActiveWindow.ActivePane.HorizontalPercentScrolled = 10
ActiveWindow.ActivePane.HorizontalPercentScrolled = 0
CommandBars("Task Pane").Visible = False
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.Collapse Direction:=wdCollapseStart
Selection.Move Unit:=wdColumn, Count:=-1
Selection.SelectColumn
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Move Unit:=wdColumn, Count:=1
Selection.SelectColumn
Selection.Tables(1).Rows.Alignment = wdAlignRowCenter
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = CentimetersToPoints(2)
Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
Selection.Cells.PreferredWidthType = wdPreferredWidthAuto
Selection.Cells.PreferredWidth = 0
Selection.Rows.HeightRule = wdRowHeightAtLeast
Selection.Rows.Height = CentimetersToPoints(5.3)
Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
Selection.Columns.PreferredWidth = CentimetersToPoints(2)
Selection.Cells.PreferredWidthType = wdPreferredWidthPoints
Selection.Cells.PreferredWidth = CentimetersToPoints(2)

_________________
3w + freehostlist + de
3w + bild-stoerung + de
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 05.02.04 19:35 
Hallo

was hast du denn bisher erreicht? Wo genau haperts denn?
Nutzt Du die Server-kompos? Welche Version kommt zum Einsatz?

Wenn du die Serverkompos nutzt, kannst du recht gut mit der Codevervollständigung umgehen, und dir die Befehle/Eigenschaften anzeigen lassen.
als kleiner Anfang (Word97-serverkompo):
- CentimetersToPoints ist eine Methode von Wordapplication
- die Item-zugriffe sind ein wenig anders als in Word, meist mußt du xxx.item(nr) schreiben, bekommst du mit der Codevervollständigung recht schnell raus.
ausblenden Delphi-Quelltext
1:
2:
3:
WordApplication1.ActiveDocument.Tables.Add(WordApplication1.Selection.Range, 2, 3);
With WordApplication1.Selection.Tables.Item(1) do
 Columns.Width := WordApplication1.CentimetersToPoints(4.4)

(preferedwidth gabs bei mir nicht, kann an der 97-Version liegen)

mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)