Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Word -Dokument den Cursor positionieren (https://www.delphipraxis.net/112551-word-dokument-den-cursor-positionieren.html)

aaron 23. Apr 2008 10:48


Word -Dokument den Cursor positionieren
 
Hallo liebes Forum,

ich füge den Inhalt eines Stringgrid's in Word ein:

Delphi-Quellcode:
  //1. spalte zentriert
    WordApp.Selection.movedown(wdline, lineszaehler, wdextend);
    WordApp.Selection.ParagraphFormat.Alignment := wdAlignParagraphCenter;
  //nächste Spalte
    WordApp.Selection.moveright(wdcharacter, 1);
    if wordversion = '12.0' then
      WordTable.Style := 'Tabellengitternetz';
    begin
      ProgressBar1.Max := iRows;
      for iGridRows := 1 to iRows do
      begin
        ProgressBar1.Position := 6 + iGridRows;
        for jGridCols := 1 to iCols do
        begin
          WordTable.Cell(iGridRows, jGridCols).Range.Text := StringGrid2.Cells[jGridCols - 1, igridRows - 1];
        end;
      end;
    end; end else
    ProgressBar1.Position := 0;
Meine Frage wäre, wie kann ich den Cursor ans Ende unter die Tabelle setzen?

Freundliche Grüße
Aaron

aaron 23. Apr 2008 11:06

Re: Word -Dokument den Cursor positionieren
 
Hab's doch rausgefunden:
Delphi-Quellcode:
WordApp.Selection.EndKey(wdStory);
Viele Grüße
aaron

Trille 18. Apr 2009 10:54

Re: Word -Dokument den Cursor positionieren
 
Ich muss das Thema nochmal hochholen.

Ich füge eine Tabelle hinzu

Delphi-Quellcode:
// Tabelle hinzufügen
curTable := WordDocument.Tables.Add(WordApplication.Selection.Range, 5, 3,
          defaultTableBehavior, autoFitBehavior);
Nun möchte ich unterhalb dieser Tabelle (eine Zeile Abstand) noch eine Tabelle einfügen.

Ich habe nun folgendes Versucht

Delphi-Quellcode:
moveUnit, moveCount, ext:olevariant;

moveUnit := wdStory;
moveCount := 1;
WordApplication.Selection.EndKey(moveUnit, moveCount);

Er springt zwar ans Ende der Tabelle, nur ist diese nun komplett markiert. Wie kann ich es bewerkstelligen, dass ich beide Tabellen mit einer Leerzeile dazwischen anzeige?


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:22 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz