AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Problem beim Formatieren einer Word-Tabelle
Thema durchsuchen
Ansicht
Themen-Optionen

Problem beim Formatieren einer Word-Tabelle

Ein Thema von Trille · begonnen am 21. Mär 2009
Antwort Antwort
Trille

Registriert seit: 25. Sep 2007
62 Beiträge
 
#1

Problem beim Formatieren einer Word-Tabelle

  Alt 21. Mär 2009, 10:02
Hallo allerseits, ich experimentiere momentan etwas mit Delphi und Word herum. Nun habe ich folgendes Problem:

Ich füge einem worddokument eine Tabelle hinzu, das funktioniert super. Nun möchte ich diese Tabelle folgendermaßen formatieren:


// Tabelle hinzufügen
Delphi-Quellcode:
curTable := WordDocument.Tables.Add(WordApplication.Selection.Range,100,3,_DefaultTableBehavior,_AutoFitBehavior);
        
        curTable.Cell(1, 1).Range.Font.Name := 'Arial';
        curTable.Cell(1, 1).Range.Font.Size := 8;
        curTable.Cell(1, 1).Range.Font.Color := clRed;
        curTable.Cell(1, 1).Range.Text := 'Test';
Das funktioniert auch bestens.

Jetzt probiere ich folgendes:
Delphi-Quellcode:
curTable := WordDocument.Tables.Add(WordApplication.Selection.Range,100,3,_DefaultTableBehavior,_AutoFitBehavior);
        FormatTableHeader(curTable, 'Arial', 8, clRed);


procedure TMainForm.FormatTableHeader(var tab: Table; font: TFontName; fontSize: Integer; color: Cardinal);
var
    i: integer;
begin
        tab.Cell(1, 1).Range.Font.Name := font;
        tab.Cell(1, 1).Range.Font.Size := fontSize;
        tab.Cell(1, 1).Range.Font.Color := color;

        // temp
        tab.Cell(1, 1).Range.Text := 'Test';
end;
Jetzt fliegt mir entweder die Anwendung um die Ohren oder es wird irgendeine Zelle formatiert.
Was mache ich falsch?

Vielen Dank!
  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 04:00 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