AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Tabelle neue Zeile

Ein Thema von roth · begonnen am 9. Mär 2007 · letzter Beitrag vom 14. Mär 2007
Antwort Antwort
roth

Registriert seit: 25. Nov 2005
Ort: -
72 Beiträge
 
#1

Tabelle neue Zeile

  Alt 9. Mär 2007, 20:41
Abend!
Habe folgendes Problem ich schreibe in ein Wordfile in eine Tabelle:
Delphi-Quellcode:
      wordApp.Selection.typetext(text :='Test');
      wordApp.Selection.moveRight;
      wordApp.Selection.typetext(text :='Test');
      wordApp.Selection.moveRight;
      wordApp.Selection.typetext(text :='Test');
      wordApp.Selection.moveRight;
      wordApp.Selection.typetext(text :='Test');
      wordApp.Selection.moveRight;
nun macht es mir leider keine neue Zeile, sondern schreibt einfach weiter unter die Tabelle!
Wie kann ich diese Problem lösen, sodass es mir immer eine Zeile anhängt sobald es die letzte Zelle ist in der Tabelle!?

mfg roth
  Mit Zitat antworten Zitat
Benutzerbild von Remko
Remko

Registriert seit: 10. Okt 2006
Ort: 's-Hertogenbosch, Die Niederlande
222 Beiträge
 
RAD-Studio 2010 Arc
 
#2

Re: Tabelle neue Zeile

  Alt 9. Mär 2007, 21:23
Easiest way to find out is to record a macro in Word then look at the VBS code.
  Mit Zitat antworten Zitat
roth

Registriert seit: 25. Nov 2005
Ort: -
72 Beiträge
 
#3

Re: Tabelle neue Zeile

  Alt 9. Mär 2007, 21:31
yes sure! But how looks the Delphicode with this VBS Macro Code :
Delphi-Quellcode:
    Selection.TypeText Text:="test"
    Selection.MoveRight Unit:=wdCell
    Selection.TypeText Text:="test"
    Selection.MoveRight Unit:=wdCell
    Selection.TypeText Text:="test"
  Mit Zitat antworten Zitat
Benutzerbild von Remko
Remko

Registriert seit: 10. Okt 2006
Ort: 's-Hertogenbosch, Die Niederlande
222 Beiträge
 
RAD-Studio 2010 Arc
 
#4

Re: Tabelle neue Zeile

  Alt 10. Mär 2007, 13:45
Try this:

Delphi-Quellcode:
var wdString: WideString;

  wdString := 'blabla';
  WordApplication1.Selection.Text := wdString;
  WordApplication1.Selection.MoveRight(wdCell);
or

WordApplication1.Selection.TypeText(wdString); or just

WordApplication1.Selection.TypeText('Text'); but remember, Word expects Unicode strings (WideString)
  Mit Zitat antworten Zitat
roth

Registriert seit: 25. Nov 2005
Ort: -
72 Beiträge
 
#5

Re: Tabelle neue Zeile

  Alt 10. Mär 2007, 18:38
i try this
Delphi-Quellcode:
wordApp.Selection.typetext(text := '-');
          wordApp.Selection.moveRight(1);
and it write into the Table, but my Problem is that if the table ends it doesn't make a new colum.
How can I write into the Table and if the Table ends it should make a new colum!?!?!?

So as you will klick the Tab-Key in the Word!
  Mit Zitat antworten Zitat
Benutzerbild von Remko
Remko

Registriert seit: 10. Okt 2006
Ort: 's-Hertogenbosch, Die Niederlande
222 Beiträge
 
RAD-Studio 2010 Arc
 
#6

Re: Tabelle neue Zeile

  Alt 10. Mär 2007, 19:10
Use wordApp.Selection.moveRight(wdCell) instead of wordApp.Selection.moveRight(1);
wdCell is a constant which is declared in the Word type library, this moves right one cell instead of one character
  Mit Zitat antworten Zitat
roth

Registriert seit: 25. Nov 2005
Ort: -
72 Beiträge
 
#7

Re: Tabelle neue Zeile

  Alt 10. Mär 2007, 19:20
Okey but then it gives this Error:

[Fehler] main.pas(1050): Undefinierter Bezeichner: 'wdCell'

???
  Mit Zitat antworten Zitat
Benutzerbild von Remko
Remko

Registriert seit: 10. Okt 2006
Ort: 's-Hertogenbosch, Die Niederlande
222 Beiträge
 
RAD-Studio 2010 Arc
 
#8

Re: Tabelle neue Zeile

  Alt 10. Mär 2007, 19:27
It's a constant declared in the Word type library, usually this in in the folder {BDS}\Imports folder, depending on the Word version it's probably Word2000 or WordXP. If you don't have that, import the type library yourself (replace Office 8.0 with your office version).

To import the Word type library,

Choose Project|Import Type Library.
In the Import Type Library dialog,

Select Microsoft Office 8.0 Object Library.
If Word ( Version 8 ) is not in the list, choose the Add button, go to Program Files\Microsoft Office\Office, select the Word type library file, MSWord8.olb choose Add, and then select Word ( Version 8 ) from the list.

In Palette Page, choose Servers.
Choose Install.
The Install dialog appears. Select the Into New Packages tab and type WordExample to create a new package containing this type library.
  Mit Zitat antworten Zitat
Benutzerbild von Remko
Remko

Registriert seit: 10. Okt 2006
Ort: 's-Hertogenbosch, Die Niederlande
222 Beiträge
 
RAD-Studio 2010 Arc
 
#9

Re: Tabelle neue Zeile

  Alt 14. Mär 2007, 09:17
So is it working for you know?
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:44 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